*/
  #define IOMAP_DIO_OVERWRITE_ONLY      (1 << 1)
  
+ /*
+  * When a page fault occurs, return a partial synchronous result and allow
+  * the caller to retry the rest of the operation after dealing with the page
+  * fault.
+  */
+ #define IOMAP_DIO_PARTIAL             (1 << 2)
+ 
  ssize_t iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
                const struct iomap_ops *ops, const struct iomap_dio_ops *dops,
-               unsigned int dio_flags);
+               unsigned int dio_flags, size_t done_before);
  struct iomap_dio *__iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
                const struct iomap_ops *ops, const struct iomap_dio_ops *dops,
-               unsigned int dio_flags);
+               unsigned int dio_flags, size_t done_before);
  ssize_t iomap_dio_complete(struct iomap_dio *dio);
 -int iomap_dio_iopoll(struct kiocb *kiocb, bool spin);
  
  #ifdef CONFIG_SWAP
  struct file;
 
  /*
   * Add an arbitrary waiter to a page's wait queue
   */
 -extern void add_page_wait_queue(struct page *page, wait_queue_entry_t *waiter);
 +void folio_add_wait_queue(struct folio *folio, wait_queue_entry_t *waiter);
  
  /*
-  * Fault everything in given userspace address range in.
+  * Fault in userspace address range.
   */
- static inline int fault_in_pages_writeable(char __user *uaddr, size_t size)
- {
-       char __user *end = uaddr + size - 1;
- 
-       if (unlikely(size == 0))
-               return 0;
- 
-       if (unlikely(uaddr > end))
-               return -EFAULT;
-       /*
-        * Writing zeroes into userspace here is OK, because we know that if
-        * the zero gets there, we'll be overwriting it.
-        */
-       do {
-               if (unlikely(__put_user(0, uaddr) != 0))
-                       return -EFAULT;
-               uaddr += PAGE_SIZE;
-       } while (uaddr <= end);
- 
-       /* Check whether the range spilled into the next page. */
-       if (((unsigned long)uaddr & PAGE_MASK) ==
-                       ((unsigned long)end & PAGE_MASK))
-               return __put_user(0, end);
- 
-       return 0;
- }
- 
- static inline int fault_in_pages_readable(const char __user *uaddr, size_t size)
- {
-       volatile char c;
-       const char __user *end = uaddr + size - 1;
- 
-       if (unlikely(size == 0))
-               return 0;
- 
-       if (unlikely(uaddr > end))
-               return -EFAULT;
- 
-       do {
-               if (unlikely(__get_user(c, uaddr) != 0))
-                       return -EFAULT;
-               uaddr += PAGE_SIZE;
-       } while (uaddr <= end);
- 
-       /* Check whether the range spilled into the next page. */
-       if (((unsigned long)uaddr & PAGE_MASK) ==
-                       ((unsigned long)end & PAGE_MASK)) {
-               return __get_user(c, end);
-       }
- 
-       (void)c;
-       return 0;
- }
+ size_t fault_in_writeable(char __user *uaddr, size_t size);
+ size_t fault_in_safe_writeable(const char __user *uaddr, size_t size);
+ size_t fault_in_readable(const char __user *uaddr, size_t size);
  
  int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
 -                              pgoff_t index, gfp_t gfp_mask);
 +              pgoff_t index, gfp_t gfp);
  int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
 -                              pgoff_t index, gfp_t gfp_mask);
 +              pgoff_t index, gfp_t gfp);
 +int filemap_add_folio(struct address_space *mapping, struct folio *folio,
 +              pgoff_t index, gfp_t gfp);
  extern void delete_from_page_cache(struct page *page);
  extern void __delete_from_page_cache(struct page *page, void *shadow);
  void replace_page_cache_page(struct page *old, struct page *new);