Skip to content

Commit 856ce1b

Browse files
committed
mds/MD{Cache,SRank}: move classes to Retry{Message,Request}.h
Prepare for eliminating the header dependency on MDSContext.h. Signed-off-by: Max Kellermann <[email protected]>
1 parent cc0647f commit 856ce1b

File tree

11 files changed

+91
-44
lines changed

11 files changed

+91
-44
lines changed

src/mds/Locker.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#include "MDLog.h"
2727
#include "MDSRank.h"
2828
#include "MDSMap.h"
29+
#include "RetryMessage.h"
30+
#include "RetryRequest.h"
2931
#include "SimpleLock.h"
3032
#include "SnapRealm.h"
3133
#include "messages/MClientCaps.h"

src/mds/MDBalancer.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*/
1414

1515
#include "MDBalancer.h"
16+
#include "RetryMessage.h"
1617

1718
#include "include/compat.h"
1819
#include "mdstypes.h"

src/mds/MDCache.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
*/
1414

1515
#include "MDCache.h"
16+
#include "RetryMessage.h"
17+
#include "RetryRequest.h"
1618

1719
#include <errno.h>
1820

src/mds/MDCache.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,26 +1599,6 @@ class MDCache {
15991599
std::chrono::milliseconds quiesce_sleep;
16001600
};
16011601

1602-
class C_MDS_RetryRequest : public MDSInternalContext {
1603-
MDCache *cache;
1604-
MDRequestRef mdr;
1605-
public:
1606-
C_MDS_RetryRequest(MDCache *c, const MDRequestRef& r) :
1607-
MDSInternalContext(c->mds), cache(c), mdr(r) {}
1608-
void finish(int r) override;
1609-
};
1610-
1611-
class CF_MDS_RetryRequestFactory : public MDSContextFactory {
1612-
public:
1613-
CF_MDS_RetryRequestFactory(MDCache *cache, const MDRequestRef& mdr, bool dl) :
1614-
mdcache(cache), mdr(mdr), drop_locks(dl) {}
1615-
MDSContext *build() override;
1616-
private:
1617-
MDCache *mdcache;
1618-
MDRequestRef mdr;
1619-
bool drop_locks;
1620-
};
1621-
16221602
/**
16231603
* Only for contexts called back from an I/O completion
16241604
*

src/mds/MDSRank.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -673,30 +673,6 @@ class MDSRank {
673673
std::atomic_bool m_is_active = false; /* accessed outside mds_lock */
674674
};
675675

676-
class C_MDS_RetryMessage : public MDSInternalContext {
677-
public:
678-
C_MDS_RetryMessage(MDSRank *mds, const cref_t<Message> &m)
679-
: MDSInternalContext(mds), m(m) {}
680-
void finish(int r) override {
681-
get_mds()->retry_dispatch(m);
682-
}
683-
protected:
684-
cref_t<Message> m;
685-
};
686-
687-
class CF_MDS_RetryMessageFactory : public MDSContextFactory {
688-
public:
689-
CF_MDS_RetryMessageFactory(MDSRank *mds, const cref_t<Message> &m)
690-
: mds(mds), m(m) {}
691-
692-
MDSContext *build() {
693-
return new C_MDS_RetryMessage(mds, m);
694-
}
695-
private:
696-
MDSRank *mds;
697-
cref_t<Message> m;
698-
};
699-
700676
/**
701677
* The aspect of MDSRank exposed to MDSDaemon but not subsystems: i.e.
702678
* the service/dispatcher stuff like init/shutdown that subsystems should

src/mds/MDSTableClient.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "MDSMap.h"
1717

1818
#include "MDSContext.h"
19+
#include "RetryMessage.h"
1920
#include "msg/Messenger.h"
2021

2122
#include "messages/MMDSTableRequest.h"

src/mds/Migrator.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "CDir.h"
2020
#include "CDentry.h"
2121
#include "Locker.h"
22+
#include "RetryMessage.h"
2223
#include "Server.h"
2324

2425
#include "MDBalancer.h"

src/mds/RetryMessage.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2+
// vim: ts=8 sw=2 smarttab
3+
/*
4+
* Ceph - scalable distributed file system
5+
*
6+
* Copyright (C) 2015 Red Hat
7+
*
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.
12+
*
13+
*/
14+
15+
#pragma once
16+
17+
#include "MDSContext.h"
18+
#include "MDSRank.h"
19+
#include "msg/Message.h"
20+
21+
class C_MDS_RetryMessage : public MDSInternalContext {
22+
public:
23+
C_MDS_RetryMessage(MDSRank *mds, const cref_t<Message> &m)
24+
: MDSInternalContext(mds), m(m) {}
25+
void finish(int r) override {
26+
get_mds()->retry_dispatch(m);
27+
}
28+
protected:
29+
cref_t<Message> m;
30+
};
31+
32+
class CF_MDS_RetryMessageFactory : public MDSContextFactory {
33+
public:
34+
CF_MDS_RetryMessageFactory(MDSRank *mds, const cref_t<Message> &m)
35+
: mds(mds), m(m) {}
36+
37+
MDSContext *build() {
38+
return new C_MDS_RetryMessage(mds, m);
39+
}
40+
private:
41+
MDSRank *mds;
42+
cref_t<Message> m;
43+
};

src/mds/RetryRequest.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2+
// vim: ts=8 sw=2 smarttab
3+
/*
4+
* Ceph - scalable distributed file system
5+
*
6+
* Copyright (C) 2004-2006 Sage Weil <[email protected]>
7+
*
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.
12+
*
13+
*/
14+
15+
#pragma once
16+
17+
#include "MDCache.h"
18+
#include "MDSContext.h"
19+
20+
class C_MDS_RetryRequest : public MDSInternalContext {
21+
MDCache *cache;
22+
MDRequestRef mdr;
23+
public:
24+
C_MDS_RetryRequest(MDCache *c, const MDRequestRef& r) :
25+
MDSInternalContext(c->mds), cache(c), mdr(r) {}
26+
void finish(int r) override;
27+
};
28+
29+
class CF_MDS_RetryRequestFactory : public MDSContextFactory {
30+
public:
31+
CF_MDS_RetryRequestFactory(MDCache *cache, const MDRequestRef& mdr, bool dl) :
32+
mdcache(cache), mdr(mdr), drop_locks(dl) {}
33+
MDSContext *build() override;
34+
private:
35+
MDCache *mdcache;
36+
MDRequestRef mdr;
37+
bool drop_locks;
38+
};

src/mds/ScrubStack.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include "ScrubStack.h"
1616
#include "CDir.h"
17+
#include "RetryMessage.h"
1718
#include "SnapRealm.h"
1819
#include "common/debug.h"
1920
#include "common/Formatter.h"

0 commit comments

Comments
 (0)