This commit greatly simplifies things.
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
}
-void CDentry::add_waiter(uint64_t tag, MDSInternalContextBase *c)
+void CDentry::add_waiter(uint64_t tag, MDSContext *c)
{
// wait on the directory?
if (tag & (WAIT_UNFREEZE|WAIT_SINGLEAUTH)) {
// -- wait --
//static const int WAIT_LOCK_OFFSET = 8;
- void add_waiter(uint64_t tag, MDSInternalContextBase *c) override;
+ void add_waiter(uint64_t tag, MDSContext *c) override;
bool is_lt(const MDSCacheObject *r) const override {
return *this < *static_cast<const CDentry*>(r);
int CDir::num_frozen_trees = 0;
int CDir::num_freezing_trees = 0;
-class CDirContext : public MDSInternalContextBase
+class CDirContext : public MDSContext
{
protected:
CDir *dir;
dn->dir = this;
}
-void CDir::prepare_old_fragment(map<string_snap_t, MDSInternalContextBase::vec >& dentry_waiters, bool replay)
+void CDir::prepare_old_fragment(map<string_snap_t, MDSContext::vec >& dentry_waiters, bool replay)
{
// auth_pin old fragment for duration so that any auth_pinning
// during the dentry migration doesn't trigger side effects
inode->add_dirfrag(this);
}
-void CDir::finish_old_fragment(MDSInternalContextBase::vec& waiters, bool replay)
+void CDir::finish_old_fragment(MDSContext::vec& waiters, bool replay)
{
// take waiters _before_ unfreeze...
if (!replay) {
get(PIN_SUBTREE);
}
-void CDir::split(int bits, list<CDir*>& subs, MDSInternalContextBase::vec& waiters, bool replay)
+void CDir::split(int bits, list<CDir*>& subs, MDSContext::vec& waiters, bool replay)
{
dout(10) << "split by " << bits << " bits on " << *this << dendl;
fragstatdiff.add_delta(fnode.accounted_fragstat, fnode.fragstat);
dout(10) << " rstatdiff " << rstatdiff << " fragstatdiff " << fragstatdiff << dendl;
- map<string_snap_t, MDSInternalContextBase::vec > dentry_waiters;
+ map<string_snap_t, MDSContext::vec > dentry_waiters;
prepare_old_fragment(dentry_waiters, replay);
// create subfrag dirs
finish_old_fragment(waiters, replay);
}
-void CDir::merge(list<CDir*>& subs, MDSInternalContextBase::vec& waiters, bool replay)
+void CDir::merge(list<CDir*>& subs, MDSContext::vec& waiters, bool replay)
{
dout(10) << "merge " << subs << dendl;
version_t rstat_version = inode->get_projected_inode()->rstat.version;
version_t dirstat_version = inode->get_projected_inode()->dirstat.version;
- map<string_snap_t, MDSInternalContextBase::vec > dentry_waiters;
+ map<string_snap_t, MDSContext::vec > dentry_waiters;
for (auto dir : subs) {
dout(10) << " subfrag " << dir->get_frag() << " " << *dir << dendl;
* WAITING
*/
-void CDir::add_dentry_waiter(std::string_view dname, snapid_t snapid, MDSInternalContextBase *c)
+void CDir::add_dentry_waiter(std::string_view dname, snapid_t snapid, MDSContext *c)
{
if (waiting_on_dentry.empty())
get(PIN_DNWAITER);
}
void CDir::take_dentry_waiting(std::string_view dname, snapid_t first, snapid_t last,
- MDSInternalContextBase::vec& ls)
+ MDSContext::vec& ls)
{
if (waiting_on_dentry.empty())
return;
put(PIN_DNWAITER);
}
-void CDir::take_sub_waiting(MDSInternalContextBase::vec& ls)
+void CDir::take_sub_waiting(MDSContext::vec& ls)
{
dout(10) << __func__ << dendl;
if (!waiting_on_dentry.empty()) {
-void CDir::add_waiter(uint64_t tag, MDSInternalContextBase *c)
+void CDir::add_waiter(uint64_t tag, MDSContext *c)
{
// hierarchical?
/* NOTE: this checks dentry waiters too */
-void CDir::take_waiting(uint64_t mask, MDSInternalContextBase::vec& ls)
+void CDir::take_waiting(uint64_t mask, MDSContext::vec& ls)
{
if ((mask & WAIT_DENTRY) && !waiting_on_dentry.empty()) {
// take all dentry waiters
{
dout(11) << __func__ << " mask " << hex << mask << dec << " result " << result << " on " << *this << dendl;
- MDSInternalContextBase::vec finished;
+ MDSContext::vec finished;
take_waiting(mask, finished);
if (result < 0)
finish_contexts(g_ceph_context, finished, result);
ls->new_dirfrags.push_back(&item_new);
state_clear(STATE_CREATING);
- MDSInternalContextBase::vec waiters;
+ MDSContext::vec waiters;
take_waiting(CDir::WAIT_CREATED, waiters);
cache->mds->queue_waiters(waiters);
}
// -----------------------
// FETCH
-void CDir::fetch(MDSInternalContextBase *c, bool ignore_authpinnability)
+void CDir::fetch(MDSContext *c, bool ignore_authpinnability)
{
string want;
return fetch(c, want, ignore_authpinnability);
}
-void CDir::fetch(MDSInternalContextBase *c, std::string_view want_dn, bool ignore_authpinnability)
+void CDir::fetch(MDSContext *c, std::string_view want_dn, bool ignore_authpinnability)
{
dout(10) << "fetch on " << *this << dendl;
_omap_fetch(NULL, empty);
}
-void CDir::fetch(MDSInternalContextBase *c, const std::set<dentry_key_t>& keys)
+void CDir::fetch(MDSContext *c, const std::set<dentry_key_t>& keys)
{
dout(10) << "fetch " << keys.size() << " keys on " << *this << dendl;
}
class C_IO_Dir_OMAP_FetchedMore : public CDirIOContext {
- MDSInternalContextBase *fin;
+ MDSContext *fin;
public:
bufferlist hdrbl;
bool more = false;
map<string, bufferlist> omap; ///< carry-over from before
map<string, bufferlist> omap_more; ///< new batch
int ret;
- C_IO_Dir_OMAP_FetchedMore(CDir *d, MDSInternalContextBase *f) :
+ C_IO_Dir_OMAP_FetchedMore(CDir *d, MDSContext *f) :
CDirIOContext(d), fin(f), ret(0) { }
void finish(int r) {
// merge results
};
class C_IO_Dir_OMAP_Fetched : public CDirIOContext {
- MDSInternalContextBase *fin;
+ MDSContext *fin;
public:
bufferlist hdrbl;
bool more = false;
bufferlist btbl;
int ret1, ret2, ret3;
- C_IO_Dir_OMAP_Fetched(CDir *d, MDSInternalContextBase *f) :
+ C_IO_Dir_OMAP_Fetched(CDir *d, MDSContext *f) :
CDirIOContext(d), fin(f), ret1(0), ret2(0), ret3(0) { }
void finish(int r) override {
// check the correctness of backtrace
}
};
-void CDir::_omap_fetch(MDSInternalContextBase *c, const std::set<dentry_key_t>& keys)
+void CDir::_omap_fetch(MDSContext *c, const std::set<dentry_key_t>& keys)
{
C_IO_Dir_OMAP_Fetched *fin = new C_IO_Dir_OMAP_Fetched(this, c);
object_t oid = get_ondisk_object();
void CDir::_omap_fetch_more(
bufferlist& hdrbl,
map<string, bufferlist>& omap,
- MDSInternalContextBase *c)
+ MDSContext *c)
{
// we have more omap keys to fetch!
object_t oid = get_ondisk_object();
* @param want - min version i want committed
* @param c - callback for completion
*/
-void CDir::commit(version_t want, MDSInternalContextBase *c, bool ignore_authpinnability, int op_prio)
+void CDir::commit(version_t want, MDSContext *c, bool ignore_authpinnability, int op_prio)
{
dout(10) << "commit want " << want << " on " << *this << dendl;
if (want == 0) want = get_version();
_commit(it->first, -1);
break;
}
- MDSInternalContextBase::vec t;
+ MDSContext::vec t;
for (const auto &waiter : it->second)
t.push_back(waiter);
cache->mds->queue_waiters(t);
// newly single auth?
if (was_ambiguous && dir_auth.second == CDIR_AUTH_UNKNOWN) {
- MDSInternalContextBase::vec ls;
+ MDSContext::vec ls;
take_waiting(WAIT_SINGLEAUTH, ls);
cache->mds->queue_waiters(ls);
}
{
dout(10) << __func__ << " " << *this << dendl;
- MDSInternalContextBase::vec unfreeze_waiters;
+ MDSContext::vec unfreeze_waiters;
take_waiting(WAIT_UNFREEZE, unfreeze_waiters);
if (freeze_tree_state) {
ceph_assert(!freeze_tree_state->frozen);
ceph_assert(get_dir_auth_pins() > 0);
- MDSInternalContextBase::vec unfreeze_waiters;
+ MDSContext::vec unfreeze_waiters;
auto unfreeze = [this, &unfreeze_waiters](CDir *dir) {
if (dir->freeze_tree_state != freeze_tree_state)
}
int CDir::_next_dentry_on_set(dentry_key_set &dns, bool missing_okay,
- MDSInternalContext *cb, CDentry **dnout)
+ MDSContext *cb, CDentry **dnout)
{
dentry_key_t dnkey;
CDentry *dn;
return ENOENT;
}
-int CDir::scrub_dentry_next(MDSInternalContext *cb, CDentry **dnout)
+int CDir::scrub_dentry_next(MDSContext *cb, CDentry **dnout)
{
dout(20) << __func__ << dendl;
ceph_assert(scrub_infop && scrub_infop->directory_scrubbing);
* ENOENT: there are no remaining dentries to scrub
* <0: There was an unexpected error
*
- * @param cb An MDSInternalContext which will be activated only if
+ * @param cb An MDSContext which will be activated only if
* we return EAGAIN via rcode, or else ignored
* @param dnout CDentry * which you should next scrub, or NULL
* @returns a value as described above
*/
- int scrub_dentry_next(MDSInternalContext *cb, CDentry **dnout);
+ int scrub_dentry_next(MDSContext *cb, CDentry **dnout);
/**
* Get the currently scrubbing dentries. When returned, the passed-in
* list will be filled with all CDentry * which have been returned
* next key to scrub and look it up (or fail!).
*/
int _next_dentry_on_set(dentry_key_set &dns, bool missing_okay,
- MDSInternalContext *cb, CDentry **dnout);
+ MDSContext *cb, CDentry **dnout);
protected:
public:
- void split(int bits, std::list<CDir*>& subs, MDSInternalContextBase::vec& waiters, bool replay);
- void merge(std::list<CDir*>& subs, MDSInternalContextBase::vec& waiters, bool replay);
+ void split(int bits, std::list<CDir*>& subs, MDSContext::vec& waiters, bool replay);
+ void merge(std::list<CDir*>& subs, MDSContext::vec& waiters, bool replay);
bool should_split() const {
return (int)get_frag_size() > g_conf()->mds_bal_split_size;
private:
void prepare_new_fragment(bool replay);
- void prepare_old_fragment(map<string_snap_t, MDSInternalContextBase::vec >& dentry_waiters, bool replay);
+ void prepare_old_fragment(map<string_snap_t, MDSContext::vec >& dentry_waiters, bool replay);
void steal_dentry(CDentry *dn); // from another dir. used by merge/split.
- void finish_old_fragment(MDSInternalContextBase::vec& waiters, bool replay);
+ void finish_old_fragment(MDSContext::vec& waiters, bool replay);
void init_fragment_pins();
object_t get_ondisk_object() {
return file_object_t(ino(), frag);
}
- void fetch(MDSInternalContextBase *c, bool ignore_authpinnability=false);
- void fetch(MDSInternalContextBase *c, std::string_view want_dn, bool ignore_authpinnability=false);
- void fetch(MDSInternalContextBase *c, const std::set<dentry_key_t>& keys);
+ void fetch(MDSContext *c, bool ignore_authpinnability=false);
+ void fetch(MDSContext *c, std::string_view want_dn, bool ignore_authpinnability=false);
+ void fetch(MDSContext *c, const std::set<dentry_key_t>& keys);
protected:
mempool::mds_co::compact_set<mempool::mds_co::string> wanted_items;
- void _omap_fetch(MDSInternalContextBase *fin, const std::set<dentry_key_t>& keys);
+ void _omap_fetch(MDSContext *fin, const std::set<dentry_key_t>& keys);
void _omap_fetch_more(
bufferlist& hdrbl, std::map<std::string, bufferlist>& omap,
- MDSInternalContextBase *fin);
+ MDSContext *fin);
CDentry *_load_dentry(
std::string_view key,
std::string_view dname,
bool complete, int r);
// -- commit --
- mempool::mds_co::compact_map<version_t, MDSInternalContextBase::vec_alloc<mempool::mds_co::pool_allocator> > waiting_for_commit;
+ mempool::mds_co::compact_map<version_t, MDSContext::vec_alloc<mempool::mds_co::pool_allocator> > waiting_for_commit;
void _commit(version_t want, int op_prio);
void _omap_commit(int op_prio);
void _encode_dentry(CDentry *dn, bufferlist& bl, const std::set<snapid_t> *snaps);
void wait_for_commit(Context *c, version_t v=0);
#endif
void commit_to(version_t want);
- void commit(version_t want, MDSInternalContextBase *c,
+ void commit(version_t want, MDSContext *c,
bool ignore_authpinnability=false, int op_prio=-1);
// -- dirtyness --
// -- waiters --
protected:
- mempool::mds_co::compact_map< string_snap_t, MDSInternalContextBase::vec_alloc<mempool::mds_co::pool_allocator> > waiting_on_dentry; // FIXME string_snap_t not in mempool
+ mempool::mds_co::compact_map< string_snap_t, MDSContext::vec_alloc<mempool::mds_co::pool_allocator> > waiting_on_dentry; // FIXME string_snap_t not in mempool
public:
bool is_waiting_for_dentry(std::string_view dname, snapid_t snap) {
return waiting_on_dentry.count(string_snap_t(dname, snap));
}
- void add_dentry_waiter(std::string_view dentry, snapid_t snap, MDSInternalContextBase *c);
- void take_dentry_waiting(std::string_view dentry, snapid_t first, snapid_t last, MDSInternalContextBase::vec& ls);
- void take_sub_waiting(MDSInternalContextBase::vec& ls); // dentry or ino
+ void add_dentry_waiter(std::string_view dentry, snapid_t snap, MDSContext *c);
+ void take_dentry_waiting(std::string_view dentry, snapid_t first, snapid_t last, MDSContext::vec& ls);
+ void take_sub_waiting(MDSContext::vec& ls); // dentry or ino
- void add_waiter(uint64_t mask, MDSInternalContextBase *c) override;
- void take_waiting(uint64_t mask, MDSInternalContextBase::vec& ls) override; // may include dentry waiters
+ void add_waiter(uint64_t mask, MDSContext *c) override;
+ void take_waiting(uint64_t mask, MDSContext::vec& ls) override; // may include dentry waiters
void finish_waiting(uint64_t mask, int result = 0); // ditto
return object_t(n);
}
-void CInode::store(MDSInternalContextBase *fin)
+void CInode::store(MDSContext *fin)
{
dout(10) << __func__ << " " << get_version() << dendl;
ceph_assert(is_base());
fin->complete(0);
}
-void CInode::flush(MDSInternalContextBase *fin)
+void CInode::flush(MDSContext *fin)
{
dout(10) << __func__ << " " << *this << dendl;
ceph_assert(is_auth() && can_auth_pin());
}
};
-void CInode::fetch(MDSInternalContextBase *fin)
+void CInode::fetch(MDSContext *fin)
{
dout(10) << __func__ << dendl;
}
};
-void CInode::store_backtrace(MDSInternalContextBase *fin, int op_prio)
+void CInode::store_backtrace(MDSContext *fin, int op_prio)
{
dout(10) << __func__ << " on " << *this << dendl;
ceph_assert(is_dirty_parent());
return false;
}
-void CInode::add_dir_waiter(frag_t fg, MDSInternalContextBase *c)
+void CInode::add_dir_waiter(frag_t fg, MDSContext *c)
{
if (waiting_on_dir.empty())
get(PIN_DIRWAITER);
dout(10) << __func__ << " frag " << fg << " " << c << " on " << *this << dendl;
}
-void CInode::take_dir_waiting(frag_t fg, MDSInternalContextBase::vec& ls)
+void CInode::take_dir_waiting(frag_t fg, MDSContext::vec& ls)
{
if (waiting_on_dir.empty())
return;
}
}
-void CInode::add_waiter(uint64_t tag, MDSInternalContextBase *c)
+void CInode::add_waiter(uint64_t tag, MDSContext *c)
{
dout(10) << __func__ << " tag " << std::hex << tag << std::dec << " " << c
<< " !ambig " << !state_test(STATE_AMBIGUOUSAUTH)
MDSCacheObject::add_waiter(tag, c);
}
-void CInode::take_waiting(uint64_t mask, MDSInternalContextBase::vec& ls)
+void CInode::take_waiting(uint64_t mask, MDSContext::vec& ls)
{
if ((mask & WAIT_DIR) && !waiting_on_dir.empty()) {
// take all dentry waiters
return true;
}
-void CInode::unfreeze_inode(MDSInternalContextBase::vec& finished)
+void CInode::unfreeze_inode(MDSContext::vec& finished)
{
dout(10) << __func__ << dendl;
if (state_test(STATE_FREEZING)) {
void CInode::unfreeze_inode()
{
- MDSInternalContextBase::vec finished;
+ MDSContext::vec finished;
unfreeze_inode(finished);
mdcache->mds->queue_waiters(finished);
}
ceph_assert(state_test(CInode::STATE_FROZENAUTHPIN));
state_clear(CInode::STATE_FROZENAUTHPIN);
if (!state_test(STATE_FREEZING|STATE_FROZEN)) {
- MDSInternalContextBase::vec finished;
+ MDSContext::vec finished;
take_waiting(WAIT_UNFREEZE, finished);
mdcache->mds->queue_waiters(finished);
}
}
-void CInode::clear_ambiguous_auth(MDSInternalContextBase::vec& finished)
+void CInode::clear_ambiguous_auth(MDSContext::vec& finished)
{
ceph_assert(state_test(CInode::STATE_AMBIGUOUSAUTH));
state_clear(CInode::STATE_AMBIGUOUSAUTH);
void CInode::clear_ambiguous_auth()
{
- MDSInternalContextBase::vec finished;
+ MDSContext::vec finished;
clear_ambiguous_auth(finished);
mdcache->mds->queue_waiters(finished);
}
bool fcntl_removed = fcntl_locks ? fcntl_locks->remove_all_from(client) : false;
bool flock_removed = flock_locks ? flock_locks->remove_all_from(client) : false;
if (fcntl_removed || flock_removed) {
- MDSInternalContextBase::vec waiters;
+ MDSContext::vec waiters;
take_waiting(CInode::WAIT_FLOCK, waiters);
mdcache->mds->queue_waiters(waiters);
}
policylock.mark_need_recover();
}
}
-void CInode::_decode_locks_rejoin(bufferlist::const_iterator& p, MDSInternalContextBase::vec& waiters,
+void CInode::_decode_locks_rejoin(bufferlist::const_iterator& p, MDSContext::vec& waiters,
list<SimpleLock*>& eval_locks, bool survivor)
{
authlock.decode_state_rejoin(p, waiters, survivor);
}
void CInode::validate_disk_state(CInode::validated_data *results,
- MDSInternalContext *fin)
+ MDSContext *fin)
{
class ValidationContinuation : public MDSContinuation {
public:
- MDSInternalContext *fin;
+ MDSContext *fin;
CInode *in;
CInode::validated_data *results;
bufferlist bl;
ValidationContinuation(CInode *i,
CInode::validated_data *data_r,
- MDSInternalContext *fin_) :
+ MDSContext *fin_) :
MDSContinuation(i->mdcache->mds->server),
fin(fin_),
in(i),
void CInode::scrub_initialize(CDentry *scrub_parent,
ScrubHeaderRef& header,
- MDSInternalContextBase *f)
+ MDSContext *f)
{
dout(20) << __func__ << " with scrub_version " << get_version() << dendl;
if (scrub_is_in_progress()) {
si.last_scrub_version = si.scrub_start_version;
}
-void CInode::scrub_aborted(MDSInternalContextBase **c) {
+void CInode::scrub_aborted(MDSContext **c) {
dout(20) << __func__ << dendl;
ceph_assert(scrub_is_in_progress());
scrub_infop = nullptr;
}
-void CInode::scrub_finished(MDSInternalContextBase **c) {
+void CInode::scrub_finished(MDSContext **c) {
dout(20) << __func__ << dendl;
ceph_assert(scrub_is_in_progress());
for (std::map<frag_t, scrub_stamp_info_t>::iterator i =
class scrub_info_t : public scrub_stamp_info_t {
public:
CDentry *scrub_parent = nullptr;
- MDSInternalContextBase *on_finish = nullptr;
+ MDSContext *on_finish = nullptr;
bool last_scrub_dirty = false; /// are our stamps dirty with respect to disk state?
bool scrub_in_progress = false; /// are we currently scrubbing?
*/
void scrub_initialize(CDentry *scrub_parent,
ScrubHeaderRef& header,
- MDSInternalContextBase *f);
+ MDSContext *f);
/**
* Get the next dirfrag to scrub. Gives you a frag_t in output param which
* you must convert to a CDir (and possibly load off disk).
* @param c An out param which is filled in with a Context* that must
* be complete()ed.
*/
- void scrub_finished(MDSInternalContextBase **c);
+ void scrub_finished(MDSContext **c);
- void scrub_aborted(MDSInternalContextBase **c);
+ void scrub_aborted(MDSContext **c);
/**
* Report to the CInode that alldirfrags it owns have been scrubbed.
void scrub_children_finished() {
scrub_infop->children_scrubbed = true;
}
- void scrub_set_finisher(MDSInternalContextBase *c) {
+ void scrub_set_finisher(MDSContext *c) {
ceph_assert(!scrub_infop->on_finish);
scrub_infop->on_finish = c;
}
void set_ambiguous_auth() {
state_set(STATE_AMBIGUOUSAUTH);
}
- void clear_ambiguous_auth(MDSInternalContextBase::vec& finished);
+ void clear_ambiguous_auth(MDSContext::vec& finished);
void clear_ambiguous_auth();
inodeno_t ino() const { return inode.ino; }
void mark_dirty(version_t projected_dirv, LogSegment *ls);
void mark_clean();
- void store(MDSInternalContextBase *fin);
+ void store(MDSContext *fin);
void _stored(int r, version_t cv, Context *fin);
/**
* Flush a CInode to disk. This includes the backtrace, the parent
* @pre can_auth_pin()
* @param fin The Context to call when the flush is completed.
*/
- void flush(MDSInternalContextBase *fin);
- void fetch(MDSInternalContextBase *fin);
+ void flush(MDSContext *fin);
+ void fetch(MDSContext *fin);
void _fetched(bufferlist& bl, bufferlist& bl2, Context *fin);
void build_backtrace(int64_t pool, inode_backtrace_t& bt);
- void store_backtrace(MDSInternalContextBase *fin, int op_prio=-1);
+ void store_backtrace(MDSContext *fin, int op_prio=-1);
void _stored_backtrace(int r, version_t v, Context *fin);
void fetch_backtrace(Context *fin, bufferlist *backtrace);
protected:
// -- waiting --
protected:
- mempool::mds_co::compact_map<frag_t, MDSInternalContextBase::vec > waiting_on_dir;
+ mempool::mds_co::compact_map<frag_t, MDSContext::vec > waiting_on_dir;
public:
- void add_dir_waiter(frag_t fg, MDSInternalContextBase *c);
- void take_dir_waiting(frag_t fg, MDSInternalContextBase::vec& ls);
+ void add_dir_waiter(frag_t fg, MDSContext *c);
+ void take_dir_waiting(frag_t fg, MDSContext::vec& ls);
bool is_waiting_for_dir(frag_t fg) {
return waiting_on_dir.count(fg);
}
- void add_waiter(uint64_t tag, MDSInternalContextBase *c) override;
- void take_waiting(uint64_t tag, MDSInternalContextBase::vec& ls) override;
+ void add_waiter(uint64_t tag, MDSContext *c) override;
+ void take_waiting(uint64_t tag, MDSContext::vec& ls) override;
// -- encode/decode helpers --
void _encode_base(bufferlist& bl, uint64_t features);
void _encode_locks_state_for_replica(bufferlist& bl, bool need_recover);
void _encode_locks_state_for_rejoin(bufferlist& bl, int rep);
void _decode_locks_state(bufferlist::const_iterator& p, bool is_new);
- void _decode_locks_rejoin(bufferlist::const_iterator& p, MDSInternalContextBase::vec& waiters,
+ void _decode_locks_rejoin(bufferlist::const_iterator& p, MDSContext::vec& waiters,
std::list<SimpleLock*>& eval_locks, bool survivor);
// -- import/export --
/* Freeze the inode. auth_pin_allowance lets the caller account for any
* auth_pins it is itself holding/responsible for. */
bool freeze_inode(int auth_pin_allowance=0);
- void unfreeze_inode(MDSInternalContextBase::vec& finished);
+ void unfreeze_inode(MDSContext::vec& finished);
void unfreeze_inode();
void freeze_auth_pin();
* @param fin Context to call back on completion (or NULL)
*/
void validate_disk_state(validated_data *results,
- MDSInternalContext *fin);
+ MDSContext *fin);
static void dump_validation_results(const validated_data& results,
Formatter *f);
private:
}
-class LockerContext : public MDSInternalContextBase {
+class LockerContext : public MDSContext {
protected:
Locker *locker;
MDSRank *get_mds() override
// generics
-void Locker::eval_gather(SimpleLock *lock, bool first, bool *pneed_issue, MDSInternalContextBase::vec *pfinishers)
+void Locker::eval_gather(SimpleLock *lock, bool first, bool *pneed_issue, MDSContext::vec *pfinishers)
{
dout(10) << "eval_gather " << *lock << " on " << *lock->get_parent() << dendl;
ceph_assert(!lock->is_stable());
bool Locker::eval(CInode *in, int mask, bool caps_imported)
{
bool need_issue = caps_imported;
- MDSInternalContextBase::vec finishers;
+ MDSContext::vec finishers;
dout(10) << "eval " << mask << " " << *in << dendl;
void Locker::eval_cap_gather(CInode *in, set<CInode*> *issue_set)
{
bool need_issue = false;
- MDSInternalContextBase::vec finishers;
+ MDSContext::vec finishers;
// kick locks now
if (!in->filelock.is_stable())
void Locker::eval_scatter_gathers(CInode *in)
{
bool need_issue = false;
- MDSInternalContextBase::vec finishers;
+ MDSContext::vec finishers;
dout(10) << "eval_scatter_gathers " << *in << dendl;
return false;
}
-bool Locker::rdlock_try(SimpleLock *lock, client_t client, MDSInternalContextBase *con)
+bool Locker::rdlock_try(SimpleLock *lock, client_t client, MDSContext *con)
{
dout(7) << "rdlock_try on " << *lock << " on " << *lock->get_parent() << dendl;
* we need to lock|scatter in order to push fnode changes into the
* inode.dirstat.
*/
-void Locker::scatter_nudge(ScatterLock *lock, MDSInternalContextBase *c, bool forcelockchange)
+void Locker::scatter_nudge(ScatterLock *lock, MDSContext *c, bool forcelockchange)
{
CInode *p = static_cast<CInode *>(lock->get_parent());
void drop_rdlocks_for_early_reply(MutationImpl *mut);
void drop_locks_for_fragment_unfreeze(MutationImpl *mut);
- void eval_gather(SimpleLock *lock, bool first=false, bool *need_issue=0, MDSInternalContextBase::vec *pfinishers=0);
+ void eval_gather(SimpleLock *lock, bool first=false, bool *need_issue=0, MDSContext::vec *pfinishers=0);
void eval(SimpleLock *lock, bool *need_issue);
- void eval_any(SimpleLock *lock, bool *need_issue, MDSInternalContextBase::vec *pfinishers=0, bool first=false) {
+ void eval_any(SimpleLock *lock, bool *need_issue, MDSContext::vec *pfinishers=0, bool first=false) {
if (!lock->is_stable())
eval_gather(lock, first, need_issue, pfinishers);
else if (lock->get_parent()->is_auth())
void try_eval(SimpleLock *lock, bool *pneed_issue);
bool _rdlock_kick(SimpleLock *lock, bool as_anon);
- bool rdlock_try(SimpleLock *lock, client_t client, MDSInternalContextBase *c);
+ bool rdlock_try(SimpleLock *lock, client_t client, MDSContext *c);
bool rdlock_start(SimpleLock *lock, MDRequestRef& mut, bool as_anon=false);
void rdlock_finish(const MutationImpl::lock_iterator& it, MutationImpl *mut, bool *pneed_issue);
bool can_rdlock_set(MutationImpl::LockOpVec& lov);
// simple
public:
void try_simple_eval(SimpleLock *lock);
- bool simple_rdlock_try(SimpleLock *lock, MDSInternalContextBase *con);
+ bool simple_rdlock_try(SimpleLock *lock, MDSContext *con);
protected:
void simple_eval(SimpleLock *lock, bool *need_issue);
void handle_simple_lock(SimpleLock *lock, const MLock::const_ref &m);
void scatter_eval(ScatterLock *lock, bool *need_issue); // public for MDCache::adjust_subtree_auth()
void scatter_tick();
- void scatter_nudge(ScatterLock *lock, MDSInternalContextBase *c, bool forcelockchange=false);
+ void scatter_nudge(ScatterLock *lock, MDSContext *c, bool forcelockchange=false);
protected:
void handle_scatter_lock(ScatterLock *lock, const MLock::const_ref &m);
// try to expire
void try_to_expire(MDSRank *mds, MDSGatherBuilder &gather_bld, int op_prio);
- MDSInternalContextBase::vec expiry_waiters;
+ MDSContext::vec expiry_waiters;
- void wait_for_expiry(MDSInternalContextBase *c)
+ void wait_for_expiry(MDSContext *c)
{
ceph_assert(c != NULL);
expiry_waiters.push_back(c);
* All non-I/O contexts that require a reference
* to an MDCache instance descend from this.
*/
-class MDCacheContext : public virtual MDSInternalContextBase {
+class MDCacheContext : public virtual MDSContext {
protected:
MDCache *mdcache;
MDSRank *get_mds() override
MutationRef mut;
CDentry *dn;
version_t dpv;
- MDSInternalContextBase *fin;
- C_MDC_CreateSystemFile(MDCache *c, MutationRef& mu, CDentry *d, version_t v, MDSInternalContextBase *f) :
+ MDSContext *fin;
+ C_MDC_CreateSystemFile(MDCache *c, MutationRef& mu, CDentry *d, version_t v, MDSContext *f) :
MDCacheLogContext(c), mut(mu), dn(d), dpv(v), fin(f) {}
void finish(int r) override {
mdcache->_create_system_file_finish(mut, dn, dpv, fin);
}
};
-void MDCache::_create_system_file(CDir *dir, std::string_view name, CInode *in, MDSInternalContextBase *fin)
+void MDCache::_create_system_file(CDir *dir, std::string_view name, CInode *in, MDSContext *fin)
{
dout(10) << "_create_system_file " << name << " in " << *dir << dendl;
CDentry *dn = dir->add_null_dentry(name);
mds->mdlog->flush();
}
-void MDCache::_create_system_file_finish(MutationRef& mut, CDentry *dn, version_t dpv, MDSInternalContextBase *fin)
+void MDCache::_create_system_file_finish(MutationRef& mut, CDentry *dn, version_t dpv, MDSContext *fin)
{
dout(10) << "_create_system_file_finish " << *dn << dendl;
}
};
-void MDCache::open_root_inode(MDSInternalContextBase *c)
+void MDCache::open_root_inode(MDSContext *c)
{
if (mds->get_nodeid() == mds->mdsmap->get_root()) {
CInode *in;
}
}
-void MDCache::open_mydir_inode(MDSInternalContextBase *c)
+void MDCache::open_mydir_inode(MDSContext *c)
{
CInode *in = create_system_inode(MDS_INO_MDSDIR(mds->get_nodeid()), S_IFDIR|0755); // initially inaccurate!
in->fetch(c);
}
-void MDCache::open_mydir_frag(MDSInternalContextBase *c)
+void MDCache::open_mydir_frag(MDSContext *c)
{
open_mydir_inode(
new MDSInternalContextWrapper(mds,
scan_stray_dir();
}
-void MDCache::open_foreign_mdsdir(inodeno_t ino, MDSInternalContextBase *fin)
+void MDCache::open_foreign_mdsdir(inodeno_t ino, MDSContext *fin)
{
discover_base_ino(ino, fin, mds_rank_t(ino & (MAX_MDS-1)));
}
f->close_section();
}
-void MDCache::resolve_start(MDSInternalContext *resolve_done_)
+void MDCache::resolve_start(MDSContext *resolve_done_)
{
dout(10) << "resolve_start" << dendl;
ceph_assert(!resolve_done);
static const uint64_t i_mask = CInode::WAIT_ANY_MASK & ~CInode::WAIT_DIR;
static const uint64_t d_mask = CDir::WAIT_ANY_MASK & ~CDir::WAIT_DENTRY;
- MDSInternalContextBase::vec waiters;
+ MDSContext::vec waiters;
// wake up any waiters in their subtrees
for (map<CDir*,set<CDir*> >::iterator p = subtrees.begin();
f->close_section();
}
-void MDCache::rejoin_start(MDSInternalContext *rejoin_done_)
+void MDCache::rejoin_start(MDSContext *rejoin_done_)
{
dout(10) << "rejoin_start" << dendl;
ceph_assert(!rejoin_done);
mds->heartbeat_reset();
}
- for (map<inodeno_t, MDSInternalContextBase::vec >::iterator p = cap_reconnect_waiters.begin();
+ for (map<inodeno_t, MDSContext::vec >::iterator p = cap_reconnect_waiters.begin();
p != cap_reconnect_waiters.end();
++p)
mds->queue_waiters(p->second);
dout(15) << " chose lock states on " << *in << dendl;
}
- map<inodeno_t, MDSInternalContextBase::vec >::iterator it =
+ map<inodeno_t, MDSContext::vec >::iterator it =
cap_reconnect_waiters.find(in->ino());
if (it != cap_reconnect_waiters.end()) {
mds->queue_waiters(it->second);
in->put(CInode::PIN_TRUNCATING);
in->auth_unpin(this);
- MDSInternalContextBase::vec waiters;
+ MDSContext::vec waiters;
in->take_waiting(CInode::WAIT_TRUNC, waiters);
mds->queue_waiters(waiters);
}
}
if (!dir->is_complete()) {
- MDSInternalContextBase *fin = nullptr;
+ MDSContext *fin = nullptr;
if (shutdown_exporting_strays.empty()) {
fin = new MDSInternalContextWrapper(mds,
new FunctionContext([this](int r) {
* @param approxfg approximate fragment.
* @param fin completion callback
*/
-void MDCache::open_remote_dirfrag(CInode *diri, frag_t approxfg, MDSInternalContextBase *fin)
+void MDCache::open_remote_dirfrag(CInode *diri, frag_t approxfg, MDSContext *fin)
{
dout(10) << "open_remote_dir on " << *diri << dendl;
ceph_assert(diri->is_dir());
struct C_MDC_OpenRemoteDentry : public MDCacheContext {
CDentry *dn;
inodeno_t ino;
- MDSInternalContextBase *onfinish;
+ MDSContext *onfinish;
bool want_xlocked;
- C_MDC_OpenRemoteDentry(MDCache *m, CDentry *d, inodeno_t i, MDSInternalContextBase *f, bool wx) :
+ C_MDC_OpenRemoteDentry(MDCache *m, CDentry *d, inodeno_t i, MDSContext *f, bool wx) :
MDCacheContext(m), dn(d), ino(i), onfinish(f), want_xlocked(wx) {
dn->get(MDSCacheObject::PIN_PTRWAITER);
}
}
};
-void MDCache::open_remote_dentry(CDentry *dn, bool projected, MDSInternalContextBase *fin, bool want_xlocked)
+void MDCache::open_remote_dentry(CDentry *dn, bool projected, MDSContext *fin, bool want_xlocked)
{
dout(10) << "open_remote_dentry " << *dn << dendl;
CDentry::linkage_t *dnl = projected ? dn->get_projected_linkage() : dn->get_linkage();
new C_MDC_OpenRemoteDentry(this, dn, ino, fin, want_xlocked), true, want_xlocked); // backtrace
}
-void MDCache::_open_remote_dentry_finish(CDentry *dn, inodeno_t ino, MDSInternalContextBase *fin,
+void MDCache::_open_remote_dentry_finish(CDentry *dn, inodeno_t ino, MDSContext *fin,
bool want_xlocked, int r)
{
if (r < 0) {
{
dout(10) << "open_ino_finish ino " << ino << " ret " << ret << dendl;
- MDSInternalContextBase::vec waiters;
+ MDSContext::vec waiters;
waiters.swap(info.waiters);
opening_inodes.erase(ino);
finish_contexts(g_ceph_context, waiters, ret);
}
}
-void MDCache::open_ino(inodeno_t ino, int64_t pool, MDSInternalContextBase* fin,
+void MDCache::open_ino(inodeno_t ino, int64_t pool, MDSContext* fin,
bool want_replica, bool want_xlocked)
{
dout(10) << "open_ino " << ino << " pool " << pool << " want_replica "
- traverse path
*/
-void MDCache::find_ino_peers(inodeno_t ino, MDSInternalContextBase *c, mds_rank_t hint)
+void MDCache::find_ino_peers(inodeno_t ino, MDSContext *c, mds_rank_t hint)
{
dout(5) << "find_ino_peers " << ino << " hint " << hint << dendl;
CInode *in = get_inode(ino);
}
void MDCache::discover_base_ino(inodeno_t want_ino,
- MDSInternalContextBase *onfinish,
+ MDSContext *onfinish,
mds_rank_t from)
{
dout(7) << "discover_base_ino " << want_ino << " from mds." << from << dendl;
void MDCache::discover_dir_frag(CInode *base,
frag_t approx_fg,
- MDSInternalContextBase *onfinish,
+ MDSContext *onfinish,
mds_rank_t from)
{
if (from < 0)
void MDCache::discover_path(CInode *base,
snapid_t snap,
filepath want_path,
- MDSInternalContextBase *onfinish,
+ MDSContext *onfinish,
bool want_xlocked,
mds_rank_t from)
{
base->add_waiter(CInode::WAIT_SINGLEAUTH, onfinish);
return;
} else if (from == mds->get_nodeid()) {
- MDSInternalContextBase::vec finished;
+ MDSContext::vec finished;
base->take_waiting(CInode::WAIT_DIR, finished);
mds->queue_waiters(finished);
return;
void MDCache::discover_path(CDir *base,
snapid_t snap,
filepath want_path,
- MDSInternalContextBase *onfinish,
+ MDSContext *onfinish,
bool want_xlocked)
{
mds_rank_t from = base->authority().first;
base->add_waiter(CDir::WAIT_SINGLEAUTH, onfinish);
return;
} else if (from == mds->get_nodeid()) {
- MDSInternalContextBase::vec finished;
+ MDSContext::vec finished;
base->take_sub_waiting(finished);
mds->queue_waiters(finished);
return;
if (m->is_flag_error_dn())
dout(7) << " flag error, dentry = " << m->get_error_dentry() << dendl;
- MDSInternalContextBase::vec finished, error;
+ MDSContext::vec finished, error;
mds_rank_t from = mds_rank_t(m->get_source().num());
// starting point
}
CDir *MDCache::add_replica_dir(bufferlist::const_iterator& p, CInode *diri, mds_rank_t from,
- MDSInternalContextBase::vec& finished)
+ MDSContext::vec& finished)
{
dirfrag_t df;
decode(df, p);
return dir;
}
-CDentry *MDCache::add_replica_dentry(bufferlist::const_iterator& p, CDir *dir, MDSInternalContextBase::vec& finished)
+CDentry *MDCache::add_replica_dentry(bufferlist::const_iterator& p, CDir *dir, MDSContext::vec& finished)
{
string name;
snapid_t last;
return dn;
}
-CInode *MDCache::add_replica_inode(bufferlist::const_iterator& p, CDentry *dn, MDSInternalContextBase::vec& finished)
+CInode *MDCache::add_replica_inode(bufferlist::const_iterator& p, CDentry *dn, MDSContext::vec& finished)
{
inodeno_t ino;
snapid_t last;
CDentry *MDCache::add_replica_stray(const bufferlist &bl, mds_rank_t from)
{
- MDSInternalContextBase::vec finished;
+ MDSContext::vec finished;
auto p = bl.cbegin();
CInode *mdsin = add_replica_inode(p, NULL, finished);
}
auto p = m->bl.cbegin();
- MDSInternalContextBase::vec finished;
+ MDSContext::vec finished;
if (dn) {
if (m->get_is_primary()) {
// primary link.
*/
void MDCache::adjust_dir_fragments(CInode *diri, frag_t basefrag, int bits,
list<CDir*>& resultfrags,
- MDSInternalContextBase::vec& waiters,
+ MDSContext::vec& waiters,
bool replay)
{
dout(10) << "adjust_dir_fragments " << basefrag << " " << bits
dout(10) << "force_dir_fragment " << fg << " on " << *diri << dendl;
list<CDir*> src, result;
- MDSInternalContextBase::vec waiters;
+ MDSContext::vec waiters;
// split a parent?
frag_t parent = diri->dirfragtree.get_branch_or_leaf(fg);
list<CDir*>& srcfrags,
frag_t basefrag, int bits,
list<CDir*>& resultfrags,
- MDSInternalContextBase::vec& waiters,
+ MDSContext::vec& waiters,
bool replay)
{
dout(10) << "adjust_dir_fragments " << basefrag << " bits " << bits
}
// refragment
- MDSInternalContextBase::vec waiters;
+ MDSContext::vec waiters;
adjust_dir_fragments(diri, info.dirs, basedirfrag.frag, info.bits,
info.resultfrags, waiters, false);
if (g_conf()->mds_debug_frag)
*/
// refragment
- MDSInternalContextBase::vec waiters;
+ MDSContext::vec waiters;
list<CDir*> resultfrags;
adjust_dir_fragments(diri, base, bits, resultfrags, waiters, false);
if (g_conf()->mds_debug_frag)
list<CDir*> resultfrags;
if (uf.old_frags.empty()) {
// created by old format EFragment
- MDSInternalContextBase::vec waiters;
+ MDSContext::vec waiters;
adjust_dir_fragments(diri, p->first.frag, -uf.bits, resultfrags, waiters, true);
} else {
auto bp = uf.rollback.cbegin();
flush_dentry_work(mdr);
}
-class C_FinishIOMDR : public MDSInternalContextBase {
+class C_FinishIOMDR : public MDSContext {
protected:
MDSRank *mds;
MDRequestRef mdr;
}
// waiters
- map<int, map<inodeno_t, MDSInternalContextBase::vec > > waiting_for_base_ino;
+ map<int, map<inodeno_t, MDSContext::vec > > waiting_for_base_ino;
- void discover_base_ino(inodeno_t want_ino, MDSInternalContextBase *onfinish, mds_rank_t from=MDS_RANK_NONE);
- void discover_dir_frag(CInode *base, frag_t approx_fg, MDSInternalContextBase *onfinish,
+ void discover_base_ino(inodeno_t want_ino, MDSContext *onfinish, mds_rank_t from=MDS_RANK_NONE);
+ void discover_dir_frag(CInode *base, frag_t approx_fg, MDSContext *onfinish,
mds_rank_t from=MDS_RANK_NONE);
- void discover_path(CInode *base, snapid_t snap, filepath want_path, MDSInternalContextBase *onfinish,
+ void discover_path(CInode *base, snapid_t snap, filepath want_path, MDSContext *onfinish,
bool want_xlocked=false, mds_rank_t from=MDS_RANK_NONE);
- void discover_path(CDir *base, snapid_t snap, filepath want_path, MDSInternalContextBase *onfinish,
+ void discover_path(CDir *base, snapid_t snap, filepath want_path, MDSContext *onfinish,
bool want_xlocked=false);
void kick_discovers(mds_rank_t who); // after a failure.
uncommitted_masters[reqid].slaves = slaves;
uncommitted_masters[reqid].safe = safe;
}
- void wait_for_uncommitted_master(metareqid_t reqid, MDSInternalContextBase *c) {
+ void wait_for_uncommitted_master(metareqid_t reqid, MDSContext *c) {
uncommitted_masters[reqid].waiters.push_back(c);
}
bool have_uncommitted_master(metareqid_t reqid, mds_rank_t from) {
struct umaster {
set<mds_rank_t> slaves;
LogSegment *ls;
- MDSInternalContextBase::vec waiters;
+ MDSContext::vec waiters;
bool safe;
bool committing;
bool recovering;
}
void cancel_ambiguous_import(CDir *);
void finish_ambiguous_import(dirfrag_t dirino);
- void resolve_start(MDSInternalContext *resolve_done_);
+ void resolve_start(MDSContext *resolve_done_);
void send_resolves();
void maybe_send_pending_resolves() {
if (resolves_pending)
map<inodeno_t,map<client_t,map<mds_rank_t,cap_reconnect_t> > > cap_imports; // ino -> client -> frommds -> capex
set<inodeno_t> cap_imports_missing;
- map<inodeno_t, MDSInternalContextBase::vec > cap_reconnect_waiters;
+ map<inodeno_t, MDSContext::vec > cap_reconnect_waiters;
int cap_imports_num_opening;
set<CInode*> rejoin_undef_inodes;
vector<CInode*> rejoin_recover_q, rejoin_check_q;
list<SimpleLock*> rejoin_eval_locks;
- MDSInternalContextBase::vec rejoin_waiters;
+ MDSContext::vec rejoin_waiters;
void rejoin_walk(CDir *dir, const MMDSCacheRejoin::ref &rejoin);
void handle_cache_rejoin(const MMDSCacheRejoin::const_ref &m);
if (rejoins_pending)
rejoin_send_rejoins();
}
- std::unique_ptr<MDSInternalContext> rejoin_done;
- std::unique_ptr<MDSInternalContext> resolve_done;
+ std::unique_ptr<MDSContext> rejoin_done;
+ std::unique_ptr<MDSContext> resolve_done;
public:
- void rejoin_start(MDSInternalContext *rejoin_done_);
+ void rejoin_start(MDSContext *rejoin_done_);
void rejoin_gather_finish();
void rejoin_send_rejoins();
void rejoin_export_caps(inodeno_t ino, client_t client, const cap_reconnect_t& icr,
ceph_assert(cap_imports[ino][client].size() == 1);
cap_imports.erase(ino);
}
- void wait_replay_cap_reconnect(inodeno_t ino, MDSInternalContextBase *c) {
+ void wait_replay_cap_reconnect(inodeno_t ino, MDSContext *c) {
cap_reconnect_waiters[ino].push_back(c);
}
private:
bool opening_root, open;
- MDSInternalContextBase::vec waiting_for_open;
+ MDSContext::vec waiting_for_open;
public:
void init_layouts();
void create_mydir_hierarchy(MDSGather *gather);
bool is_open() { return open; }
- void wait_for_open(MDSInternalContextBase *c) {
+ void wait_for_open(MDSContext *c) {
waiting_for_open.push_back(c);
}
- void open_root_inode(MDSInternalContextBase *c);
+ void open_root_inode(MDSContext *c);
void open_root();
- void open_mydir_inode(MDSInternalContextBase *c);
- void open_mydir_frag(MDSInternalContextBase *c);
+ void open_mydir_inode(MDSContext *c);
+ void open_mydir_frag(MDSContext *c);
void populate_mydir();
- void _create_system_file(CDir *dir, std::string_view name, CInode *in, MDSInternalContextBase *fin);
+ void _create_system_file(CDir *dir, std::string_view name, CInode *in, MDSContext *fin);
void _create_system_file_finish(MutationRef& mut, CDentry *dn,
- version_t dpv, MDSInternalContextBase *fin);
+ version_t dpv, MDSContext *fin);
- void open_foreign_mdsdir(inodeno_t ino, MDSInternalContextBase *c);
+ void open_foreign_mdsdir(inodeno_t ino, MDSContext *c);
CDir *get_stray_dir(CInode *in);
CDentry *get_or_create_stray_dentry(CInode *in);
CInode *cache_traverse(const filepath& path);
- void open_remote_dirfrag(CInode *diri, frag_t fg, MDSInternalContextBase *fin);
+ void open_remote_dirfrag(CInode *diri, frag_t fg, MDSContext *fin);
CInode *get_dentry_inode(CDentry *dn, MDRequestRef& mdr, bool projected=false);
bool parallel_fetch(map<inodeno_t,filepath>& pathmap, set<inodeno_t>& missing);
set<CDir*>& fetch_queue, set<inodeno_t>& missing,
C_GatherBuilder &gather_bld);
- void open_remote_dentry(CDentry *dn, bool projected, MDSInternalContextBase *fin,
+ void open_remote_dentry(CDentry *dn, bool projected, MDSContext *fin,
bool want_xlocked=false);
- void _open_remote_dentry_finish(CDentry *dn, inodeno_t ino, MDSInternalContextBase *fin,
+ void _open_remote_dentry_finish(CDentry *dn, inodeno_t ino, MDSContext *fin,
bool want_xlocked, int r);
void make_trace(vector<CDentry*>& trace, CInode *in);
version_t tid;
int64_t pool;
int last_err;
- MDSInternalContextBase::vec waiters;
+ MDSContext::vec waiters;
open_ino_info_t() : checking(MDS_RANK_NONE), auth_hint(MDS_RANK_NONE),
check_peers(true), fetch_backtrace(true), discover(false),
want_replica(false), want_xlocked(false), tid(0), pool(-1),
public:
void kick_open_ino_peers(mds_rank_t who);
- void open_ino(inodeno_t ino, int64_t pool, MDSInternalContextBase *fin,
+ void open_ino(inodeno_t ino, int64_t pool, MDSContext *fin,
bool want_replica=true, bool want_xlocked=false);
// -- find_ino_peer --
struct find_ino_peer_info_t {
inodeno_t ino;
ceph_tid_t tid;
- MDSInternalContextBase *fin;
+ MDSContext *fin;
mds_rank_t hint;
mds_rank_t checking;
set<mds_rank_t> checked;
map<ceph_tid_t, find_ino_peer_info_t> find_ino_peer;
ceph_tid_t find_ino_peer_last_tid;
- void find_ino_peers(inodeno_t ino, MDSInternalContextBase *c, mds_rank_t hint=MDS_RANK_NONE);
+ void find_ino_peers(inodeno_t ino, MDSContext *c, mds_rank_t hint=MDS_RANK_NONE);
void _do_find_ino_peer(find_ino_peer_info_t& fip);
void handle_find_ino(const MMDSFindIno::const_ref &m);
void handle_find_ino_reply(const MMDSFindInoReply::const_ref &m);
void replicate_inode(CInode *in, mds_rank_t to, bufferlist& bl,
uint64_t features);
- CDir* add_replica_dir(bufferlist::const_iterator& p, CInode *diri, mds_rank_t from, MDSInternalContextBase::vec& finished);
- CDentry *add_replica_dentry(bufferlist::const_iterator& p, CDir *dir, MDSInternalContextBase::vec& finished);
- CInode *add_replica_inode(bufferlist::const_iterator& p, CDentry *dn, MDSInternalContextBase::vec& finished);
+ CDir* add_replica_dir(bufferlist::const_iterator& p, CInode *diri, mds_rank_t from, MDSContext::vec& finished);
+ CDentry *add_replica_dentry(bufferlist::const_iterator& p, CDir *dir, MDSContext::vec& finished);
+ CInode *add_replica_inode(bufferlist::const_iterator& p, CDentry *dn, MDSContext::vec& finished);
void replicate_stray(CDentry *straydn, mds_rank_t who, bufferlist& bl);
CDentry *add_replica_stray(const bufferlist &bl, mds_rank_t from);
int bits;
bool committed;
LogSegment *ls;
- MDSInternalContextBase::vec waiters;
+ MDSContext::vec waiters;
frag_vec_t old_frags;
bufferlist rollback;
ufragment() : bits(0), committed(false), ls(NULL) {}
typedef map<dirfrag_t,fragment_info_t>::iterator fragment_info_iterator;
void adjust_dir_fragments(CInode *diri, frag_t basefrag, int bits,
- list<CDir*>& frags, MDSInternalContextBase::vec& waiters, bool replay);
+ list<CDir*>& frags, MDSContext::vec& waiters, bool replay);
void adjust_dir_fragments(CInode *diri,
list<CDir*>& srcfrags,
frag_t basefrag, int bits,
list<CDir*>& resultfrags,
- MDSInternalContextBase::vec& waiters,
+ MDSContext::vec& waiters,
bool replay);
CDir *force_dir_fragment(CInode *diri, frag_t fg, bool replay=true);
void get_force_dirfrag_bound_set(const vector<dirfrag_t>& dfs, set<CDir*>& bounds);
DecayCounter trim_counter;
public:
- void wait_for_uncommitted_fragment(dirfrag_t dirfrag, MDSInternalContextBase *c) {
+ void wait_for_uncommitted_fragment(dirfrag_t dirfrag, MDSContext *c) {
ceph_assert(uncommitted_fragments.count(dirfrag));
uncommitted_fragments[dirfrag].waiters.push_back(c);
}
};
-void MDLog::write_head(MDSInternalContextBase *c)
+void MDLog::write_head(MDSContext *c)
{
Context *fin = NULL;
if (c != NULL) {
-void MDLog::create(MDSInternalContextBase *c)
+void MDLog::create(MDSContext *c)
{
dout(5) << "create empty log" << dendl;
submit_thread.create("md_submit");
}
-void MDLog::open(MDSInternalContextBase *c)
+void MDLog::open(MDSContext *c)
{
dout(5) << "open discovering log bounds" << dendl;
*/
class C_ReopenComplete : public MDSInternalContext {
MDLog *mdlog;
- MDSInternalContextBase *on_complete;
+ MDSContext *on_complete;
public:
- C_ReopenComplete(MDLog *mdlog_, MDSInternalContextBase *on_complete_) : MDSInternalContext(mdlog_->mds), mdlog(mdlog_), on_complete(on_complete_) {}
+ C_ReopenComplete(MDLog *mdlog_, MDSContext *on_complete_) : MDSInternalContext(mdlog_->mds), mdlog(mdlog_), on_complete(on_complete_) {}
void finish(int r) override {
mdlog->append();
on_complete->complete(r);
* recovery procedure again, potentially reformatting the journal if it
* was in an old format.
*/
-void MDLog::reopen(MDSInternalContextBase *c)
+void MDLog::reopen(MDSContext *c)
{
dout(5) << "reopen" << dendl;
protected:
MDLog *mdlog;
MDSRank *get_mds() override {return mdlog->mds;}
- MDSInternalContextBase *wrapped;
+ MDSContext *wrapped;
void finish(int r) override {
if (wrapped)
}
public:
- C_MDL_Flushed(MDLog *m, MDSInternalContextBase *w)
+ C_MDL_Flushed(MDLog *m, MDSContext *w)
: mdlog(m), wrapped(w) {}
C_MDL_Flushed(MDLog *m, uint64_t wp) : mdlog(m), wrapped(NULL) {
set_write_pos(wp);
delete le;
} else {
if (data.fin) {
- MDSInternalContextBase* fin =
- dynamic_cast<MDSInternalContextBase*>(data.fin);
+ MDSContext* fin =
+ dynamic_cast<MDSContext*>(data.fin);
ceph_assert(fin);
C_MDL_Flushed *fin2 = new C_MDL_Flushed(this, fin);
fin2->set_write_pos(journaler->get_write_pos());
submit_mutex.Unlock();
}
-void MDLog::wait_for_safe(MDSInternalContextBase *c)
+void MDLog::wait_for_safe(MDSContext *c)
{
submit_mutex.Lock();
mds->mdcache->advance_stray();
}
-void MDLog::_journal_segment_subtree_map(MDSInternalContextBase *onsync)
+void MDLog::_journal_segment_subtree_map(MDSContext *onsync)
{
ceph_assert(submit_mutex.is_locked_by_me());
-void MDLog::replay(MDSInternalContextBase *c)
+void MDLog::replay(MDSContext *c)
{
ceph_assert(journaler->is_active());
ceph_assert(journaler->is_readonly());
* When this function completes, the `journaler` attribute will be set to
* a Journaler instance using the latest available serialization format.
*/
-void MDLog::_recovery_thread(MDSInternalContextBase *completion)
+void MDLog::_recovery_thread(MDSContext *completion)
{
ceph_assert(journaler == NULL);
if (g_conf()->mds_journal_format > JOURNAL_FORMAT_MAX) {
* swapping pointers to make that one the front journal only when we have
* safely completed.
*/
-void MDLog::_reformat_journal(JournalPointer const &jp_in, Journaler *old_journal, MDSInternalContextBase *completion)
+void MDLog::_reformat_journal(JournalPointer const &jp_in, Journaler *old_journal, MDSContext *completion)
{
ceph_assert(!jp_in.is_null());
ceph_assert(completion != NULL);
friend class ReplayThread;
friend class C_MDL_Replay;
- MDSInternalContextBase::vec waitfor_replay;
+ MDSContext::vec waitfor_replay;
void _replay(); // old way
void _replay_thread(); // new way
// Journal recovery/rewrite logic
class RecoveryThread : public Thread {
MDLog *log;
- MDSInternalContextBase *completion;
+ MDSContext *completion;
public:
- void set_completion(MDSInternalContextBase *c) {completion = c;}
+ void set_completion(MDSContext *c) {completion = c;}
explicit RecoveryThread(MDLog *l) : log(l), completion(NULL) {}
void* entry() override {
log->_recovery_thread(completion);
return 0;
}
} recovery_thread;
- void _recovery_thread(MDSInternalContextBase *completion);
- void _reformat_journal(JournalPointer const &jp, Journaler *old_journal, MDSInternalContextBase *completion);
+ void _recovery_thread(MDSContext *completion);
+ void _reformat_journal(JournalPointer const &jp, Journaler *old_journal, MDSContext *completion);
// -- segments --
map<uint64_t,LogSegment*> segments;
// -- segments --
void _start_new_segment();
void _prepare_new_segment();
- void _journal_segment_subtree_map(MDSInternalContextBase *onsync);
+ void _journal_segment_subtree_map(MDSContext *onsync);
public:
void start_new_segment() {
std::lock_guard l(submit_mutex);
std::lock_guard l(submit_mutex);
_prepare_new_segment();
}
- void journal_segment_subtree_map(MDSInternalContextBase *onsync=NULL) {
+ void journal_segment_subtree_map(MDSContext *onsync=NULL) {
submit_mutex.Lock();
_journal_segment_subtree_map(onsync);
submit_mutex.Unlock();
}
bool entry_is_open() const { return cur_event != NULL; }
- void wait_for_safe( MDSInternalContextBase *c );
+ void wait_for_safe( MDSContext *c );
void flush();
bool is_flushed() const {
return unflushed == 0;
};
private:
- void write_head(MDSInternalContextBase *onfinish);
+ void write_head(MDSContext *onfinish);
public:
- void create(MDSInternalContextBase *onfinish); // fresh, empty log!
- void open(MDSInternalContextBase *onopen); // append() or replay() to follow!
- void reopen(MDSInternalContextBase *onopen);
+ void create(MDSContext *onfinish); // fresh, empty log!
+ void open(MDSContext *onopen); // append() or replay() to follow!
+ void reopen(MDSContext *onopen);
void append();
- void replay(MDSInternalContextBase *onfinish);
+ void replay(MDSContext *onfinish);
void standby_trim_segments();
uint64_t MDSCacheObject::last_wait_seq = 0;
void MDSCacheObject::finish_waiting(uint64_t mask, int result) {
- MDSInternalContextBase::vec finished;
+ MDSContext::vec finished;
take_waiting(mask, finished);
finish_contexts(g_ceph_context, finished, result);
}
class MLock;
class SimpleLock;
class MDSCacheObject;
-class MDSInternalContextBase;
+class MDSContext;
/*
* for metadata leases to clients
// ---------------------------------------------
// waiting
private:
- mempool::mds_co::compact_multimap<uint64_t, std::pair<uint64_t, MDSInternalContextBase*>> waiting;
+ mempool::mds_co::compact_multimap<uint64_t, std::pair<uint64_t, MDSContext*>> waiting;
static uint64_t last_wait_seq;
public:
}
return false;
}
- virtual void add_waiter(uint64_t mask, MDSInternalContextBase *c) {
+ virtual void add_waiter(uint64_t mask, MDSContext *c) {
if (waiting.empty())
get(PIN_WAITER);
seq = ++last_wait_seq;
mask &= ~WAIT_ORDERED;
}
- waiting.insert(pair<uint64_t, pair<uint64_t, MDSInternalContextBase*> >(
+ waiting.insert(pair<uint64_t, pair<uint64_t, MDSContext*> >(
mask,
- pair<uint64_t, MDSInternalContextBase*>(seq, c)));
+ pair<uint64_t, MDSContext*>(seq, c)));
// pdout(10,g_conf()->debug_mds) << (mdsco_db_line_prefix(this))
// << "add_waiter " << hex << mask << dec << " " << c
// << " on " << *this
// << dendl;
}
- virtual void take_waiting(uint64_t mask, MDSInternalContextBase::vec& ls) {
+ virtual void take_waiting(uint64_t mask, MDSContext::vec& ls) {
if (waiting.empty()) return;
// process ordered waiters in the same order that they were added.
- std::map<uint64_t, MDSInternalContextBase*> ordered_waiters;
+ std::map<uint64_t, MDSContext*> ordered_waiters;
for (auto it = waiting.begin(); it != waiting.end(); ) {
if (it->first & mask) {
virtual void encode_lock_state(int type, bufferlist& bl) { ceph_abort(); }
virtual void decode_lock_state(int type, const bufferlist& bl) { ceph_abort(); }
virtual void finish_lock_waiters(int type, uint64_t mask, int r=0) { ceph_abort(); }
- virtual void add_lock_waiter(int type, uint64_t mask, MDSInternalContextBase *c) { ceph_abort(); }
+ virtual void add_lock_waiter(int type, uint64_t mask, MDSContext *c) { ceph_abort(); }
virtual bool is_lock_waiting(int type, uint64_t mask) { ceph_abort(); return false; }
virtual void clear_dirty_scattered(int type) { ceph_abort(); }
#define dout_context g_ceph_context
#define dout_subsys ceph_subsys_mds
-void MDSInternalContextBase::complete(int r) {
+void MDSContext::complete(int r) {
MDSRank *mds = get_mds();
-
- dout(10) << "MDSInternalContextBase::complete: " << typeid(*this).name() << dendl;
- ceph_assert(mds != NULL);
+ ceph_assert(mds != nullptr);
ceph_assert(mds->mds_lock.is_locked_by_me());
- MDSContext::complete(r);
-}
-
-
-MDSRank *MDSInternalContext::get_mds() {
- return mds;
-}
-
-MDSRank *MDSInternalContextWrapper::get_mds()
-{
- return mds;
+ dout(10) << "MDSContext::complete: " << typeid(*this).name() << dendl;
+ return Context::complete(r);
}
void MDSInternalContextWrapper::finish(int r)
mdlog->set_safe_pos(safe_pos);
}
-MDSRank *MDSIOContext::get_mds() {
- return mds;
-}
-
-MDSRank *MDSIOContextWrapper::get_mds() {
- return mds;
-}
-
void MDSIOContextWrapper::finish(int r)
{
fin->complete(r);
MDSIOContext::complete(r);
}
}
-
-MDSRank *MDSInternalContextGather::get_mds()
-{
- derr << "Forbidden call to MDSInternalContextGather::get_mds by " << typeid(*this).name() << dendl;
- ceph_abort();
-}
-
class MDSRank;
-
/**
* Completion which has access to a reference to the global MDS instance.
*
*/
class MDSContext : public Context
{
-protected:
+public:
+template<template<typename> class A>
+ using vec_alloc = std::vector<MDSContext*, A<MDSContext*>>;
+ using vec = vec_alloc<std::allocator>;
+
+template<template<typename> class A>
+ using que_alloc = std::deque<MDSContext*, A<MDSContext*>>;
+ using que = que_alloc<std::allocator>;
+
+ void complete(int r) override;
virtual MDSRank *get_mds() = 0;
};
-
-/**
- * A context which must be called with the big MDS lock held. Subclass
- * this with a get_mds implementation.
+/* Children of this could have used multiple inheritance with MDSHolder and
+ * MDSContext but then get_mds() would be ambiguous.
*/
-class MDSInternalContextBase : public MDSContext
+template<class T>
+class MDSHolder : public T
{
public:
- template<template<typename> class A>
- using vec_alloc = std::vector<MDSInternalContextBase *, A<MDSInternalContextBase *>>;
- using vec = vec_alloc<std::allocator>;
+ MDSRank* get_mds() override {
+ return mds;
+ }
- template<template<typename> class A>
- using que_alloc = std::deque<MDSInternalContextBase *, A<MDSInternalContextBase *>>;
- using que = que_alloc<std::allocator>;
+protected:
+ MDSHolder() = delete;
+ MDSHolder(MDSRank* mds) : mds(mds) {
+ ceph_assert(mds != nullptr);
+ }
- void complete(int r) override;
+ MDSRank* mds;
};
/**
* General purpose, lets you pass in an MDS pointer.
*/
-class MDSInternalContext : public MDSInternalContextBase
+class MDSInternalContext : public MDSHolder<MDSContext>
{
-protected:
- MDSRank *mds;
- MDSRank* get_mds() override;
-
public:
- explicit MDSInternalContext(MDSRank *mds_) : mds(mds_) {
- ceph_assert(mds != NULL);
- }
+ MDSInternalContext() = delete;
+
+protected:
+ explicit MDSInternalContext(MDSRank *mds_) : MDSHolder(mds_) {}
};
/**
* Wrap a regular Context up as an Internal context. Useful
* if you're trying to work with one of our more generic frameworks.
*/
-class MDSInternalContextWrapper : public MDSInternalContextBase
+class MDSInternalContextWrapper : public MDSInternalContext
{
protected:
- MDSRank *mds;
- Context *fin;
- MDSRank *get_mds() override;
+ Context *fin = nullptr;
void finish(int r) override;
public:
- MDSInternalContextWrapper(MDSRank *m, Context *c) : mds(m), fin(c) {}
+ MDSInternalContextWrapper(MDSRank *m, Context *c) : MDSInternalContext(m), fin(c) {}
};
class MDSIOContextBase : public MDSContext
class MDSLogContextBase : public MDSIOContextBase
{
protected:
- uint64_t write_pos;
+ uint64_t write_pos = 0;
public:
- MDSLogContextBase() : write_pos(0) {}
+ MDSLogContextBase() = default;
void complete(int r) final;
void set_write_pos(uint64_t wp) { write_pos = wp; }
virtual void pre_finish(int r) {}
* Completion for an I/O operation, takes big MDSRank lock
* before executing finish function.
*/
-class MDSIOContext : public MDSIOContextBase
+class MDSIOContext : public MDSHolder<MDSIOContextBase>
{
-protected:
- MDSRank *mds;
- MDSRank* get_mds() override;
-
public:
- explicit MDSIOContext(MDSRank *mds_) : mds(mds_) {
- ceph_assert(mds != NULL);
- }
+ explicit MDSIOContext(MDSRank *mds_) : MDSHolder(mds_) {}
};
/**
* Wrap a regular Context up as an IO Context. Useful
* if you're trying to work with one of our more generic frameworks.
*/
-class MDSIOContextWrapper : public MDSIOContextBase
+class MDSIOContextWrapper : public MDSHolder<MDSIOContextBase>
{
protected:
- MDSRank *mds;
Context *fin;
- MDSRank *get_mds() override;
public:
- MDSIOContextWrapper(MDSRank *m, Context *c) : mds(m), fin(c) {}
+ MDSIOContextWrapper(MDSRank *m, Context *c) : MDSHolder(m), fin(c) {}
void finish(int r) override;
void print(ostream& out) const override {
out << "io_context_wrapper(" << fin << ")";
};
/**
- * No-op for callers expecting MDSInternalContextBase
+ * No-op for callers expecting MDSInternalContext
*/
-class C_MDSInternalNoop final : public MDSInternalContextBase
+class C_MDSInternalNoop : public MDSContext
{
- MDSRank* get_mds() override {ceph_abort();}
public:
void finish(int r) override {}
void complete(int r) override { delete this; }
+protected:
+ MDSRank* get_mds() override final {ceph_abort();}
};
/**
- * This class is used where you have an MDSInternalContextBase but
+ * This class is used where you have an MDSInternalContext but
* you sometimes want to call it back from an I/O completion.
*/
class C_IO_Wrapper : public MDSIOContext
{
protected:
bool async;
- MDSInternalContextBase *wrapped;
+ MDSContext *wrapped;
void finish(int r) override {
wrapped->complete(r);
wrapped = nullptr;
}
public:
- C_IO_Wrapper(MDSRank *mds_, MDSInternalContextBase *wrapped_) :
+ C_IO_Wrapper(MDSRank *mds_, MDSContext *wrapped_) :
MDSIOContext(mds_), async(true), wrapped(wrapped_) {
ceph_assert(wrapped != NULL);
}
}
};
+using MDSGather = C_GatherBase<MDSContext, C_MDSInternalNoop>;
+using MDSGatherBuilder = C_GatherBuilderBase<MDSContext, MDSGather>;
-/**
- * Gather needs a default-constructable class
- */
-class MDSInternalContextGather : public MDSInternalContextBase
-{
-protected:
- MDSRank *get_mds() override;
-};
-
-using MDSGather = C_GatherBase<MDSInternalContextBase, MDSInternalContextGather>;
-using MDSGatherBuilder = C_GatherBuilderBase<MDSInternalContextBase, MDSGather>;
-
-using MDSContextFactory = ContextFactory<MDSInternalContextBase>;
+using MDSContextFactory = ContextFactory<MDSContext>;
#endif // MDS_CONTEXT_H
class MDSContinuation : public Continuation {
protected:
Server *server;
- MDSInternalContextBase *get_internal_callback(int stage) {
+ MDSContext *get_internal_callback(int stage) {
return new MDSInternalContextWrapper(server->mds, get_callback(stage));
}
MDSIOContextBase *get_io_callback(int stage) {
}
{
- map<epoch_t,MDSInternalContextBase::vec >::iterator p = waiting_for_mdsmap.begin();
+ map<epoch_t,MDSContext::vec >::iterator p = waiting_for_mdsmap.begin();
while (p != waiting_for_mdsmap.end() && p->first <= mdsmap->get_epoch()) {
- MDSInternalContextBase::vec ls;
+ MDSContext::vec ls;
ls.swap(p->second);
waiting_for_mdsmap.erase(p++);
queue_waiters(ls);
} progress_thread;
list<Message::const_ref> waiting_for_nolaggy;
- MDSInternalContextBase::que finished_queue;
+ MDSContext::que finished_queue;
// Dispatch, retry, queues
int dispatch_depth;
void inc_dispatch_depth() { ++dispatch_depth; }
ceph_tid_t last_tid; // for mds-initiated requests (e.g. stray rename)
- MDSInternalContextBase::vec waiting_for_active, waiting_for_replay, waiting_for_rejoin,
+ MDSContext::vec waiting_for_active, waiting_for_replay, waiting_for_rejoin,
waiting_for_reconnect, waiting_for_resolve;
- MDSInternalContextBase::vec waiting_for_any_client_connection;
- MDSInternalContextBase::que replay_queue;
- map<mds_rank_t, MDSInternalContextBase::vec > waiting_for_active_peer;
- map<epoch_t, MDSInternalContextBase::vec > waiting_for_mdsmap;
+ MDSContext::vec waiting_for_any_client_connection;
+ MDSContext::que replay_queue;
+ map<mds_rank_t, MDSContext::vec > waiting_for_active_peer;
+ map<epoch_t, MDSContext::vec > waiting_for_mdsmap;
epoch_t osd_epoch_barrier;
void create_logger();
public:
- void queue_waiter(MDSInternalContextBase *c) {
+ void queue_waiter(MDSContext *c) {
finished_queue.push_back(c);
progress_thread.signal();
}
- void queue_waiters(MDSInternalContextBase::vec& ls) {
- MDSInternalContextBase::vec v;
+ void queue_waiters(MDSContext::vec& ls) {
+ MDSContext::vec v;
v.swap(ls);
std::copy(v.begin(), v.end(), std::back_inserter(finished_queue));
progress_thread.signal();
}
- void queue_waiters_front(MDSInternalContextBase::vec& ls) {
- MDSInternalContextBase::vec v;
+ void queue_waiters_front(MDSContext::vec& ls) {
+ MDSContext::vec v;
v.swap(ls);
std::copy(v.rbegin(), v.rend(), std::front_inserter(finished_queue));
progress_thread.signal();
void send_message_client(const Message::ref& m, Session* session);
void send_message(const Message::ref& m, const ConnectionRef& c);
- void wait_for_active_peer(mds_rank_t who, MDSInternalContextBase *c) {
+ void wait_for_active_peer(mds_rank_t who, MDSContext *c) {
waiting_for_active_peer[who].push_back(c);
}
- void wait_for_cluster_recovered(MDSInternalContextBase *c) {
+ void wait_for_cluster_recovered(MDSContext *c) {
ceph_assert(cluster_degraded);
waiting_for_active_peer[MDS_RANK_NONE].push_back(c);
}
- void wait_for_any_client_connection(MDSInternalContextBase *c) {
+ void wait_for_any_client_connection(MDSContext *c) {
waiting_for_any_client_connection.push_back(c);
}
void kick_waiters_for_any_client_connection(void) {
finish_contexts(g_ceph_context, waiting_for_any_client_connection);
}
- void wait_for_active(MDSInternalContextBase *c) {
+ void wait_for_active(MDSContext *c) {
waiting_for_active.push_back(c);
}
- void wait_for_replay(MDSInternalContextBase *c) {
+ void wait_for_replay(MDSContext *c) {
waiting_for_replay.push_back(c);
}
- void wait_for_rejoin(MDSInternalContextBase *c) {
+ void wait_for_rejoin(MDSContext *c) {
waiting_for_rejoin.push_back(c);
}
- void wait_for_reconnect(MDSInternalContextBase *c) {
+ void wait_for_reconnect(MDSContext *c) {
waiting_for_reconnect.push_back(c);
}
- void wait_for_resolve(MDSInternalContextBase *c) {
+ void wait_for_resolve(MDSContext *c) {
waiting_for_resolve.push_back(c);
}
- void wait_for_mdsmap(epoch_t e, MDSInternalContextBase *c) {
+ void wait_for_mdsmap(epoch_t e, MDSContext *c) {
waiting_for_mdsmap[e].push_back(c);
}
- void enqueue_replay(MDSInternalContextBase *c) {
+ void enqueue_replay(MDSContext *c) {
replay_queue.push_back(c);
}
* The finish function calls functions which
* will put the Message exactly once.*/
class C_MDS_RetryMessage : public MDSInternalContext {
-protected:
- Message::const_ref m;
public:
C_MDS_RetryMessage(MDSRank *mds, const Message::const_ref &m)
: MDSInternalContext(mds), m(m) {}
void finish(int r) override {
- mds->retry_dispatch(m);
+ get_mds()->retry_dispatch(m);
}
+protected:
+ Message::const_ref m;
};
class CF_MDS_RetryMessageFactory : public MDSContextFactory {
CF_MDS_RetryMessageFactory(MDSRank *mds, const Message::const_ref &m)
: mds(mds), m(m) {}
- MDSInternalContextBase *build() {
+ MDSContext *build() {
return new C_MDS_RetryMessage(mds, m);
}
}
};
-void MDSTable::save(MDSInternalContextBase *onfinish, version_t v)
+void MDSTable::save(MDSContext *onfinish, version_t v)
{
if (v > 0 && v <= committing_version) {
dout(10) << "save v " << version << " - already saving "
dout(10) << "save_2 v " << v << dendl;
committed_version = v;
- MDSInternalContextBase::vec ls;
+ MDSContext::vec ls;
while (!waitfor_save.empty()) {
auto it = waitfor_save.begin();
if (it->first > v) break;
return object_t(n);
}
-void MDSTable::load(MDSInternalContextBase *onfinish)
+void MDSTable::load(MDSContext *onfinish)
{
dout(10) << "load" << dendl;
version_t version, committing_version, committed_version, projected_version;
- map<version_t, MDSInternalContextBase::vec > waitfor_save;
+ map<version_t, MDSContext::vec > waitfor_save;
public:
MDSTable(MDSRank *m, std::string_view n, bool is_per_mds) :
bool is_opening() const { return state == STATE_OPENING; }
void reset();
- void save(MDSInternalContextBase *onfinish=0, version_t need=0);
+ void save(MDSContext *onfinish=0, version_t need=0);
void save_2(int r, version_t v);
void shutdown() {
}
object_t get_object_name() const;
- void load(MDSInternalContextBase *onfinish);
+ void load(MDSContext *onfinish);
void load_2(int, bufferlist&, Context *onfinish);
// child must overload these
ceph_assert(g_conf()->mds_kill_mdstable_at != 3);
- MDSInternalContextBase *onfinish = pending_prepare[reqid].onfinish;
+ MDSContext *onfinish = pending_prepare[reqid].onfinish;
*pending_prepare[reqid].ptid = tid;
if (pending_prepare[reqid].pbl)
*pending_prepare[reqid].pbl = m->bl;
}
void MDSTableClient::_prepare(bufferlist& mutation, version_t *ptid, bufferlist *pbl,
- MDSInternalContextBase *onfinish)
+ MDSContext *onfinish)
{
if (last_reqid == ~0ULL) {
dout(10) << "tableserver is not ready yet, waiting for request id" << dendl;
// prepares
struct _pending_prepare {
- MDSInternalContextBase *onfinish;
+ MDSContext *onfinish;
version_t *ptid;
bufferlist *pbl;
bufferlist mutation;
_pending_prepare() : onfinish(0), ptid(0), pbl(0) {}
- _pending_prepare(MDSInternalContextBase *c, version_t *pt, bufferlist *pb, bufferlist& m) :
+ _pending_prepare(MDSContext *c, version_t *pt, bufferlist *pb, bufferlist& m) :
onfinish(c), ptid(pt), pbl(pb), mutation(m) {}
};
// pending commits
map<version_t, LogSegment*> pending_commit;
- map<version_t, MDSInternalContextBase::vec > ack_waiters;
+ map<version_t, MDSContext::vec > ack_waiters;
void handle_reply(class MMDSTableQuery *m);
void _logged_ack(version_t tid);
void handle_request(const MMDSTableRequest::const_ref &m);
- void _prepare(bufferlist& mutation, version_t *ptid, bufferlist *pbl, MDSInternalContextBase *onfinish);
+ void _prepare(bufferlist& mutation, version_t *ptid, bufferlist *pbl, MDSContext *onfinish);
void commit(version_t tid, LogSegment *ls);
void resend_commits();
bool has_committed(version_t tid) const {
return pending_commit.count(tid) == 0;
}
- void wait_for_ack(version_t tid, MDSInternalContextBase *c) {
+ void wait_for_ack(version_t tid, MDSContext *c) {
ack_waiters[tid].push_back(c);
}
// recovery
-class C_ServerRecovery : public MDSInternalContextBase {
+class C_ServerRecovery : public MDSContext {
MDSTableServer *server;
MDSRank *get_mds() override { return server->mds; }
public:
set<mds_rank_t> notify_ack_gather;
mds_rank_t mds;
MMDSTableRequest::ref reply;
- MDSInternalContextBase *onfinish;
+ MDSContext *onfinish;
notify_info_t() : reply(NULL), onfinish(NULL) {}
};
map<version_t, notify_info_t> pending_notifies;
#define dout_prefix *_dout << "mds." << mds->get_nodeid() << ".migrator "
-class MigratorContext : public MDSInternalContextBase {
+class MigratorContext : public MDSContext {
protected:
Migrator *mig;
MDSRank *get_mds() override {
void Migrator::finish_export_inode(CInode *in, mds_rank_t peer,
map<client_t,Capability::Import>& peer_imported,
- MDSInternalContextBase::vec& finished)
+ MDSContext::vec& finished)
{
dout(12) << "finish_export_inode " << *in << dendl;
void Migrator::finish_export_dir(CDir *dir, mds_rank_t peer,
map<inodeno_t,map<client_t,Capability::Import> >& peer_imported,
- MDSInternalContextBase::vec& finished, int *num_dentries)
+ MDSContext::vec& finished, int *num_dentries)
{
dout(10) << "finish_export_dir " << *dir << dendl;
// finish export (adjust local cache state)
int num_dentries = 0;
- MDSInternalContextBase::vec finished;
+ MDSContext::vec finished;
finish_export_dir(dir, it->second.peer,
it->second.peer_imported, finished, &num_dentries);
class C_MDS_ExportDiscoverFactory : public MDSContextFactory {
public:
C_MDS_ExportDiscoverFactory(Migrator *mig, MExportDirDiscover::const_ref m) : mig(mig), m(m) {}
- MDSInternalContextBase *build() {
+ MDSContext *build() {
return new C_MDS_ExportDiscover(mig, m);
}
private:
class C_MDS_ExportPrepFactory : public MDSContextFactory {
public:
C_MDS_ExportPrepFactory(Migrator *mig, MExportDirPrep::const_ref m) : mig(mig), m(m) {}
- MDSInternalContextBase *build() {
+ MDSContext *build() {
return new C_MDS_ExportPrep(mig, m);
}
private:
CDir *dir;
CInode *diri;
- MDSInternalContextBase::vec finished;
+ MDSContext::vec finished;
// assimilate root dir.
map<dirfrag_t,import_state_t>::iterator it = import_state.find(m->get_dirfrag());
class C_MDC_QueueContexts : public MigratorContext {
public:
- MDSInternalContextBase::vec contexts;
+ MDSContext::vec contexts;
C_MDC_QueueContexts(Migrator *m) : MigratorContext(m) {}
void finish(int r) override {
// execute contexts immediately after 'this' context
// take all waiters on this dir
// NOTE: a pass of imported data is guaranteed to get all of my waiters because
// a replica's presense in my cache implies/forces it's presense in authority's.
- MDSInternalContextBase::vec waiters;
+ MDSContext::vec waiters;
dir->take_waiting(CDir::WAIT_ANY_MASK, waiters);
for (auto c : waiters)
dir->add_waiter(CDir::WAIT_UNFREEZE, c); // UNFREEZE will get kicked both on success or failure
std::map<client_t,client_metadata_t>& exported_client_metadata_map);
void finish_export_inode(CInode *in, mds_rank_t target,
std::map<client_t,Capability::Import>& peer_imported,
- MDSInternalContextBase::vec& finished);
+ MDSContext::vec& finished);
void finish_export_inode_caps(CInode *in, mds_rank_t target,
std::map<client_t,Capability::Import>& peer_imported);
std::map<client_t,client_metadata_t>& exported_client_metadata_map);
void finish_export_dir(CDir *dir, mds_rank_t target,
std::map<inodeno_t,std::map<client_t,Capability::Import> >& peer_imported,
- MDSInternalContextBase::vec& finished, int *num_dentries);
+ MDSContext::vec& finished, int *num_dentries);
void clear_export_proxy_pins(CDir *dir);
Context *slave_commit = nullptr;
bufferlist rollback_bl;
- MDSInternalContextBase::vec waiting_for_finish;
+ MDSContext::vec waiting_for_finish;
// export & fragment
CDir* export_dir = nullptr;
protected:
OpenFileTable *oft;
uint64_t log_seq;
- MDSInternalContextBase *fin;
+ MDSContext *fin;
MDSRank *get_mds() override { return oft->mds; }
public:
- C_IO_OFT_Save(OpenFileTable *t, uint64_t s, MDSInternalContextBase *c) :
+ C_IO_OFT_Save(OpenFileTable *t, uint64_t s, MDSContext *c) :
oft(t), log_seq(s), fin(c) {}
void finish(int r) {
oft->_commit_finish(r, log_seq, fin);
}
};
-void OpenFileTable::_commit_finish(int r, uint64_t log_seq, MDSInternalContextBase *fin)
+void OpenFileTable::_commit_finish(int r, uint64_t log_seq, MDSContext *fin)
{
dout(10) << __func__ << " log_seq " << log_seq << dendl;
if (r < 0) {
protected:
OpenFileTable *oft;
uint64_t log_seq;
- MDSInternalContextBase *fin;
+ MDSContext *fin;
std::map<unsigned, std::vector<ObjectOperation> > ops_map;
MDSRank *get_mds() override { return oft->mds; }
public:
- C_IO_OFT_Journal(OpenFileTable *t, uint64_t s, MDSInternalContextBase *c,
+ C_IO_OFT_Journal(OpenFileTable *t, uint64_t s, MDSContext *c,
std::map<unsigned, std::vector<ObjectOperation> >& ops) :
oft(t), log_seq(s), fin(c) {
ops_map.swap(ops);
}
};
-void OpenFileTable::_journal_finish(int r, uint64_t log_seq, MDSInternalContextBase *c,
+void OpenFileTable::_journal_finish(int r, uint64_t log_seq, MDSContext *c,
std::map<unsigned, std::vector<ObjectOperation> >& ops_map)
{
dout(10) << __func__ << " log_seq " << log_seq << dendl;
return;
}
-void OpenFileTable::commit(MDSInternalContextBase *c, uint64_t log_seq, int op_prio)
+void OpenFileTable::commit(MDSContext *c, uint64_t log_seq, int op_prio)
{
dout(10) << __func__ << " log_seq " << log_seq << dendl;
waiting_for_load.clear();
}
-void OpenFileTable::load(MDSInternalContextBase *onload)
+void OpenFileTable::load(MDSContext *onload)
{
dout(10) << __func__ << dendl;
ceph_assert(!load_done);
return true;
}
-class C_OFT_OpenInoFinish: public MDSInternalContextBase {
+class C_OFT_OpenInoFinish: public MDSContext {
OpenFileTable *oft;
inodeno_t ino;
MDSRank *get_mds() override { return oft->mds; }
void notify_unlink(CInode *in);
bool is_any_dirty() const { return !dirty_items.empty(); }
- void commit(MDSInternalContextBase *c, uint64_t log_seq, int op_prio);
+ void commit(MDSContext *c, uint64_t log_seq, int op_prio);
uint64_t get_committed_log_seq() const { return committed_log_seq; }
uint64_t get_committing_log_seq() const { return committing_log_seq; }
bool is_any_committing() const { return num_pending_commit > 0; }
- void load(MDSInternalContextBase *c);
+ void load(MDSContext *c);
bool is_loaded() const { return load_done; }
- void wait_for_load(MDSInternalContextBase *c) {
+ void wait_for_load(MDSContext *c) {
ceph_assert(!load_done);
waiting_for_load.push_back(c);
}
bool prefetch_inodes();
bool is_prefetched() const { return prefetch_state == DONE; }
- void wait_for_prefetch(MDSInternalContextBase *c) {
+ void wait_for_prefetch(MDSContext *c) {
ceph_assert(!is_prefetched());
waiting_for_prefetch.push_back(c);
}
unsigned num_pending_commit = 0;
void _encode_header(bufferlist& bl, int j_state);
- void _commit_finish(int r, uint64_t log_seq, MDSInternalContextBase *fin);
- void _journal_finish(int r, uint64_t log_seq, MDSInternalContextBase *fin,
+ void _commit_finish(int r, uint64_t log_seq, MDSContext *fin);
+ void _journal_finish(int r, uint64_t log_seq, MDSContext *fin,
std::map<unsigned, std::vector<ObjectOperation> >& ops);
std::vector<std::map<std::string, bufferlist> > loaded_journals;
map<inodeno_t, RecoveredAnchor> loaded_anchor_map;
set<dirfrag_t> loaded_dirfrags;
- MDSInternalContextBase::vec waiting_for_load;
+ MDSContext::vec waiting_for_load;
bool load_done = false;
void _reset_states() {
};
unsigned prefetch_state = 0;
unsigned num_opening_inodes = 0;
- MDSInternalContextBase::vec waiting_for_prefetch;
+ MDSContext::vec waiting_for_prefetch;
void _open_ino_finish(inodeno_t ino, int r);
void _prefetch_inodes();
void _prefetch_dirfrags();
get_state() == LOCK_MIX;
}
- void set_xlock_snap_sync(MDSInternalContextBase *c)
+ void set_xlock_snap_sync(MDSContext *c)
{
ceph_assert(get_type() == CEPH_LOCK_IFILE);
ceph_assert(state == LOCK_XLOCK || state == LOCK_XLOCKDONE);
encode(s, bl);
}
- void decode_state_rejoin(bufferlist::const_iterator& p, MDSInternalContextBase::vec& waiters, bool survivor) {
+ void decode_state_rejoin(bufferlist::const_iterator& p, MDSContext::vec& waiters, bool survivor) {
SimpleLock::decode_state_rejoin(p, waiters, survivor);
if (is_flushing()) {
set_dirty();
void ScrubStack::_enqueue_inode(CInode *in, CDentry *parent,
ScrubHeaderRef& header,
- MDSInternalContextBase *on_finish, bool top)
+ MDSContext *on_finish, bool top)
{
dout(10) << __func__ << " with {" << *in << "}"
<< ", on_finish=" << on_finish << ", top=" << top << dendl;
}
void ScrubStack::enqueue_inode(CInode *in, ScrubHeaderRef& header,
- MDSInternalContextBase *on_finish, bool top)
+ MDSContext *on_finish, bool top)
{
// abort in progress
if (clear_inode_stack) {
dout(10) << __func__ << " scrub passed on inode " << *in << dendl;
}
- MDSInternalContextBase *c = NULL;
+ MDSContext *c = NULL;
in->scrub_finished(&c);
if (in == header->get_origin()) {
scrub_origins.erase(in);
}
- MDSInternalContextBase *ctx = nullptr;
+ MDSContext *ctx = nullptr;
in->scrub_aborted(&ctx);
if (ctx != nullptr) {
ctx->complete(-ECANCELED);
* was initiated
*/
void enqueue_inode_top(CInode *in, ScrubHeaderRef& header,
- MDSInternalContextBase *on_finish) {
+ MDSContext *on_finish) {
enqueue_inode(in, header, on_finish, true);
scrub_origins.emplace(in);
}
* starting this one.
*/
void enqueue_inode_bottom(CInode *in, ScrubHeaderRef& header,
- MDSInternalContextBase *on_finish) {
+ MDSContext *on_finish) {
enqueue_inode(in, header, on_finish, false);
scrub_origins.emplace(in);
}
* the given scrub params, and then try and kick off more scrubbing.
*/
void enqueue_inode(CInode *in, ScrubHeaderRef& header,
- MDSInternalContextBase *on_finish, bool top);
+ MDSContext *on_finish, bool top);
void _enqueue_inode(CInode *in, CDentry *parent, ScrubHeaderRef& header,
- MDSInternalContextBase *on_finish, bool top);
+ MDSContext *on_finish, bool top);
/**
* Kick off as many scrubs as are appropriate, based on the current
* state of the stack.
#undef dout_prefix
#define dout_prefix *_dout << "mds." << mds->get_nodeid() << ".server "
-class ServerContext : public MDSInternalContextBase {
+class ServerContext : public MDSContext {
protected:
Server *server;
MDSRank *get_mds() override
void Server::finish_flush_session(Session *session, version_t seq)
{
- MDSInternalContextBase::vec finished;
+ MDSContext::vec finished;
session->finish_flush(seq, finished);
mds->queue_waiters(finished);
}
}
/*
- * XXX bump in the interface here, not using an MDSInternalContextBase here
+ * XXX bump in the interface here, not using an MDSContext here
* because all the callers right now happen to use a SaferCond
*/
void Server::kill_session(Session *session, Context *on_safe)
finish_flush_session(session, session->get_push_seq());
}
-void Server::reconnect_clients(MDSInternalContext *reconnect_done_)
+void Server::reconnect_clients(MDSContext *reconnect_done_)
{
reconnect_done = reconnect_done_;
class CF_MDS_MDRContextFactory : public MDSContextFactory {
public:
CF_MDS_MDRContextFactory(MDCache *cache, MDRequestRef &mdr) : cache(cache), mdr(mdr) {}
- MDSInternalContextBase *build() {
+ MDSContext *build() {
return new C_MDS_RetryRequest(cache, mdr);
}
private:
respond_to_request(mdr, r);
} else if (r == -ESTALE) {
dout(10) << "FAIL on ESTALE but attempting recovery" << dendl;
- MDSInternalContextBase *c = new C_MDS_TryFindInode(this, mdr);
+ MDSContext *c = new C_MDS_TryFindInode(this, mdr);
mdcache->find_ino_peers(refpath.get_ino(), c);
} else {
dout(10) << "FAIL on error " << r << dendl;
if (r < 0 && r != -ENOENT) {
if (r == -ESTALE) {
dout(10) << "FAIL on ESTALE but attempting recovery" << dendl;
- MDSInternalContextBase *c = new C_MDS_TryFindInode(this, mdr);
+ MDSContext *c = new C_MDS_TryFindInode(this, mdr);
mdcache->find_ino_peers(req->get_filepath().get_ino(), c);
} else {
dout(10) << "FAIL on error " << r << dendl;
dout(10) << " state prior to lock change: " << *lock_state << dendl;
if (CEPH_LOCK_UNLOCK == set_lock.type) {
list<ceph_filelock> activated_locks;
- MDSInternalContextBase::vec waiters;
+ MDSContext::vec waiters;
if (lock_state->is_waiting(set_lock)) {
dout(10) << " unlock removing waiting lock " << set_lock << dendl;
lock_state->remove_waiting(set_lock);
if (srcdn->is_auth() && srcdn->get_dir()->inode->is_stray())
migrated_stray = in->ino();
- MDSInternalContextBase::vec finished;
+ MDSContext::vec finished;
if (r == 0) {
// unfreeze+singleauth inode
// hmm, do i really need to delay this?
}
if (mdr) {
- MDSInternalContextBase::vec finished;
+ MDSContext::vec finished;
if (mdr->more()->is_ambiguous_auth) {
if (srcdn->is_auth())
mdr->more()->rename_inode->unfreeze_inode(finished);
bool is_full;
// State for while in reconnect
- MDSInternalContext *reconnect_done;
+ MDSContext *reconnect_done;
int failed_reconnects;
bool reconnect_evicting; // true if I am waiting for evictions to complete
// before proceeding to reconnect_gather_finish
void finish_reclaim_session(Session *session, const MClientReclaimReply::ref &reply=nullptr);
void handle_client_reclaim(const MClientReclaim::const_ref &m);
- void reconnect_clients(MDSInternalContext *reconnect_done_);
+ void reconnect_clients(MDSContext *reconnect_done_);
void handle_client_reconnect(const MClientReconnect::const_ref &m);
void infer_supported_features(Session *session, client_metadata_t& client_metadata);
void update_required_client_features();
* Populate session state from OMAP records in this
* rank's sessionmap object.
*/
-void SessionMap::load(MDSInternalContextBase *onload)
+void SessionMap::load(MDSContext *onload)
{
dout(10) << "load" << dendl;
};
}
-void SessionMap::save(MDSInternalContextBase *onsave, version_t needv)
+void SessionMap::save(MDSContext *onsave, version_t needv)
{
dout(10) << __func__ << ": needv " << needv << ", v " << version << dendl;
namespace {
class C_IO_SM_Save_One : public SessionMapIOContext {
- MDSInternalContextBase *on_safe;
+ MDSContext *on_safe;
public:
- C_IO_SM_Save_One(SessionMap *cm, MDSInternalContextBase *on_safe_)
+ C_IO_SM_Save_One(SessionMap *cm, MDSContext *on_safe_)
: SessionMapIOContext(cm), on_safe(on_safe_) {}
void finish(int r) override {
if (r != 0) {
SnapContext snapc;
object_t oid = get_object_name();
object_locator_t oloc(mds->mdsmap->get_metadata_pool());
- MDSInternalContextBase *on_safe = gather_bld->new_sub();
+ MDSContext *on_safe = gather_bld->new_sub();
mds->objecter->mutate(oid, oloc, op, snapc,
ceph::real_clock::now(), 0,
new C_OnFinisher(
private:
uint32_t cap_gen = 0;
version_t cap_push_seq = 0; // cap push seq #
- map<version_t, MDSInternalContextBase::vec > waitfor_flush; // flush session messages
+ map<version_t, MDSContext::vec > waitfor_flush; // flush session messages
public:
xlist<Capability*> caps; // inodes with caps; front=most recently used
version_t inc_push_seq() { return ++cap_push_seq; }
version_t get_push_seq() const { return cap_push_seq; }
- version_t wait_for_flush(MDSInternalContextBase* c) {
+ version_t wait_for_flush(MDSContext* c) {
waitfor_flush[get_push_seq()].push_back(c);
return get_push_seq();
}
- void finish_flush(version_t seq, MDSInternalContextBase::vec& ls) {
+ void finish_flush(version_t seq, MDSContext::vec& ls) {
while (!waitfor_flush.empty()) {
auto it = waitfor_flush.begin();
if (it->first > seq)
public:
map<int,xlist<Session*>* > by_state;
uint64_t set_state(Session *session, int state);
- map<version_t, MDSInternalContextBase::vec > commit_waiters;
+ map<version_t, MDSContext::vec > commit_waiters;
void update_average_session_age();
SessionMap() = delete;
// -- loading, saving --
inodeno_t ino;
- MDSInternalContextBase::vec waiting_for_load;
+ MDSContext::vec waiting_for_load;
object_t get_object_name() const;
- void load(MDSInternalContextBase *onload);
+ void load(MDSContext *onload);
void _load_finish(
int operation_r,
int header_r,
void load_legacy();
void _load_legacy_finish(int r, bufferlist &bl);
- void save(MDSInternalContextBase *onsave, version_t needv=0);
+ void save(MDSContext *onsave, version_t needv=0);
void _save_finish(version_t v);
protected:
void finish_waiters(uint64_t mask, int r=0) {
parent->finish_waiting(mask << get_wait_shift(), r);
}
- void take_waiting(uint64_t mask, MDSInternalContextBase::vec& ls) {
+ void take_waiting(uint64_t mask, MDSContext::vec& ls) {
parent->take_waiting(mask << get_wait_shift(), ls);
}
- void add_waiter(uint64_t mask, MDSInternalContextBase *c) {
+ void add_waiter(uint64_t mask, MDSContext *c) {
parent->add_waiter((mask << get_wait_shift()) | MDSCacheObject::WAIT_ORDERED, c);
}
bool is_waiter_for(uint64_t mask) const {
//assert(!is_stable() || gather_set.size() == 0); // gather should be empty in stable states.
return s;
}
- void set_state_rejoin(int s, MDSInternalContextBase::vec& waiters, bool survivor) {
+ void set_state_rejoin(int s, MDSContext::vec& waiters, bool survivor) {
ceph_assert(!get_parent()->is_auth());
// If lock in the replica object was not in SYNC state when auth mds of the object failed.
if (is_new)
state = s;
}
- void decode_state_rejoin(bufferlist::const_iterator& p, MDSInternalContextBase::vec& waiters, bool survivor) {
+ void decode_state_rejoin(bufferlist::const_iterator& p, MDSContext::vec& waiters, bool survivor) {
__s16 s;
using ceph::decode;
decode(s, p);
synced = true;
if (synced && !waiting_for_version.empty()) {
- MDSInternalContextBase::vec finished;
+ MDSContext::vec finished;
while (!waiting_for_version.empty()) {
auto it = waiting_for_version.begin();
if (it->first > cached_version)
}
}
-void SnapClient::refresh(version_t want, MDSInternalContextBase *onfinish)
+void SnapClient::refresh(version_t want, MDSContext *onfinish)
{
dout(10) << __func__ << " want " << want << dendl;
mds->send_message_mds(req, ts);
}
-void SnapClient::sync(MDSInternalContextBase *onfinish)
+void SnapClient::sync(MDSContext *onfinish)
{
dout(10) << __func__ << dendl;
set<version_t> committing_tids;
- map<version_t, MDSInternalContextBase::vec > waiting_for_version;
+ map<version_t, MDSContext::vec > waiting_for_version;
uint64_t sync_reqid;
bool synced;
void notify_commit(version_t tid) override;
void prepare_create(inodeno_t dirino, std::string_view name, utime_t stamp,
- version_t *pstid, bufferlist *pbl, MDSInternalContextBase *onfinish) {
+ version_t *pstid, bufferlist *pbl, MDSContext *onfinish) {
bufferlist bl;
__u32 op = TABLE_OP_CREATE;
encode(op, bl);
_prepare(bl, pstid, pbl, onfinish);
}
- void prepare_create_realm(inodeno_t ino, version_t *pstid, bufferlist *pbl, MDSInternalContextBase *onfinish) {
+ void prepare_create_realm(inodeno_t ino, version_t *pstid, bufferlist *pbl, MDSContext *onfinish) {
bufferlist bl;
__u32 op = TABLE_OP_CREATE;
encode(op, bl);
_prepare(bl, pstid, pbl, onfinish);
}
- void prepare_destroy(inodeno_t ino, snapid_t snapid, version_t *pstid, bufferlist *pbl, MDSInternalContextBase *onfinish) {
+ void prepare_destroy(inodeno_t ino, snapid_t snapid, version_t *pstid, bufferlist *pbl, MDSContext *onfinish) {
bufferlist bl;
__u32 op = TABLE_OP_DESTROY;
encode(op, bl);
}
void prepare_update(inodeno_t ino, snapid_t snapid, std::string_view name, utime_t stamp,
- version_t *pstid, MDSInternalContextBase *onfinish) {
+ version_t *pstid, MDSContext *onfinish) {
bufferlist bl;
__u32 op = TABLE_OP_UPDATE;
encode(op, bl);
}
version_t get_cached_version() const { return cached_version; }
- void refresh(version_t want, MDSInternalContextBase *onfinish);
+ void refresh(version_t want, MDSContext *onfinish);
- void sync(MDSInternalContextBase *onfinish);
+ void sync(MDSContext *onfinish);
bool is_synced() const { return synced; }
- void wait_for_sync(MDSInternalContextBase *c) {
+ void wait_for_sync(MDSContext *c) {
ceph_assert(!synced);
waiting_for_version[std::max<version_t>(cached_version, 1)].push_back(c);
}
}
}
-struct C_SR_RetryOpenParents : public MDSInternalContextBase {
+struct C_SR_RetryOpenParents : public MDSContext {
SnapRealm *sr;
snapid_t first, last, parent_last;
inodeno_t parent;
- MDSInternalContextBase* fin;
+ MDSContext* fin;
C_SR_RetryOpenParents(SnapRealm *s, snapid_t f, snapid_t l, snapid_t pl,
- inodeno_t p, MDSInternalContextBase *c) :
+ inodeno_t p, MDSContext *c) :
sr(s), first(f), last(l), parent_last(pl), parent(p), fin(c) {
sr->inode->get(CInode::PIN_OPENINGSNAPPARENTS);
}
}
}
-bool SnapRealm::_open_parents(MDSInternalContextBase *finish, snapid_t first, snapid_t last)
+bool SnapRealm::_open_parents(MDSContext *finish, snapid_t first, snapid_t last)
{
dout(10) << "open_parents [" << first << "," << last << "]" << dendl;
if (open)
return true;
}
-bool SnapRealm::open_parents(MDSInternalContextBase *retryorfinish) {
+bool SnapRealm::open_parents(MDSContext *retryorfinish) {
if (!_open_parents(retryorfinish))
return false;
delete retryorfinish;
return false;
}
- bool _open_parents(MDSInternalContextBase *retryorfinish, snapid_t first=1, snapid_t last=CEPH_NOSNAP);
- bool open_parents(MDSInternalContextBase *retryorfinish);
+ bool _open_parents(MDSContext *retryorfinish, snapid_t first=1, snapid_t last=CEPH_NOSNAP);
+ bool open_parents(MDSContext *retryorfinish);
void _remove_missing_parent(snapid_t snapid, inodeno_t parent, int err);
bool have_past_parents_open(snapid_t first=1, snapid_t last=CEPH_NOSNAP) const;
void add_open_past_parent(SnapRealm *parent, snapid_t last);
explicit StrayManagerLogContext(StrayManager *sm_) : sm(sm_) {}
};
-class StrayManagerContext : public virtual MDSInternalContextBase {
+class StrayManagerContext : public virtual MDSContext {
protected:
StrayManager *sm;
MDSRank *get_mds() override
dout(10) << "EFragment.replay " << op_name(op) << " " << ino << " " << basefrag << " by " << bits << dendl;
list<CDir*> resultfrags;
- MDSInternalContextBase::vec waiters;
+ MDSContext::vec waiters;
// in may be NULL if it wasn't in our cache yet. if it's a prepare
// it will be once we replay the metablob , but first we need to