From: Sage Weil Date: Tue, 24 Aug 2010 19:17:57 +0000 (-0700) Subject: Merge branch 'rootsnap' into unstable X-Git-Tag: v0.22~229 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bc8ee67cc77ab687e735c936ccc229585845effb;p=ceph.git Merge branch 'rootsnap' into unstable Conflicts: src/mds/Server.cc --- bc8ee67cc77ab687e735c936ccc229585845effb diff --cc src/mds/Server.cc index 2c92e492c3a1,0d44b2ea63ca..21b68bdd8536 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@@ -4166,20 -4143,26 +4155,20 @@@ void Server::_unlink_local_finish(MDReq -/** _dir_is_not_empty - * - * check if a directory is non-empty (i.e. we can rmdir it), and make - * sure it is part of the same subtree (i.e. local) so that rmdir will - * occur locally. +/** _dir_is_nonempty[_unlocked] * - * this is a fastpath check. we can't really be sure until we rdlock - * the filelock. + * check if a directory is non-empty (i.e. we can rmdir it). * - * @param in is the inode being rmdir'd. return true if it is - * definitely not empty. + * the unlocked varient this is a fastpath check. we can't really be + * sure until we rdlock the filelock. */ -bool Server::_dir_is_nonempty(MDRequest *mdr, CInode *in) +bool Server::_dir_is_nonempty_unlocked(MDRequest *mdr, CInode *in) { - dout(10) << "dir_is_nonempty " << *in << dendl; + dout(10) << "dir_is_nonempty_unlocked " << *in << dendl; assert(in->is_auth()); - if (in->snaprealm && in->snaprealm->snaps.size()) - + if (in->snaprealm && in->snaprealm->srnode.snaps.size()) - return true; //in a snapshot! + return true; // in a snapshot! list frags; in->dirfragtree.get_leaves(frags); @@@ -4190,33 -4173,19 +4179,33 @@@ CDir *dir = in->get_or_open_dirfrag(mdcache, *p); assert(dir); - // does the frag _look_ empty? - if (dir->inode->get_projected_inode()->dirstat.size() > 0) { - dout(10) << "dir_is_nonempty projected dir size still " - << dir->inode->get_projected_inode()->dirstat.size() - << " on " << *dir->inode - << dendl; - return true; + // is the frag obviously non-empty? + if (dir->is_auth()) { + if (dir->get_projected_fnode()->fragstat.size()) { + dout(10) << "dir_is_nonempty_unlocked dirstat has " + << dir->get_projected_fnode()->fragstat.size() << " items " << *dir << dendl; + return true; + } } + } - // not dir auth? - if (!dir->is_auth()) { - dout(10) << "dir_is_nonempty non-auth dirfrag for " << *dir << dendl; - } + return false; +} + +bool Server::_dir_is_nonempty(MDRequest *mdr, CInode *in) +{ + dout(10) << "dir_is_nonempty " << *in << dendl; + assert(in->is_auth()); + - if (in->snaprealm && in->snaprealm->snaps.size()) ++ if (in->snaprealm && in->snaprealm->srnode.snaps.size()) + return true; // in a snapshot! + + if (in->get_projected_inode()->dirstat.size() > 0) { + dout(10) << "dir_is_nonempty projected dir size still " + << in->get_projected_inode()->dirstat.size() + << " on " << *in + << dendl; + return true; } return false;