explicit MDCacheLogContext(MDCache *mdc_) : mdcache(mdc_) {}
};
-MDCache::MDCache(MDSRank *m) :
+MDCache::MDCache(MDSRank *m, PurgeQueue &purge_queue_) :
mds(m),
filer(m->objecter, m->finisher),
exceeded_size_limit(false),
recovery_queue(m),
- stray_manager(m)
+ stray_manager(m, purge_queue_)
{
migrator.reset(new Migrator(mds, this));
root = NULL;
mydir->commit(0, gather->new_sub());
myin->store(gather->new_sub());
-
- stray_manager.purge_queue.create(new C_IO_Wrapper(mds, gather->new_sub()));
}
struct C_MDC_CreateSystemFile : public MDCacheLogContext {
CInode *in = create_system_inode(MDS_INO_MDSDIR(mds->get_nodeid()), S_IFDIR|0755); // initially inaccurate!
in->fetch(gather.new_sub());
- stray_manager.purge_queue.open(new C_IO_Wrapper(mds, gather.new_sub()));
-
gather.set_finisher(c);
gather.activate();
}
std::unique_ptr<Migrator> migrator;
public:
- explicit MDCache(MDSRank *m);
+ explicit MDCache(MDSRank *m, PurgeQueue &purge_queue_);
~MDCache();
// debug
last_state(MDSMap::STATE_BOOT),
state(MDSMap::STATE_BOOT),
stopping(false),
+ purge_queue(g_ceph_context, whoami_,
+ mdsmap_->get_metadata_pool(), objecter),
progress_thread(this), dispatch_depth(0),
hb(NULL), last_tid(0), osd_epoch_barrier(0), beacon(beacon_),
mds_slow_req_count(0),
finisher = new Finisher(msgr->cct);
- mdcache = new MDCache(this);
+ mdcache = new MDCache(this, purge_queue);
mdlog = new MDLog(this);
balancer = new MDBalancer(this, messenger, monc);
progress_thread.create("mds_rank_progr");
- mdcache->stray_manager.purge_queue.init();
+ purge_queue.init();
finisher->start();
}
// shut down cache
mdcache->shutdown();
- mdcache->stray_manager.purge_queue.shutdown();
+ purge_queue.shutdown();
if (objecter->initialized.read())
objecter->shutdown();
mdcache->open_mydir_inode(gather.new_sub());
+ purge_queue.open(new C_IO_Wrapper(this, gather.new_sub()));
+
if (is_starting() ||
whoami == mdsmap->get_root()) { // load root inode off disk if we are auth
mdcache->open_root_inode(gather.new_sub());
// write empty sessionmap
sessionmap.save(fin.new_sub());
+ // Create empty purge queue
+ purge_queue.create(new C_IO_Wrapper(this, fin.new_sub()));
+
// initialize tables
if (mdsmap->get_tableserver() == whoami) {
dout(10) << "boot_create creating fresh snaptable" << dendl;
#include "MDCache.h"
#include "Migrator.h"
#include "MDLog.h"
+#include "PurgeQueue.h"
#include "osdc/Journaler.h"
// Full .h import instead of forward declaration for PerfCounter, for the
ScrubStack *scrubstack;
DamageTable damage_table;
+
InoTable *inotable;
SnapServer *snapserver;
// after taking mds_lock must drop out.
bool stopping;
+ // PurgeQueue is only used by StrayManager, but it is owned by MDSRank
+ // because its init/shutdown happens at the top level.
+ PurgeQueue purge_queue;
+
class ProgressThread : public Thread {
MDSRank *mds;
Cond cond;
mds->send_message_mds(req, to);
}
-StrayManager::StrayManager(MDSRank *mds)
+StrayManager::StrayManager(MDSRank *mds, PurgeQueue &purge_queue_)
: delayed_eval_stray(member_offset(CDentry, item_stray)),
- mds(mds), logger(NULL), started(false), aborted(false),
+ mds(mds), purge_queue(purge_queue_), logger(NULL), started(false),
+ aborted(false),
ops_in_flight(0), files_purging(0),
max_purge_ops(0),
num_strays(0), num_strays_purging(0), num_strays_delayed(0),
- filer(mds->objecter, mds->finisher),
- purge_queue(g_ceph_context, mds->get_nodeid(),
- mds->mdsmap->get_metadata_pool(), mds->objecter)
+ filer(mds->objecter, mds->finisher)
{
assert(mds != NULL);
}
Filer filer;
- PurgeQueue purge_queue;
+ PurgeQueue &purge_queue;
void truncate(CDentry *dn, uint32_t op_allowance);
*/
void _truncate_stray_logged(CDentry *dn, LogSegment *ls);
- // FIXME: doing this to let MDCache call through into purgequeue
- // for initialization and teardown
- // >>
- friend class MDCache;
- friend class MDSRankDispatcher;
- // <<
-
friend class StrayManagerIOContext;
friend class StrayManagerLogContext;
friend class StrayManagerContext;
// My public interface is for consumption by MDCache
public:
- explicit StrayManager(MDSRank *mds);
+ explicit StrayManager(MDSRank *mds, PurgeQueue &purge_queue_);
void set_logger(PerfCounters *l) {logger = l;}
void activate();