Skip to contentSkip to conversation

btrfs: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method

PATCH In review Christoph Hellwig 2 participants 3 messages Jun 8, 2023 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method

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.

---
 fs/btrfs/file.c  | 1 +
 fs/btrfs/inode.c | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/file.c +1 -0
index f649647392e0e4..af5bfe13824512 100644
@@ -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)
fs/btrfs/inode.c +0 -1
index 3f99f02dc1fe20..027e28fc69b2fc 100644
@@ -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,
Signature · 1 line
2.39.2
#1 lore raw
Quoted 6 lines · Christoph Hellwig

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.

Added to misc-next, thanks. Seems that a few more filesystem can use the same conversion.

#2 lore raw
Quoted 10 lines · David Sterba
Quoted 6 lines · Christoph Hellwig

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.

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.