1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2012 Red Hat
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
18 #include "MDSContext.h"
20 #include "common/dout.h"
21 #define dout_context g_ceph_context
22 #define dout_subsys ceph_subsys_mds
24 void MDSInternalContextBase::complete(int r) {
25 MDSRank *mds = get_mds();
27 dout(10) << "MDSInternalContextBase::complete: " << typeid(*this).name() << dendl;
29 assert(mds->mds_lock.is_locked_by_me());
30 MDSContext::complete(r);
34 MDSRank *MDSInternalContext::get_mds() {
38 MDSRank *MDSInternalContextWrapper::get_mds()
43 void MDSInternalContextWrapper::finish(int r)
48 void MDSIOContextBase::complete(int r) {
49 MDSRank *mds = get_mds();
51 dout(10) << "MDSIOContextBase::complete: " << typeid(*this).name() << dendl;
53 Mutex::Locker l(mds->mds_lock);
54 if (mds->is_daemon_stopping()) {
55 dout(4) << "MDSIOContextBase::complete: dropping for stopping "
56 << typeid(*this).name() << dendl;
60 if (r == -EBLACKLISTED) {
61 derr << "MDSIOContextBase: blacklisted! Restarting..." << dendl;
64 MDSContext::complete(r);
68 void MDSLogContextBase::complete(int r) {
69 MDLog *mdlog = get_mds()->mdlog;
70 uint64_t safe_pos = write_pos;
72 // MDSContextBase::complete() free this
73 MDSIOContextBase::complete(r);
74 mdlog->set_safe_pos(safe_pos);
77 MDSRank *MDSIOContext::get_mds() {
81 MDSRank *MDSIOContextWrapper::get_mds() {
85 void MDSIOContextWrapper::finish(int r)
90 void C_IO_Wrapper::complete(int r)
94 get_mds()->finisher->queue(this, r);
96 MDSIOContext::complete(r);
100 MDSRank *MDSInternalContextGather::get_mds()
102 derr << "Forbidden call to MDSInternalContextGather::get_mds by " << typeid(*this).name() << dendl;