From: Sage Weil Date: Sat, 24 May 2008 20:18:50 +0000 (-0700) Subject: mds: cleaned up link/unlink accounting a bit X-Git-Tag: v0.3~170^2~75 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=db7c137e1af1ba2442f985c3b52b09c25148ce33;p=ceph.git mds: cleaned up link/unlink accounting a bit --- diff --git a/src/include/types.h b/src/include/types.h index 131e0642728..807e8fefd0e 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -205,10 +205,6 @@ struct nested_info_t { __u64 rfiles; __u64 rsubdirs; - void zero() { - rbytes = rfiles = rsubdirs = 0; - } - void encode(bufferlist &bl) const { ::encode(rbytes, bl); ::encode(rfiles, bl); diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index b20590230ff..6f9f3d81ab6 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -1278,9 +1278,19 @@ void Locker::predirty_nested(Mutation *mut, EMetaBlob *blob, } } if (primary_dn) { - drbytes = curi->nested.rbytes - curi->accounted_nested.rbytes; - drfiles = curi->nested.rfiles - curi->accounted_nested.rfiles; - drsubdirs = curi->nested.rsubdirs - curi->accounted_nested.rsubdirs; + if (linkunlink == 0) { + drbytes = curi->nested.rbytes - curi->accounted_nested.rbytes; + drfiles = curi->nested.rfiles - curi->accounted_nested.rfiles; + drsubdirs = curi->nested.rsubdirs - curi->accounted_nested.rsubdirs; + } else if (linkunlink < 0) { + drbytes = 0 - curi->accounted_nested.rbytes; + drfiles = 0 - curi->accounted_nested.rfiles; + drsubdirs = 0 - curi->accounted_nested.rsubdirs; + } else { + drbytes = curi->nested.rbytes; + drfiles = curi->nested.rfiles; + drsubdirs = curi->nested.rsubdirs; + } rctime = MAX(curi->ctime, curi->nested.rctime); dout(10) << "predirty_nested delta " @@ -1291,10 +1301,7 @@ void Locker::predirty_nested(Mutation *mut, EMetaBlob *blob, pf->nested.rsubdirs += drsubdirs; pf->nested.rctime = rctime; - curi->accounted_nested.rbytes += drbytes; - curi->accounted_nested.rfiles += drfiles; - curi->accounted_nested.rsubdirs += drsubdirs; - curi->accounted_nested.rctime = rctime; + curi->accounted_nested = curi->nested; } else { dout(10) << "predirty_nested no delta (remote dentry) in " << *parent << dendl; assert(!in->is_dir()); @@ -1340,6 +1347,7 @@ void Locker::predirty_nested(Mutation *mut, EMetaBlob *blob, cur = pin; curi = pi; parent = cur->get_projected_parent_dn()->get_dir(); + linkunlink = 0; primary_dn = true; do_parent = false; } diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 38f732a9840..ae274b69b9c 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -2758,7 +2758,6 @@ void Server::_unlink_local(MDRequest *mdr, CDentry *dn, CDentry *straydn) pi->nlink--; pi->ctime = mdr->now; pi->version = ipv; - pi->nested.zero(); *ji = *pi; // copy into journal // the unlinked dentry