gfs2: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method
authorChristoph Hellwig <hch@lst.de>
Mon, 12 Jun 2023 05:36:46 +0000 (07:36 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Mon, 12 Jun 2023 10:18:55 +0000 (12:18 +0200)
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.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/aops.c
fs/gfs2/file.c

index a5f4be6b9213edff2b7744c1be2209ca9ba609de..d95125714ebb38176216c6f2a39889ff259341db 100644 (file)
@@ -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,
index cb62c8f07d1e7a9141deddae38b3b803de88a81d..a6ad64cee8853022b5a41a0a48bf6f62f37b7707 100644 (file)
@@ -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);