ceph: update atime after read-operation.
PATCH 2/3 ceph: update atime after read-operation.
Now ceph don't support updating atime after read-operation if the open mode is CEPH_CAP_FILE_RD.There are two reasons:
1:in client of fs,it don't set dirty cap of CEPH_CAP_FILE_RD. 2:in mds,it only update the atime if the condition
"dirty & (CEPH_CAP_FILE_EXCL|CEPH_CAP_FILE_WR) is true.
But if we can read, we can update atime. This patch only modify client to support.
--- fs/ceph/file.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/ceph/file.c +9 -0
@@ -672,6 +672,15 @@ again: out:dout ("aio_read %p %llx.%llx dropping cap refs on %s = %d\n" , inode,ceph_vinop (inode),ceph_cap_string (got), (int )ret); + +if (ret >=0 ) { +int dirty; +spin_lock (&ci->i_ceph_lock); + dirty =__ceph_mark_dirty_caps (ci,CEPH_CAP_FILE_RD ); +spin_unlock (&ci->i_ceph_lock); +if (dirty) +__mark_inode_dirty (inode, dirty); + }ceph_put_cap_refs (ci, got);if (checkeof && ret >=0 ) {
Signature · 1 line
1.8.1.2
Quoted 7 lines · majianpeng
Now ceph don't support updating atime after read-operation if the open mode is CEPH_CAP_FILE_RD.There are two reasons:
1:in client of fs,it don't set dirty cap ofCEPH_CAP_FILE_RD. 2:in mds,it only update the atime if the condition
"dirty & (CEPH_CAP_FILE_EXCL|CEPH_CAP_FILE_WR) is true.
But if we can read, we can update atime. This patch only modify client to support.
Do we awnt to update atime if ret == 0?
Otherwise looks good. Please make the changelog only describe the kernel change (in this patch) and not the MDS changes.
sage
Quoted 29 lines
Signed-off-by Jianpeng Ma <[email protected]>--- fs/ceph/file.c | 9 +++++++++ 1 file changed, 9 insertions(+)fs/ceph/file.c +9
-0@@ -672,6 +672,15 @@ again: out:dout ("aio_read %p %llx.%llx dropping cap refs on %s = %d\n" , inode,ceph_vinop (inode),ceph_cap_string (got), (int )ret); + +if (ret >=0 ) { +int dirty; +spin_lock (&ci->i_ceph_lock); + dirty =__ceph_mark_dirty_caps (ci,CEPH_CAP_FILE_RD ); +spin_unlock (&ci->i_ceph_lock); +if (dirty) +__mark_inode_dirty (inode, dirty); + }ceph_put_cap_refs (ci, got);if (checkeof && ret >=0 ) {Signature · 1 line
1.8.1.2