Skip to contentSkip to conversation

gfs2: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method

PATCH New Christoph Hellwig 2 participants 2 messages Jun 12, 2023 GFS2 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gfs2: 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.

Remove .direct_IO from gfs2_aops, and set FMODE_CAN_ODIRECT in gfs2_open_common for regular files that do not use data journalling.

---
 fs/gfs2/aops.c | 1 -
 fs/gfs2/file.c | 3 +++
 2 files changed, 3 insertions(+), 1 deletion(-)
fs/gfs2/aops.c +0 -1
index a5f4be6b9213ed..d95125714ebb38 100644
@@ -750,7 +750,6 @@ static const struct address_space_operations gfs2_aops = {
 	.release_folio = iomap_release_folio,
 	.invalidate_folio = iomap_invalidate_folio,
 	.bmap = gfs2_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,
fs/gfs2/file.c +3 -0
index 300844f50dcd28..dcb2b7dd2269cf 100644
@@ -630,6 +630,9 @@ int gfs2_open_common(struct inode *inode, struct file *file)
 		ret = generic_file_open(inode, file);
 		if (ret)
 			return ret;
+
+		if (!gfs2_is_jdata(GFS2_I(inode)))
+			file->f_mode |= FMODE_CAN_ODIRECT;
 	}
 
 	fp = kzalloc(sizeof(struct gfs2_file), GFP_NOFS);
Signature · 1 line
2.39.2
#1 lore raw

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

Quoted 6 lines · On Mon, Jun 12, 2023 at 7:54?AM Christoph Hellwig <[email protected]> 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.

Remove .direct_IO from gfs2_aops, and set FMODE_CAN_ODIRECT in gfs2_open_common for regular files that do not use data journalling.

Thanks, added to for-next.

Andreas

Quoted 35 lines
---
 fs/gfs2/aops.c | 1 -
 fs/gfs2/file.c | 3 +++
 2 files changed, 3 insertions(+), 1 deletion(-)
fs/gfs2/aops.c +0 -1
index a5f4be6b9213ed..d95125714ebb38 100644
@@ -750,7 +750,6 @@ static const struct address_space_operations gfs2_aops = {
        .release_folio = iomap_release_folio,
        .invalidate_folio = iomap_invalidate_folio,
        .bmap = gfs2_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,
fs/gfs2/file.c +3 -1
index 300844f50dcd28..dcb2b7dd2269cf 100644
@@ -630,6 +630,9 @@ int gfs2_open_common(struct inode *inode, struct file *file)
                ret = generic_file_open(inode, file);
                if (ret)
                        return ret;
+
+               if (!gfs2_is_jdata(GFS2_I(inode)))
+                       file->f_mode |= FMODE_CAN_ODIRECT;
        }
 
        fp = kzalloc(sizeof(struct gfs2_file), GFP_NOFS);
--

2.39.2