Merge tag 'pull-old-dio' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 25 Apr 2023 02:28:49 +0000 (19:28 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 25 Apr 2023 02:28:49 +0000 (19:28 -0700)
Pull legacy dio cleanup from Al Viro.

* tag 'pull-old-dio' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  __blockdev_direct_IO(): get rid of submit_io callback

1  2 
fs/ocfs2/aops.c
include/linux/fs.h

diff --combined fs/ocfs2/aops.c
index 0394505fdce3fa0a70161c48aa0f28ce4128ef43,50448ba5fda824a3e1ae9a41a525d49caf64628f..8dfc284e85f0936da24ee4e28ed46460ab7f4e55
@@@ -1977,26 -1977,11 +1977,26 @@@ int ocfs2_write_end_nolock(struct addre
        }
  
        if (unlikely(copied < len) && wc->w_target_page) {
 +              loff_t new_isize;
 +
                if (!PageUptodate(wc->w_target_page))
                        copied = 0;
  
 -              ocfs2_zero_new_buffers(wc->w_target_page, start+copied,
 -                                     start+len);
 +              new_isize = max_t(loff_t, i_size_read(inode), pos + copied);
 +              if (new_isize > page_offset(wc->w_target_page))
 +                      ocfs2_zero_new_buffers(wc->w_target_page, start+copied,
 +                                             start+len);
 +              else {
 +                      /*
 +                       * When page is fully beyond new isize (data copy
 +                       * failed), do not bother zeroing the page. Invalidate
 +                       * it instead so that writeback does not get confused
 +                       * put page & buffer dirty bits into inconsistent
 +                       * state.
 +                       */
 +                      block_invalidate_folio(page_folio(wc->w_target_page),
 +                                              0, PAGE_SIZE);
 +              }
        }
        if (wc->w_target_page)
                flush_dcache_page(wc->w_target_page);
@@@ -2463,7 -2448,7 +2463,7 @@@ static ssize_t ocfs2_direct_IO(struct k
  
        return __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev,
                                    iter, get_block,
-                                   ocfs2_dio_end_io, NULL, 0);
+                                   ocfs2_dio_end_io, 0);
  }
  
  const struct address_space_operations ocfs2_aops = {
diff --combined include/linux/fs.h
index af95b64fc810cce98d8cc9002944de781d396c15,b07d13e546d328d549650377e9716a376391db91..ef2281a2accef88e1326ee4f8b1d970792288254
@@@ -2675,8 -2675,6 +2675,8 @@@ extern struct inode *new_inode(struct s
  extern void free_inode_nonrcu(struct inode *inode);
  extern int setattr_should_drop_suidgid(struct mnt_idmap *, struct inode *);
  extern int file_remove_privs(struct file *);
 +int setattr_should_drop_sgid(struct mnt_idmap *idmap,
 +                           const struct inode *inode);
  
  /*
   * This must be used for allocating filesystems specific inodes to set
@@@ -2780,7 -2778,7 +2780,7 @@@ enum 
  ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
                             struct block_device *bdev, struct iov_iter *iter,
                             get_block_t get_block,
-                            dio_iodone_t end_io, dio_submit_t submit_io,
+                            dio_iodone_t end_io,
                             int flags);
  
  static inline ssize_t blockdev_direct_IO(struct kiocb *iocb,
                                         get_block_t get_block)
  {
        return __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev, iter,
-                       get_block, NULL, NULL, DIO_LOCKING | DIO_SKIP_HOLES);
+                       get_block, NULL, DIO_LOCKING | DIO_SKIP_HOLES);
  }
  #endif