From: Yan, Zheng Date: Thu, 25 Feb 2016 08:53:05 +0000 (+0800) Subject: mds: avoid creating unnecessary snap dentry/inode X-Git-Tag: v10.1.0~175^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a7f3a65825047310a098870404b693d183274336;p=ceph.git mds: avoid creating unnecessary snap dentry/inode 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 --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 0441f84e120..f4371c30887 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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;