From: Greg Farnum Date: Fri, 1 Aug 2014 13:07:48 +0000 (-0700) Subject: MDCache: remove #if 0'd code X-Git-Tag: v0.89~50^2~23 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=05d2444d73c196b4e540a173a6eee4972c69f439;p=ceph.git MDCache: remove #if 0'd code Signed-off-by: Greg Farnum --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index ea5bb3616018..87193d6362e3 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -4218,127 +4218,6 @@ public: } }; -#if 0 -/** - * parallel_fetch -- make a pass at fetching a bunch of paths in parallel - * - * @param pathmap map of inodeno to full pathnames. we remove items - * from this map as we discover we have them. - * - * returns true if there is work to do, false otherwise. - */ - -bool MDCache::parallel_fetch(map& pathmap, set& missing) -{ - dout(10) << "parallel_fetch on " << pathmap.size() << " paths" << dendl; - - C_GatherBuilder gather_bld(g_ceph_context, new C_MDC_RejoinGatherFinish(this)); - - // scan list - set fetch_queue; - map::iterator p = pathmap.begin(); - while (p != pathmap.end()) { - // do we have the target already? - CInode *cur = get_inode(p->first); - if (cur) { - dout(15) << " have " << *cur << dendl; - pathmap.erase(p++); - continue; - } - - // traverse - dout(17) << " missing " << p->first << " at " << p->second << dendl; - if (parallel_fetch_traverse_dir(p->first, p->second, fetch_queue, - missing, gather_bld)) - pathmap.erase(p++); - else - ++p; - } - - if (pathmap.empty() && (!gather_bld.has_subs())) { - dout(10) << "parallel_fetch done" << dendl; - assert(fetch_queue.empty()); - return false; - } - - // do a parallel fetch - for (set::iterator p = fetch_queue.begin(); - p != fetch_queue.end(); - ++p) { - dout(10) << "parallel_fetch fetching " << **p << dendl; - (*p)->fetch(gather_bld.new_sub()); - } - - if (gather_bld.get()) { - gather_bld.activate(); - return true; - } - return false; -} - -// true if we're done with this path -bool MDCache::parallel_fetch_traverse_dir(inodeno_t ino, filepath& path, - set& fetch_queue, set& missing, - C_GatherBuilder &gather_bld) -{ - CInode *cur = get_inode(path.get_ino()); - if (!cur) { - dout(5) << " missing " << path << " base ino " << path.get_ino() << dendl; - missing.insert(ino); - return true; - } - - for (unsigned i=0; iis_dir()) { - dout(5) << " bad path " << path << " ENOTDIR at " << path[i] << dendl; - missing.insert(ino); - return true; - } - - frag_t fg = cur->pick_dirfrag(path[i]); - CDir *dir = cur->get_or_open_dirfrag(this, fg); - CDentry *dn = dir->lookup(path[i]); - CDentry::linkage_t *dnl = dn ? dn->get_linkage() : NULL; - - if (!dnl || dnl->is_null()) { - if (!dir->is_auth()) { - dout(10) << " not dirfrag auth " << *dir << dendl; - return true; - } - if (dnl || dir->is_complete()) { - // probably because the client created it and held a cap but it never committed - // to the journal, and the op hasn't replayed yet. - dout(5) << " dne (not created yet?) " << ino << " at " << path << dendl; - missing.insert(ino); - return true; - } - // fetch dir - fetch_queue.insert(dir); - return false; - } - - cur = dnl->get_inode(); - if (!cur) { - assert(dnl->is_remote()); - cur = get_inode(dnl->get_remote_ino()); - if (cur) { - dn->link_remote(dnl, cur); - } else { - // open remote ino - open_remote_ino(dnl->get_remote_ino(), gather_bld.new_sub()); - return false; - } - } - } - - dout(5) << " ino not found " << ino << " at " << path << dendl; - missing.insert(ino); - return true; -} -#endif - /* * rejoin_scour_survivor_replica - remove source from replica list on unmentioned objects * @@ -5465,32 +5344,6 @@ void MDCache::do_delayed_cap_imports() dout(10) << "do_delayed_cap_imports" << dendl; assert(delayed_imported_caps.empty()); -#if 0 - map > d; - d.swap(delayed_imported_caps); - - for (map >::iterator p = d.begin(); - p != d.end(); - ++p) { - for (set::iterator q = p->second.begin(); - q != p->second.end(); - ++q) { - CInode *in = *q; - Session *session = mds->sessionmap.get_session(entity_name_t::CLIENT(p->first.v)); - if (session) { - Capability *cap = in->get_client_cap(p->first); - if (cap) { - do_cap_import(session, in, cap); // note: this may fail and requeue! - cap->dec_suppress(); - } - } - in->auth_unpin(this); - - if (in->is_head()) - mds->locker->issue_caps(in); - } - } -#endif } struct C_MDC_OpenSnapParents : public MDCacheContext { @@ -7543,17 +7396,6 @@ int MDCache::path_traverse(MDRequestRef& mdr, Message *req, MDSInternalContextBa } */ - // must read directory hard data (permissions, x bit) to traverse -#if 0 - if (!noperm && - !mds->locker->rdlock_try(&cur->authlock, client, 0)) { - dout(7) << "traverse: waiting on authlock rdlock on " << *cur << dendl; - cur->authlock.add_waiter(SimpleLock::WAIT_RD, _get_waiter(mdr, req, fin)); - return 1; - } -#endif - - // make sure snaprealm parents are open... if (cur->snaprealm && !cur->snaprealm->open && mdr && !cur->snaprealm->open_parents(_get_waiter(mdr, req, fin))) { @@ -7621,42 +7463,6 @@ int MDCache::path_traverse(MDRequestRef& mdr, Message *req, MDSInternalContextBa } } - // forwarder wants replicas? -#if 0 - if (mdr && mdr->client_request && - mdr->client_request->get_mds_wants_replica_in_dirino()) { - dout(30) << "traverse: REP is here, " - << mdr->client_request->get_mds_wants_replica_in_dirino() - << " vs " << curdir->dirfrag() << dendl; - - if (mdr->client_request->get_mds_wants_replica_in_dirino() == curdir->ino() && - curdir->is_auth() && - curdir->is_rep() && - curdir->is_replica(req->get_source().num()) && - dn->is_auth() - ) { - assert(req->get_source().is_mds()); - int from = req->get_source().num(); - - if (dn->is_replica(from)) { - dout(15) << "traverse: REP would replicate to mds." << from << ", but already cached_by " - << req->get_source() << " dn " << *dn << dendl; - } else { - dout(10) << "traverse: REP replicating to " << req->get_source() << " dn " << *dn << dendl; - MDiscoverReply *reply = new MDiscoverReply(curdir->dirfrag()); - reply->mark_unsolicited(); - reply->starts_with = MDiscoverReply::DENTRY; - replicate_dentry(dn, from, reply->trace); - if (dnl->is_primary()) - replicate_inode(in, from, reply->trace); - if (req->get_source() != req->get_orig_source()) - mds->send_message_mds(reply, req->get_source().num()); - else mds->send_message(reply->req->get_connnection()); - } - } - } -#endif - // add to trace, continue. cur = in; touch_inode(cur); @@ -7740,16 +7546,6 @@ int MDCache::path_traverse(MDRequestRef& mdr, Message *req, MDSInternalContextBa dout(7) << "traverse: forwarding, not auth for " << *curdir << dendl; -#if 0 - // request replication? - if (mdr && mdr->client_request && curdir->is_rep()) { - dout(15) << "traverse: REP fw to mds." << dauth << ", requesting rep under " - << *curdir << " req " << *(MClientRequest*)req << dendl; - mdr->client_request->set_mds_wants_replica_in_dirino(curdir->ino()); - req->clear_payload(); // reencode! - } -#endif - if (mdr) request_forward(mdr, dauth.first); else @@ -7772,41 +7568,6 @@ int MDCache::path_traverse(MDRequestRef& mdr, Message *req, MDSInternalContextBa return 0; } -#if 0 -/** - * Find out if the MDS is auth for a given path. - * - * Returns true if: - * 1) The full path DNE and we are auth for the deepest existing piece - * 2) We are auth for the inode linked to by the last dentry. - */ -bool MDCache::path_is_mine(filepath& path) -{ - dout(15) << "path_is_mine " << path.get_ino() << " " << path << dendl; - - CInode *cur = get_inode(path.get_ino()); - if (!cur) - return false; // who knows! - - for (unsigned i=0; ipick_dirfrag(path[i]); - CDir *dir = cur->get_dirfrag(fg); - if (!dir) - return cur->is_auth(); - CDentry *dn = dir->lookup(path[i]); - CDentry::linkage_t *dnl = dn->get_linkage(); - if (!dn || dnl->is_null()) - return dir->is_auth(); - if (!dnl->is_primary()) - return false; - cur = dnl->get_inode(); - } - - return cur->is_auth(); -} -#endif - CInode *MDCache::cache_traverse(const filepath& fp) { dout(10) << "cache_traverse " << fp << dendl;