[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <201307021345090019137@gmail.com>
Date: Tue, 2 Jul 2013 13:45:12 +0800
From: majianpeng <majianpeng@...il.com>
To: sage <sage@...tank.com>
Cc: ceph-devel <ceph-devel@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: [PATCH 1/3] mds: update atime if client can read.
Now, update atime only for CEPH_CAP_FILE_EXCL.Change this if
CEPH_CAP_FILE_RD.
Signed-off-by: Jianpeng Ma <majianpeng@...il.com>
---
src/mds/Locker.cc | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc
index 30e014a..58f953f 100644
--- a/src/mds/Locker.cc
+++ b/src/mds/Locker.cc
@@ -2676,8 +2676,9 @@ void Locker::_do_snap_update(CInode *in, snapid_t snap, int dirty, snapid_t foll
void Locker::_update_cap_fields(CInode *in, int dirty, MClientCaps *m, inode_t *pi)
{
// file
+ utime_t atime = m->get_atime();
+
if (dirty & (CEPH_CAP_FILE_EXCL|CEPH_CAP_FILE_WR)) {
- utime_t atime = m->get_atime();
utime_t mtime = m->get_mtime();
utime_t ctime = m->get_ctime();
uint64_t size = m->get_size();
@@ -2700,11 +2701,7 @@ void Locker::_update_cap_fields(CInode *in, int dirty, MClientCaps *m, inode_t *
pi->size = size;
pi->rstat.rbytes = size;
}
- if ((dirty & CEPH_CAP_FILE_EXCL) && atime != pi->atime) {
- dout(7) << " atime " << pi->atime << " -> " << atime
- << " for " << *in << dendl;
- pi->atime = atime;
- }
+
if ((dirty & CEPH_CAP_FILE_EXCL) &&
ceph_seq_cmp(pi->time_warp_seq, m->get_time_warp_seq()) < 0) {
dout(7) << " time_warp_seq " << pi->time_warp_seq << " -> " << m->get_time_warp_seq()
@@ -2712,6 +2709,12 @@ void Locker::_update_cap_fields(CInode *in, int dirty, MClientCaps *m, inode_t *
pi->time_warp_seq = m->get_time_warp_seq();
}
}
+
+ if ((dirty & CEPH_CAP_FILE_RD) && atime > pi->atime) {
+ dout(7) << " atime " << pi->atime << " -> " << atime
+ << " for " << *in << dendl;
+ pi->atime = atime;
+ }
// auth
if (dirty & CEPH_CAP_AUTH_EXCL) {
if (m->head.uid != pi->uid) {
--
1.8.3.rc1.44.gb387c77
Powered by blists - more mailing lists