ceph: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method
PATCH 1/1 ceph: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method
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.
--- fs/ceph/addr.c | 1 - fs/ceph/file.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-)
fs/ceph/addr.c +0 -1
@@ -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)
fs/ceph/file.c +2 -0
@@ -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);
Signature · 1 line
2.39.2
Quoted 28 lines · Christoph Hellwig
Since commit
a2ad63daa88b("VFS: addFMODE_CAN_ODIRECTfile flag") file systems can just set theFMODE_CAN_ODIRECTflag at open time instead of wiring up a dummydirect_IOmethod to indicate support for direct I/O. Do that for ceph so thatnoop_direct_IOcan eventually be removed.Signed-off-by Christoph Hellwig <[email protected]>--- fs/ceph/addr.c | 1 - fs/ceph/file.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-)fs/ceph/addr.c +0
-1@@ -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)fs/ceph/file.c +0
-0
fs/ceph/file.c int ceph_open(struct inode *inode, struct file *file) · line 373
Quoted 6 lines
fs/ceph/file.c +2
-0@@ -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
Quoted 2 lines
fs/ceph/file.c +0
-0dout ("open inode %p ino %llx.%llx file %p flags %d (%d)\n" , inode,ceph_vinop (inode), file, flags, file->f_flags);
Quoted 28 lines · Christoph Hellwig
Since commit
a2ad63daa88b("VFS: addFMODE_CAN_ODIRECTfile flag") file systems can just set theFMODE_CAN_ODIRECTflag at open time instead of wiring up a dummydirect_IOmethod to indicate support for direct I/O. Do that for ceph so thatnoop_direct_IOcan eventually be removed.Signed-off-by Christoph Hellwig <[email protected]>--- fs/ceph/addr.c | 1 - fs/ceph/file.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-)fs/ceph/addr.c +0
-1@@ -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)fs/ceph/file.c +0
-0
fs/ceph/file.c int ceph_open(struct inode *inode, struct file *file) · line 371
Quoted 4 lines
fs/ceph/file.c +1
-0@@ -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
Quoted 4 lines
fs/ceph/file.c +1
-0+ 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);
Quoted 5 lines · Xiubo Li
fs/ceph/file.c int ceph_open(struct inode *inode, struct file *file) · line 372
Quoted 3 lines
fs/ceph/file.c +2
-0+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..
Quoted 11 lines
fs/ceph/file.c int ceph_open(struct inode *inode, struct file *file) · line 371
Quoted 7 lines
fs/ceph/file.c +1
-0@@ -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: addFMODE_CAN_ODIRECTfile flag") doesn't check theS_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.