Re: CephFS snapshot creation time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 20 Mar 2019, David Disseldorp wrote:

> On Wed, 20 Mar 2019 04:15:04 +0000 (UTC), Sage Weil wrote:
> 
> > > I've added a virtual ceph.snap.timestamp=$secs.$nsecs xattr to the
> > > CInode::encode_inodestat() code path on the MDS:
> > > https://github.com/ddiss/ceph/commit/6825ba361d32a295d96fdf387965f04198b95ad1
> > > 
> > > I've also added corresponding Samba functionality to fetch this during
> > > .snaps readdir(). Please let me know whether you think this is the right
> > > spot for this, or whether the vxattr should be processed on the client
> > > side and translated into a different (new) MDS request which explicitly
> > > grabs SnapInfo.stamp.  
> > 
> > I think the vxattrs should definitely be processed/handled on the client 
> > side.
> > 
> > As far as how the metadata gets there, I'd try to include it in an 
> > existing nsap structure (SnapInfo?) so that there is no need for any 
> > additional request, which will add complexity.
> 
> Okay I'll go down that route. At this stage I'm pretty lost as to how I
> can add the snap timestamp to an existing wire struct without revving
> the protocol version or adding a new operation. Any tips would be
> greatly appreciated.

Something like this should get you started?  Note that the kernel client 
support will be quite a bit of work because it is still using the original 
encoding style.  The below will pretty easily get the metadata to 
libcephfs, though, which is I'm guessing what you're using?

sage



diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc
index 178533abf9..b3f5981da3 100644
--- a/src/mds/CInode.cc
+++ b/src/mds/CInode.cc
@@ -3588,7 +3588,7 @@ int CInode::encode_inodestat(bufferlist& bl, Session *session,
    * note: encoding matches MClientReply::InodeStat
    */
   if (session->info.has_feature(CEPHFS_FEATURE_REPLY_ENCODING)) {
-    ENCODE_START(2, 1, bl);
+    ENCODE_START(3, 1, bl);
     encode(oi->ino, bl);
     encode(snapid, bl);
     encode(oi->rdev, bl);
@@ -3630,6 +3630,7 @@ int CInode::encode_inodestat(bufferlist& bl, Session *session,
     encode(any_i->btime, bl);
     encode(any_i->change_attr, bl);
     encode(file_i->export_pin, bl);
+    // ..encode snap create time here..
     ENCODE_FINISH(bl);
   }
   else {
diff --git a/src/messages/MClientReply.h b/src/messages/MClientReply.h
index 4b10128154..6db2a9b74f 100644
--- a/src/messages/MClientReply.h
+++ b/src/messages/MClientReply.h
@@ -190,6 +190,9 @@ struct InodeStat {
       } else {
         dir_pin = -ENODATA;
       }
+      if (struct_v >= 3) {
+       // decode here
+      }
       DECODE_FINISH(p);
     }
     else {



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux