linux-bcachefs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bcachefs: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method
@ 2024-05-10  6:10 Youling Tang
  2024-05-13 12:31 ` Brian Foster
  0 siblings, 1 reply; 2+ messages in thread
From: Youling Tang @ 2024-05-10  6:10 UTC (permalink / raw)
  To: Kent Overstreet; +Cc: linux-bcachefs, linux-kernel, Youling Tang

From: Youling Tang <tangyouling@kylinos.cn>

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 bcachefs so that noop_direct_IO can eventually be removed.

Similar to commit b29434999371 ("xfs: set FMODE_CAN_ODIRECT instead of
a dummy direct_IO method").

Signed-off-by: Youling Tang <tangyouling@kylinos.cn>
---
 fs/bcachefs/fs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index a8d71cec1c17..7ef41ce2d8c6 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -1142,6 +1142,8 @@ static int bch2_open(struct inode *vinode, struct file *file)
 			return ret;
 	}
 
+	file->f_mode |= FMODE_CAN_ODIRECT;
+
 	return generic_file_open(vinode, file);
 }
 
@@ -1234,7 +1236,6 @@ static const struct address_space_operations bch_address_space_operations = {
 	.write_end	= bch2_write_end,
 	.invalidate_folio = bch2_invalidate_folio,
 	.release_folio	= bch2_release_folio,
-	.direct_IO	= noop_direct_IO,
 #ifdef CONFIG_MIGRATION
 	.migrate_folio	= filemap_migrate_folio,
 #endif
-- 
2.34.1


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

* Re: [PATCH] bcachefs: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method
  2024-05-10  6:10 [PATCH] bcachefs: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method Youling Tang
@ 2024-05-13 12:31 ` Brian Foster
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Foster @ 2024-05-13 12:31 UTC (permalink / raw)
  To: Youling Tang; +Cc: Kent Overstreet, linux-bcachefs, linux-kernel, Youling Tang

On Fri, May 10, 2024 at 02:10:58PM +0800, Youling Tang wrote:
> From: Youling Tang <tangyouling@kylinos.cn>
> 
> 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 bcachefs so that noop_direct_IO can eventually be removed.
> 
> Similar to commit b29434999371 ("xfs: set FMODE_CAN_ODIRECT instead of
> a dummy direct_IO method").
> 
> Signed-off-by: Youling Tang <tangyouling@kylinos.cn>
> ---

Seems straightforward:

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/bcachefs/fs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
> index a8d71cec1c17..7ef41ce2d8c6 100644
> --- a/fs/bcachefs/fs.c
> +++ b/fs/bcachefs/fs.c
> @@ -1142,6 +1142,8 @@ static int bch2_open(struct inode *vinode, struct file *file)
>  			return ret;
>  	}
>  
> +	file->f_mode |= FMODE_CAN_ODIRECT;
> +
>  	return generic_file_open(vinode, file);
>  }
>  
> @@ -1234,7 +1236,6 @@ static const struct address_space_operations bch_address_space_operations = {
>  	.write_end	= bch2_write_end,
>  	.invalidate_folio = bch2_invalidate_folio,
>  	.release_folio	= bch2_release_folio,
> -	.direct_IO	= noop_direct_IO,
>  #ifdef CONFIG_MIGRATION
>  	.migrate_folio	= filemap_migrate_folio,
>  #endif
> -- 
> 2.34.1
> 
> 


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

end of thread, other threads:[~2024-05-13 12:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-10  6:10 [PATCH] bcachefs: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method Youling Tang
2024-05-13 12:31 ` Brian Foster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).