diff mbox series

btrfs: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method

Message ID 20230608091133.104734-1-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series btrfs: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method | expand

Commit Message

Christoph Hellwig June 8, 2023, 9:11 a.m. UTC
Since commit a2ad63daa88b ("VFS: add FMODE_CAN_ODIRECT file flag") file
systems can just set the FMODE_CAN_ODIRECT flag at open time instead of
wiring up a dummy direct_IO method to indicate support for direct I/O.
Do that for btrfs so that noop_direct_IO can eventually be removed.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/btrfs/file.c  | 1 +
 fs/btrfs/inode.c | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

Comments

David Sterba June 8, 2023, 3:51 p.m. UTC | #1
On Thu, Jun 08, 2023 at 11:11:33AM +0200, Christoph Hellwig wrote:
> Since commit a2ad63daa88b ("VFS: add FMODE_CAN_ODIRECT file flag") file
> systems can just set the FMODE_CAN_ODIRECT flag at open time instead of
> wiring up a dummy direct_IO method to indicate support for direct I/O.
> Do that for btrfs so that noop_direct_IO can eventually be removed.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Added to misc-next, thanks. Seems that a few more filesystem can use the
same conversion.
Christoph Hellwig June 8, 2023, 3:58 p.m. UTC | #2
On Thu, Jun 08, 2023 at 05:51:41PM +0200, David Sterba wrote:
> On Thu, Jun 08, 2023 at 11:11:33AM +0200, Christoph Hellwig wrote:
> > Since commit a2ad63daa88b ("VFS: add FMODE_CAN_ODIRECT file flag") file
> > systems can just set the FMODE_CAN_ODIRECT flag at open time instead of
> > wiring up a dummy direct_IO method to indicate support for direct I/O.
> > Do that for btrfs so that noop_direct_IO can eventually be removed.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Added to misc-next, thanks. Seems that a few more filesystem can use the
> same conversion.

Yes.  I have a few more patches, but not all are as trivial.
diff mbox series

Patch

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index f649647392e0e4..af5bfe13824512 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -3710,6 +3710,7 @@  static int btrfs_file_open(struct inode *inode, struct file *filp)
 	int ret;
 
 	filp->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC | FMODE_BUF_WASYNC;
+	filp->f_mode |= FMODE_CAN_ODIRECT;
 
 	ret = fsverity_file_open(inode, filp);
 	if (ret)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 3f99f02dc1fe20..027e28fc69b2fc 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -10903,7 +10903,6 @@  static const struct address_space_operations btrfs_aops = {
 	.read_folio	= btrfs_read_folio,
 	.writepages	= btrfs_writepages,
 	.readahead	= btrfs_readahead,
-	.direct_IO	= noop_direct_IO,
 	.invalidate_folio = btrfs_invalidate_folio,
 	.release_folio	= btrfs_release_folio,
 	.migrate_folio	= btrfs_migrate_folio,