From: John Spray Date: Mon, 29 Jun 2015 00:01:58 +0000 (+0100) Subject: mds: remove global Filer instance X-Git-Tag: v9.0.3~44^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c5ec0e1cd8b4727f3ce1de9aa79a82c3e1c0e68b;p=ceph.git mds: remove global Filer instance Filer is cheap and stateless, no need to share one instance across the whole process. Let subsystems create their own -- one less thing in the effectively global MDS:: namespace. Signed-off-by: John Spray --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 758c04cc0742..f2f1e0d6eb7f 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -168,6 +168,7 @@ public: MDCache::MDCache(MDS *m) : logger(0), + filer(m->objecter, &m->finisher), recovery_queue(m), stray_manager(m) { @@ -6086,10 +6087,10 @@ void MDCache::_truncate_inode(CInode *in, LogSegment *ls) assert(in->last == CEPH_NOSNAP); } dout(10) << "_truncate_inode snapc " << snapc << " on " << *in << dendl; - mds->filer->truncate(in->inode.ino, &in->inode.layout, *snapc, - pi->truncate_size, pi->truncate_from-pi->truncate_size, - pi->truncate_seq, utime_t(), 0, - 0, new C_OnFinisher(new C_IO_MDC_TruncateFinish(this, in, + filer.truncate(in->inode.ino, &in->inode.layout, *snapc, + pi->truncate_size, pi->truncate_from-pi->truncate_size, + pi->truncate_seq, utime_t(), 0, + 0, new C_OnFinisher(new C_IO_MDC_TruncateFinish(this, in, ls), &mds->finisher)); } diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index 086e1abad1a4..48c0d412cd18 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -21,6 +21,7 @@ #include "include/filepath.h" #include "include/elist.h" +#include "osdc/Filer.h" #include "CInode.h" #include "CDentry.h" #include "CDir.h" @@ -139,6 +140,8 @@ class MDCache { PerfCounters *logger; + Filer filer; + public: void advance_stray() { stray_index = (stray_index+1)%NUM_STRAY; diff --git a/src/mds/MDS.cc b/src/mds/MDS.cc index a97cf90d35d0..538f36c3eca5 100644 --- a/src/mds/MDS.cc +++ b/src/mds/MDS.cc @@ -132,8 +132,6 @@ MDS::MDS(const std::string &n, Messenger *m, MonClient *mc) : objecter = new Objecter(m->cct, messenger, monc, NULL, 0, 0); objecter->unset_honor_osdmap_full(); - filer = new Filer(objecter, &finisher); - mdcache = new MDCache(this); mdlog = new MDLog(this); balancer = new MDBalancer(this); @@ -182,7 +180,6 @@ MDS::~MDS() { if (server) { delete server; server = 0; } if (locker) { delete locker; locker = 0; } - if (filer) { delete filer; filer = 0; } if (objecter) { delete objecter; objecter = 0; } if (logger) { diff --git a/src/mds/MDS.h b/src/mds/MDS.h index 8fecfb745030..aa35f62f861d 100644 --- a/src/mds/MDS.h +++ b/src/mds/MDS.h @@ -174,7 +174,6 @@ class MDS : public Dispatcher, public md_config_obs_t { MonClient *monc; MDSMap *mdsmap; Objecter *objecter; - Filer *filer; // for reading/writing to/from osds LogClient log_client; LogChannelRef clog; diff --git a/src/mds/RecoveryQueue.cc b/src/mds/RecoveryQueue.cc index d23acc1cbdd4..11938a15e94b 100644 --- a/src/mds/RecoveryQueue.cc +++ b/src/mds/RecoveryQueue.cc @@ -47,6 +47,11 @@ public: }; +RecoveryQueue::RecoveryQueue(MDS *mds_) + : mds(mds_), logger(NULL), filer(mds_->objecter, &mds_->finisher) +{} + + /** * Progress the queue. Call this after enqueuing something or on * completion of something. @@ -93,7 +98,7 @@ void RecoveryQueue::_start(CInode *in) file_recovering.insert(in); C_MDC_Recover *fin = new C_MDC_Recover(this, in); - mds->filer->probe(in->inode.ino, &in->inode.layout, in->last, + filer.probe(in->inode.ino, &in->inode.layout, in->last, pi->get_max_size(), &fin->size, &fin->mtime, false, 0, fin); } else { diff --git a/src/mds/RecoveryQueue.h b/src/mds/RecoveryQueue.h index 3fe04eed5909..9b7a0e6ddbb4 100644 --- a/src/mds/RecoveryQueue.h +++ b/src/mds/RecoveryQueue.h @@ -19,6 +19,8 @@ #include +#include "osdc/Filer.h" + class CInode; class MDS; class PerfCounters; @@ -28,7 +30,7 @@ public: void enqueue(CInode *in); void advance(); void prioritize(CInode *in); ///< do this inode now/soon - RecoveryQueue(MDS *mds_) : mds(mds_), logger(NULL) {} + RecoveryQueue(MDS *mds_); void set_logger(PerfCounters *p) {logger=p;} @@ -41,6 +43,7 @@ private: void _recovered(CInode *in, int r, uint64_t size, utime_t mtime); MDS *mds; PerfCounters *logger; + Filer filer; friend class C_MDC_Recover; }; diff --git a/src/mds/StrayManager.cc b/src/mds/StrayManager.cc index 71b776a69c54..4f1155c55f15 100644 --- a/src/mds/StrayManager.cc +++ b/src/mds/StrayManager.cc @@ -139,7 +139,7 @@ void StrayManager::purge(CDentry *dn, uint32_t op_allowance) uint64_t num = (to + period - 1) / period; dout(10) << __func__ << " 0~" << to << " objects 0~" << num << " snapc " << snapc << " on " << *in << dendl; - mds->filer->purge_range(in->inode.ino, &in->inode.layout, *snapc, + filer.purge_range(in->inode.ino, &in->inode.layout, *snapc, 0, num, ceph_clock_now(g_ceph_context), 0, gather.new_sub()); } @@ -747,11 +747,12 @@ void StrayManager::migrate_stray(CDentry *dn, mds_rank_t to) mds->send_message_mds(req, to); } - StrayManager::StrayManager(MDS *mds) +StrayManager::StrayManager(MDS *mds) : delayed_eval_stray(member_offset(CDentry, item_stray)), mds(mds), logger(NULL), ops_in_flight(0), files_purging(0), - num_strays(0), num_strays_purging(0), num_strays_delayed(0) + num_strays(0), num_strays_purging(0), num_strays_delayed(0), + filer(mds->objecter, &mds->finisher) { assert(mds != NULL); update_op_limit(); @@ -812,14 +813,14 @@ void StrayManager::truncate(CDentry *dn, uint32_t op_allowance) uint64_t num = (to - 1) / period; dout(10) << __func__ << " 0~" << to << " objects 0~" << num << " snapc " << snapc << " on " << *in << dendl; - mds->filer->purge_range(in->ino(), &in->inode.layout, *snapc, + filer.purge_range(in->ino(), &in->inode.layout, *snapc, 1, num, ceph_clock_now(g_ceph_context), 0, gather.new_sub()); } // keep backtrace object if (period && to > 0) { - mds->filer->zero(in->ino(), &in->inode.layout, *snapc, + filer.zero(in->ino(), &in->inode.layout, *snapc, 0, period, ceph_clock_now(g_ceph_context), 0, true, NULL, gather.new_sub()); } diff --git a/src/mds/StrayManager.h b/src/mds/StrayManager.h index d508017e45ff..312e18f91ab1 100644 --- a/src/mds/StrayManager.h +++ b/src/mds/StrayManager.h @@ -16,6 +16,7 @@ #include "include/elist.h" #include +#include "osdc/Filer.h" class MDS; class PerfCounters; @@ -56,6 +57,8 @@ class StrayManager : public md_config_obs_t uint64_t num_strays_purging; uint64_t num_strays_delayed; + Filer filer; + void truncate(CDentry *dn, uint32_t op_allowance); /**