Skip to contentSkip to conversation

xfs: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method

PATCH In review Christoph Hellwig 2 participants 2 messages Jun 12, 2023 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: 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 xfs so that noop_direct_IO can eventually be removed.

---
 fs/xfs/xfs_aops.c | 2 --
 fs/xfs/xfs_file.c | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)
fs/xfs/xfs_aops.c +0 -2
index 2ef78aa1d3f608..451942fb38ec21 100644
@@ -582,7 +582,6 @@ const struct address_space_operations xfs_address_space_operations = {
 	.release_folio		= iomap_release_folio,
 	.invalidate_folio	= iomap_invalidate_folio,
 	.bmap			= xfs_vm_bmap,
-	.direct_IO		= noop_direct_IO,
 	.migrate_folio		= filemap_migrate_folio,
 	.is_partially_uptodate  = iomap_is_partially_uptodate,
 	.error_remove_page	= generic_error_remove_page,
@@ -591,7 +590,6 @@ const struct address_space_operations xfs_address_space_operations = {
 
 const struct address_space_operations xfs_dax_aops = {
 	.writepages		= xfs_dax_writepages,
-	.direct_IO		= noop_direct_IO,
 	.dirty_folio		= noop_dirty_folio,
 	.swap_activate		= xfs_iomap_swapfile_activate,
 };
fs/xfs/xfs_file.c +1 -1
index aede746541f8ae..605587fefbd3c5 100644
@@ -1172,7 +1172,7 @@ xfs_file_open(
 	if (xfs_is_shutdown(XFS_M(inode->i_sb)))
 		return -EIO;
 	file->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC | FMODE_BUF_WASYNC |
-			FMODE_DIO_PARALLEL_WRITE;
+			FMODE_DIO_PARALLEL_WRITE | FMODE_CAN_ODIRECT;
 	return generic_file_open(inode, file);
 }
 
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 36 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 xfs so that noop_direct_IO can eventually be removed.

---
 fs/xfs/xfs_aops.c | 2 --
 fs/xfs/xfs_file.c | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)
fs/xfs/xfs_aops.c +0 -2
index 2ef78aa1d3f608..451942fb38ec21 100644
@@ -582,7 +582,6 @@ const struct address_space_operations xfs_address_space_operations = {
 	.release_folio		= iomap_release_folio,
 	.invalidate_folio	= iomap_invalidate_folio,
 	.bmap			= xfs_vm_bmap,
-	.direct_IO		= noop_direct_IO,
 	.migrate_folio		= filemap_migrate_folio,
 	.is_partially_uptodate  = iomap_is_partially_uptodate,
 	.error_remove_page	= generic_error_remove_page,
@@ -591,7 +590,6 @@ const struct address_space_operations xfs_address_space_operations = {
 
 const struct address_space_operations xfs_dax_aops = {
 	.writepages		= xfs_dax_writepages,
-	.direct_IO		= noop_direct_IO,
 	.dirty_folio		= noop_dirty_folio,
 	.swap_activate		= xfs_iomap_swapfile_activate,
 };
fs/xfs/xfs_file.c +0 -0
index aede746541f8ae..605587fefbd3c5 100644

fs/xfs/xfs_file.c xfs_file_open( · line 1177

Quoted 7 lines
fs/xfs/xfs_file.c +1 -1
@@ -1172,7 +1172,7 @@ xfs_file_open(
 	if (xfs_is_shutdown(XFS_M(inode->i_sb)))
 		return -EIO;
 	file->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC | FMODE_BUF_WASYNC |
-			FMODE_DIO_PARALLEL_WRITE;
+			FMODE_DIO_PARALLEL_WRITE | FMODE_CAN_ODIRECT;
 	return generic_file_open(inode, file);
 }

Looks OK.

Signature · 2 lines
Dave Chinner
[email protected]