void Journaler::recover(Context *onread)
{
lock_guard l(lock);
- if (stopping) {
+ if (is_stopping()) {
onread->complete(-EAGAIN);
return;
}
void Journaler::_finish_reread_head(int r, bufferlist& bl, Context *finish)
{
lock_guard l(lock);
- if (stopping) {
+ if (is_stopping()) {
finish->complete(-EAGAIN);
return;
}
void Journaler::_finish_read_head(int r, bufferlist& bl)
{
lock_guard l(lock);
- if (stopping)
+ if (is_stopping())
return;
assert(state == STATE_READHEAD);
C_OnFinisher *onfinish)
{
lock_guard l(lock);
- if (stopping) {
+ if (is_stopping()) {
onfinish->complete(-EAGAIN);
return;
}
void Journaler::_finish_probe_end(int r, uint64_t end)
{
lock_guard l(lock);
- if (stopping)
+ if (is_stopping())
return;
assert(state == STATE_PROBING);
{
// Expect to be called back from finish_reread_head, which already takes lock
// lock is locked
- if (stopping) {
+ if (is_stopping()) {
onfinish->complete(-EAGAIN);
return;
}
void Journaler::_do_flush(unsigned amount)
{
- if (stopping)
+ if (is_stopping())
return;
if (write_pos == flush_pos)
return;
void Journaler::wait_for_flush(Context *onsafe)
{
lock_guard l(lock);
- if (stopping) {
+ if (is_stopping()) {
onsafe->complete(-EAGAIN);
return;
}
void Journaler::flush(Context *onsafe)
{
lock_guard l(lock);
- if (stopping) {
+ if (is_stopping()) {
onsafe->complete(-EAGAIN);
return;
}
void Journaler::_prefetch()
{
- if (stopping)
+ if (is_stopping())
return;
ldout(cct, 10) << "_prefetch" << dendl;
void Journaler::_finish_erase(int data_result, C_OnFinisher *completion)
{
lock_guard l(lock);
- if (stopping) {
+ if (is_stopping()) {
completion->complete(-EAGAIN);
return;
}
void Journaler::wait_for_readable(Context *onreadable)
{
lock_guard l(lock);
- if (stopping) {
+ if (is_stopping()) {
finisher->queue(onreadable, -EAGAIN);
return;
}
void Journaler::_trim()
{
- if (stopping)
+ if (is_stopping())
return;
assert(!readonly);
ldout(cct, 1) << __func__ << dendl;
+ state = STATE_STOPPING;
readable = false;
- stopping = true;
// Kick out anyone reading from journal
error = -EAGAIN;
static const int STATE_ACTIVE = 3;
static const int STATE_REREADHEAD = 4;
static const int STATE_REPROBING = 5;
+ static const int STATE_STOPPING = 6;
int state;
int error;
fetch_len(0), temp_fetch_len(0),
on_readable(0), on_write_error(NULL), called_write_error(false),
expire_pos(0), trimming_pos(0), trimmed_pos(0), readable(false),
- write_iohint(0), stopping(false)
+ write_iohint(0)
{
}
* to -EAGAIN.
*/
void shutdown();
-protected:
- bool stopping;
public:
// Synchronous getters
}
file_layout_t& get_layout() { return layout; }
bool is_active() { return state == STATE_ACTIVE; }
+ bool is_stopping() { return state == STATE_STOPPING; }
int get_error() { return error; }
bool is_readonly() { return readonly; }
bool is_readable();