]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds/client: add btime to CapSnap and MClientCaps
authorJeff Layton <jlayton@redhat.com>
Mon, 29 Aug 2016 11:16:39 +0000 (07:16 -0400)
committerJeff Layton <jlayton@redhat.com>
Mon, 29 Aug 2016 11:16:39 +0000 (07:16 -0400)
Currently we don't have a mechanism to set the btime, but we will need
that eventually. If we want to allow the client to cache that change, we
need to be able to pass it back and forth between client and server.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
src/client/Client.cc
src/client/Inode.h
src/mds/Locker.cc
src/messages/MClientCaps.h

index 6234ea4b26b74332c40a0d6617e6672285d8790a..e0726aa7339d051114c5ed01ceedfad2225a8691 100644 (file)
@@ -3235,6 +3235,7 @@ void Client::send_cap(Inode *in, MetaSession *session, Cap *cap,
   m->mtime = in->mtime;
   m->atime = in->atime;
   m->ctime = in->ctime;
+  m->btime = in->btime;
   m->time_warp_seq = in->time_warp_seq;
     
   if (flush & CEPH_CAP_FILE_WR) {
@@ -3421,6 +3422,7 @@ void Client::queue_cap_snap(Inode *in, SnapContext& old_snapc)
     capsnap->uid = in->uid;
     capsnap->gid = in->gid;
     capsnap->mode = in->mode;
+    capsnap->btime = in->btime;
     capsnap->xattrs = in->xattrs;
     capsnap->xattr_version = in->xattr_version;
  
@@ -3519,6 +3521,7 @@ void Client::flush_snaps(Inode *in, bool all_again)
     m->head.uid = capsnap->uid;
     m->head.gid = capsnap->gid;
     m->head.mode = capsnap->mode;
+    m->btime = capsnap->btime;
 
     m->size = capsnap->size;
 
@@ -3526,6 +3529,7 @@ void Client::flush_snaps(Inode *in, bool all_again)
     ::encode(capsnap->xattrs, m->xattrbl);
 
     m->ctime = capsnap->ctime;
+    m->btime = capsnap->btime;
     m->mtime = capsnap->mtime;
     m->atime = capsnap->atime;
     m->time_warp_seq = capsnap->time_warp_seq;
@@ -4869,6 +4873,7 @@ void Client::handle_cap_grant(MetaSession *session, Inode *in, Cap *cap, MClient
     in->mode = m->head.mode;
     in->uid = m->head.uid;
     in->gid = m->head.gid;
+    in->btime = m->btime;
   }
   bool deleted_inode = false;
   if ((issued & CEPH_CAP_LINK_EXCL) == 0) {
index d17475504aed25e6e91075d83dc68ef4a514a8e4..28fc439a429f8cb61b6f7ae6423a6342b92b5cad 100644 (file)
@@ -51,7 +51,7 @@ struct CapSnap {
   int issued, dirty;
 
   uint64_t size;
-  utime_t ctime, mtime, atime;
+  utime_t ctime, btime, mtime, atime;
   version_t time_warp_seq;
   uint32_t   mode;
   uid_t      uid;
index 966a5f2c12fabba30a90e4f433409f10037f075d..3ca5efae1f073938a7840b5fd43c263a86930f7b 100644 (file)
@@ -3039,6 +3039,12 @@ void Locker::_update_cap_fields(CInode *in, int dirty, MClientCaps *m, inode_t *
              << " for " << *in << dendl;
       pi->mode = m->head.mode;
     }
+    if (m->get_btime() != pi->btime) {
+      dout(7) << "  btime " << oct << pi->btime
+             << " -> " << m->get_btime() << dec
+             << " for " << *in << dendl;
+      pi->btime = m->get_btime();
+    }
   }
 
 }
index 2fabbc7dea4773776221dc0f63eb24e7a9b708e2..a210e44284ff0f8ffdb9896b506f9b65da93a355 100644 (file)
@@ -20,7 +20,7 @@
 
 
 class MClientCaps : public Message {
-  static const int HEAD_VERSION = 8;
+  static const int HEAD_VERSION = 9;
   static const int COMPAT_VERSION = 1;
 
  public:
@@ -28,7 +28,7 @@ class MClientCaps : public Message {
 
   uint64_t size, max_size, truncate_size;
   uint32_t truncate_seq;
-  utime_t mtime, atime, ctime;
+  utime_t mtime, atime, ctime, btime;
   file_layout_t layout;
   uint32_t time_warp_seq;
 
@@ -62,6 +62,7 @@ class MClientCaps : public Message {
   __u32 get_truncate_seq() { return truncate_seq; }
   uint64_t get_truncate_size() { return truncate_size; }
   utime_t get_ctime() { return ctime; }
+  utime_t get_btime() { return btime; }
   utime_t get_mtime() { return mtime; }
   utime_t get_atime() { return atime; }
   __u32 get_time_warp_seq() { return time_warp_seq; }
@@ -255,6 +256,9 @@ public:
     if (header.version >= 8) {
       ::decode(layout.pool_ns, p);
     }
+    if (header.version >= 9) {
+      ::decode(btime, p);
+    }
   }
   void encode_payload(uint64_t features) {
     header.version = HEAD_VERSION;
@@ -311,6 +315,7 @@ public:
     ::encode(caller_gid, payload);
 
     ::encode(layout.pool_ns, payload);
+    ::encode(btime, payload);
   }
 };