]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: avoid creating unnecessary snap dentry/inode
authorYan, Zheng <zyan@redhat.com>
Thu, 25 Feb 2016 08:53:05 +0000 (16:53 +0800)
committerYan, Zheng <zyan@redhat.com>
Thu, 25 Feb 2016 09:18:07 +0000 (17:18 +0800)
When COW dentry/inode, if there is no snapshot between 'first' and
'follow', updating dentry/inode 's first should be enough, no need
to create unnecessary snap dentry/inode.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/MDCache.cc

index 0441f84e120f17b1c01fd24e0202be15762f8712..f4371c308879f11ec6c51d426d746ff07be62a8c 100644 (file)
@@ -1614,7 +1614,7 @@ void MDCache::journal_cow_dentry(MutationImpl *mut, EMetaBlob *metablob,
       if (dir_follows+1 > dn->first) {
        snapid_t oldfirst = dn->first;
        dn->first = dir_follows+1;
-       if (realm->has_snaps_in_range(oldfirst, dn->last)) {
+       if (realm->has_snaps_in_range(oldfirst, dir_follows)) {
          CDentry *olddn = dn->dir->add_remote_dentry(dn->name, in->ino(),  in->d_type(),
                                                      oldfirst, dir_follows);
          olddn->pre_dirty();
@@ -1645,7 +1645,7 @@ void MDCache::journal_cow_dentry(MutationImpl *mut, EMetaBlob *metablob,
       return;
     }
 
-    if (!realm->has_snaps_in_range(in->first, in->last)) {
+    if (!realm->has_snaps_in_range(in->first, follows)) {
       dout(10) << "journal_cow_dentry no snapshot follows " << follows << " on " << *in << dendl;
       in->first = follows + 1;
       return;
@@ -1670,7 +1670,7 @@ void MDCache::journal_cow_dentry(MutationImpl *mut, EMetaBlob *metablob,
 
     CInode *in = dnl->is_primary() ? dnl->get_inode() : NULL;
 
-    if (!realm->has_snaps_in_range(oldfirst, dn->last)) {
+    if (!realm->has_snaps_in_range(oldfirst, follows)) {
       dout(10) << "journal_cow_dentry no snapshot follows " << follows << " on " << *dn << dendl;
       if (in)
        in->first = follows+1;