btrfs: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method
authorChristoph Hellwig <hch@lst.de>
Thu, 8 Jun 2023 09:11:33 +0000 (11:11 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 19 Jun 2023 11:59:38 +0000 (13:59 +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.
Do that for btrfs so that noop_direct_IO can eventually be removed.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/file.c
fs/btrfs/inode.c

index f53b7b7..392bc7d 100644 (file)
@@ -3700,7 +3700,8 @@ 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_NOWAIT | FMODE_BUF_RASYNC | FMODE_BUF_WASYNC |
+                       FMODE_CAN_ODIRECT;
 
        ret = fsverity_file_open(inode, filp);
        if (ret)
index 0219a78..b92c814 100644 (file)
@@ -11011,7 +11011,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,