public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method
@ 2023-06-08  9:11 Christoph Hellwig
  2023-06-08 15:51 ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2023-06-08  9:11 UTC (permalink / raw)
  To: clm, josef, dsterba; +Cc: linux-btrfs

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>
---
 fs/btrfs/file.c  | 1 +
 fs/btrfs/inode.c | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index f649647392e0e4..af5bfe13824512 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -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)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 3f99f02dc1fe20..027e28fc69b2fc 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -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,
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method
  2023-06-08  9:11 [PATCH] btrfs: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method Christoph Hellwig
@ 2023-06-08 15:51 ` David Sterba
  2023-06-08 15:58   ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: David Sterba @ 2023-06-08 15:51 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: clm, josef, dsterba, linux-btrfs

On Thu, Jun 08, 2023 at 11:11:33AM +0200, Christoph Hellwig 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.
> Do that for btrfs so that noop_direct_IO can eventually be removed.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method
  2023-06-08 15:51 ` David Sterba
@ 2023-06-08 15:58   ` Christoph Hellwig
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2023-06-08 15:58 UTC (permalink / raw)
  To: David Sterba; +Cc: Christoph Hellwig, clm, josef, dsterba, linux-btrfs

On Thu, Jun 08, 2023 at 05:51:41PM +0200, David Sterba wrote:
> On Thu, Jun 08, 2023 at 11:11:33AM +0200, Christoph Hellwig 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.
> > Do that for btrfs so that noop_direct_IO can eventually be removed.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-08 15:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-08  9:11 [PATCH] btrfs: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method Christoph Hellwig
2023-06-08 15:51 ` David Sterba
2023-06-08 15:58   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox