ceph-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ceph: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method
@ 2023-06-12  5:35 Christoph Hellwig
  2023-06-13  0:57 ` Xiubo Li
  2023-06-13  1:06 ` Xiubo Li
  0 siblings, 2 replies; 4+ messages in thread
From: Christoph Hellwig @ 2023-06-12  5:35 UTC (permalink / raw)
  To: xiubli, idryomov, jlayton, ceph-devel

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

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/ceph/addr.c | 1 -
 fs/ceph/file.c | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 6bb251a4d613eb..19c0f42540b600 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -1401,7 +1401,6 @@ const struct address_space_operations ceph_aops = {
 	.dirty_folio = ceph_dirty_folio,
 	.invalidate_folio = ceph_invalidate_folio,
 	.release_folio = ceph_release_folio,
-	.direct_IO = noop_direct_IO,
 };
 
 static void ceph_block_sigs(sigset_t *oldset)
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index f4d8bf7dec88a8..314c5d5971bf4a 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -368,6 +368,8 @@ int ceph_open(struct inode *inode, struct file *file)
 	flags = file->f_flags & ~(O_CREAT|O_EXCL);
 	if (S_ISDIR(inode->i_mode))
 		flags = O_DIRECTORY;  /* mds likes to know */
+	if (S_ISREG(inode->i_mode))
+		file->f_mode |= FMODE_CAN_ODIRECT;
 
 	dout("open inode %p ino %llx.%llx file %p flags %d (%d)\n", inode,
 	     ceph_vinop(inode), file, flags, file->f_flags);
-- 
2.39.2


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

* Re: [PATCH] ceph: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method
  2023-06-12  5:35 [PATCH] ceph: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method Christoph Hellwig
@ 2023-06-13  0:57 ` Xiubo Li
  2023-06-13  6:01   ` Christoph Hellwig
  2023-06-13  1:06 ` Xiubo Li
  1 sibling, 1 reply; 4+ messages in thread
From: Xiubo Li @ 2023-06-13  0:57 UTC (permalink / raw)
  To: Christoph Hellwig, idryomov, jlayton, ceph-devel


On 6/12/23 13:35, 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 ceph so that noop_direct_IO can eventually be removed.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   fs/ceph/addr.c | 1 -
>   fs/ceph/file.c | 2 ++
>   2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index 6bb251a4d613eb..19c0f42540b600 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -1401,7 +1401,6 @@ const struct address_space_operations ceph_aops = {
>   	.dirty_folio = ceph_dirty_folio,
>   	.invalidate_folio = ceph_invalidate_folio,
>   	.release_folio = ceph_release_folio,
> -	.direct_IO = noop_direct_IO,
>   };
>   
>   static void ceph_block_sigs(sigset_t *oldset)
> diff --git a/fs/ceph/file.c b/fs/ceph/file.c
> index f4d8bf7dec88a8..314c5d5971bf4a 100644
> --- a/fs/ceph/file.c
> +++ b/fs/ceph/file.c
> @@ -368,6 +368,8 @@ int ceph_open(struct inode *inode, struct file *file)
>   	flags = file->f_flags & ~(O_CREAT|O_EXCL);
>   	if (S_ISDIR(inode->i_mode))
>   		flags = O_DIRECTORY;  /* mds likes to know */
> +	if (S_ISREG(inode->i_mode))
> +		file->f_mode |= FMODE_CAN_ODIRECT;
>   

Shouldn't we do the same in 'ceph_atomic_open()' too ?

Thanks

- Xiubo


>   	dout("open inode %p ino %llx.%llx file %p flags %d (%d)\n", inode,
>   	     ceph_vinop(inode), file, flags, file->f_flags);


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

* Re: [PATCH] ceph: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method
  2023-06-12  5:35 [PATCH] ceph: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method Christoph Hellwig
  2023-06-13  0:57 ` Xiubo Li
@ 2023-06-13  1:06 ` Xiubo Li
  1 sibling, 0 replies; 4+ messages in thread
From: Xiubo Li @ 2023-06-13  1:06 UTC (permalink / raw)
  To: Christoph Hellwig, idryomov, jlayton, ceph-devel


On 6/12/23 13:35, 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 ceph so that noop_direct_IO can eventually be removed.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   fs/ceph/addr.c | 1 -
>   fs/ceph/file.c | 2 ++
>   2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index 6bb251a4d613eb..19c0f42540b600 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -1401,7 +1401,6 @@ const struct address_space_operations ceph_aops = {
>   	.dirty_folio = ceph_dirty_folio,
>   	.invalidate_folio = ceph_invalidate_folio,
>   	.release_folio = ceph_release_folio,
> -	.direct_IO = noop_direct_IO,
>   };
>   
>   static void ceph_block_sigs(sigset_t *oldset)
> diff --git a/fs/ceph/file.c b/fs/ceph/file.c
> index f4d8bf7dec88a8..314c5d5971bf4a 100644
> --- a/fs/ceph/file.c
> +++ b/fs/ceph/file.c
> @@ -368,6 +368,8 @@ int ceph_open(struct inode *inode, struct file *file)
>   	flags = file->f_flags & ~(O_CREAT|O_EXCL);
>   	if (S_ISDIR(inode->i_mode))
>   		flags = O_DIRECTORY;  /* mds likes to know */
> +	if (S_ISREG(inode->i_mode))

BTW, the commit a2ad63daa88b ("VFS: add FMODE_CAN_ODIRECT file flag") 
doesn't check the S_ISREG, and I couldn't see this commit and NFS 
confine it to regular files, is that okay ?

Thanks

- Xiubo


> +		file->f_mode |= FMODE_CAN_ODIRECT;
>   
>   	dout("open inode %p ino %llx.%llx file %p flags %d (%d)\n", inode,
>   	     ceph_vinop(inode), file, flags, file->f_flags);


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

* Re: [PATCH] ceph: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method
  2023-06-13  0:57 ` Xiubo Li
@ 2023-06-13  6:01   ` Christoph Hellwig
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2023-06-13  6:01 UTC (permalink / raw)
  To: Xiubo Li; +Cc: Christoph Hellwig, idryomov, jlayton, ceph-devel

On Tue, Jun 13, 2023 at 08:57:42AM +0800, Xiubo Li wrote:
>> +	if (S_ISREG(inode->i_mode))
>> +		file->f_mode |= FMODE_CAN_ODIRECT;
>>   
>
> Shouldn't we do the same in 'ceph_atomic_open()' too ?

Yes, probably.  Or I really need to press ahead and move the flag
to file operations..

>> --- a/fs/ceph/file.c
>> +++ b/fs/ceph/file.c
>> @@ -368,6 +368,8 @@ int ceph_open(struct inode *inode, struct file *file)
>>   	flags = file->f_flags & ~(O_CREAT|O_EXCL);
>>   	if (S_ISDIR(inode->i_mode))
>>   		flags = O_DIRECTORY;  /* mds likes to know */
>> +	if (S_ISREG(inode->i_mode))
>
> BTW, the commit a2ad63daa88b ("VFS: add FMODE_CAN_ODIRECT file flag") 
> doesn't check the S_ISREG, and I couldn't see this commit and NFS confine 
> it to regular files, is that okay ?

It doesn't have to.  ->direct_IO was previously set only for regular
files (and block devices in the block code).  So it makes sense to do
the same for the flag.

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

end of thread, other threads:[~2023-06-13  6:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-12  5:35 [PATCH] ceph: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method Christoph Hellwig
2023-06-13  0:57 ` Xiubo Li
2023-06-13  6:01   ` Christoph Hellwig
2023-06-13  1:06 ` Xiubo Li

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).