Skip to content

Commit 06b6b33

Browse files
Merge pull request ceph#62870 from MaxKellermann/mds_includes
mds: include cleanup Reviewed-by: Patrick Donnelly <[email protected]>
2 parents e05d768 + 2366c19 commit 06b6b33

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1082
-705
lines changed

src/ceph_mds.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "include/random.h"
2727

2828
#include "common/config.h"
29+
#include "common/debug.h"
2930
#include "common/strtol.h"
3031
#include "common/numa.h"
3132

src/mds/Beacon.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
*
1313
*/
1414

15+
#include "Beacon.h"
16+
#include "BatchOp.h"
17+
#include "Server.h"
1518

16-
#include "common/dout.h"
19+
#include "common/debug.h"
1720
#include "common/likely.h"
1821
#include "common/HeartbeatMap.h"
1922

@@ -22,13 +25,12 @@
2225
#include "include/util.h"
2326

2427
#include "mon/MonClient.h"
28+
#include "mds/MDCache.h"
2529
#include "mds/MDLog.h"
2630
#include "mds/MDSRank.h"
27-
#include "mds/MDSMap.h"
2831
#include "mds/Locker.h"
2932
#include "mds/mdstypes.h"
30-
31-
#include "Beacon.h"
33+
#include "osdc/Objecter.h"
3234

3335
#include <chrono>
3436

src/mds/Beacon.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,25 @@
1212
*
1313
*/
1414

15-
1615
#ifndef BEACON_STATE_H
1716
#define BEACON_STATE_H
1817

18+
#include <map>
1919
#include <mutex>
20+
#include <string>
2021
#include <string_view>
2122
#include <thread>
2223

23-
#include "include/types.h"
24-
#include "include/Context.h"
24+
#include "include/common_fwd.h" // for CephContext
25+
#include "mds/MDSMap.h" // for MDSMap::DaemonState
2526
#include "msg/Dispatcher.h"
27+
#include "messages/MMDSBeacon.h" // for struct MDSHealth
2628

27-
#include "messages/MMDSBeacon.h"
28-
29+
class Connection;
30+
class Message;
2931
class MonClient;
3032
class MDSRank;
31-
33+
class MMDSBeacon;
3234

3335
/**
3436
* One of these per MDS. Handle beacon logic in this separate class so

src/mds/CDentry.cc

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,59 @@
1818
#include "CInode.h"
1919
#include "CDir.h"
2020
#include "SnapClient.h"
21-
21+
#include "SnapRealm.h"
22+
#include "BatchOp.h"
2223
#include "MDSRank.h"
2324
#include "MDCache.h"
2425
#include "Locker.h"
2526
#include "LogSegment.h"
2627

2728
#include "messages/MLock.h"
2829

30+
#include "common/debug.h"
31+
#include "common/strescape.h" // for binstrprint()
32+
#include "include/filepath.h"
33+
2934
#define dout_context g_ceph_context
3035
#define dout_subsys ceph_subsys_mds
3136
#undef dout_prefix
3237
#define dout_prefix *_dout << "mds." << dir->mdcache->mds->get_nodeid() << ".cache.den(" << dir->dirfrag() << " " << name << ") "
3338

3439
using namespace std;
3540

41+
CDentry::CDentry(std::string_view n, __u32 h,
42+
mempool::mds_co::string alternate_name,
43+
snapid_t f, snapid_t l) :
44+
hash(h),
45+
first(f), last(l),
46+
item_dirty(this),
47+
lock(this, &lock_type),
48+
versionlock(this, &versionlock_type),
49+
name(n),
50+
alternate_name(std::move(alternate_name))
51+
{}
52+
53+
CDentry::CDentry(std::string_view n, __u32 h,
54+
mempool::mds_co::string alternate_name,
55+
inodeno_t ino, inodeno_t referent_ino,
56+
unsigned char dt, snapid_t f, snapid_t l) :
57+
hash(h),
58+
first(f), last(l),
59+
item_dirty(this),
60+
lock(this, &lock_type),
61+
versionlock(this, &versionlock_type),
62+
name(n),
63+
alternate_name(std::move(alternate_name))
64+
{
65+
linkage.remote_ino = ino;
66+
linkage.remote_d_type = dt;
67+
linkage.referent_ino = referent_ino;
68+
}
69+
70+
CDentry::~CDentry() {
71+
ceph_assert(batch_ops.empty());
72+
}
73+
3674
ostream& CDentry::print_db_line_prefix(ostream& out) const
3775
{
3876
return out << ceph_clock_now() << " mds." << dir->mdcache->mds->get_nodeid() << ".cache.den(" << dir->ino() << " " << name << ") ";

src/mds/CDentry.h

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,21 @@
2323
#include "include/buffer_fwd.h"
2424
#include "include/lru.h"
2525
#include "include/elist.h"
26-
#include "include/filepath.h"
2726
#include <boost/intrusive/set.hpp>
2827

29-
#include "BatchOp.h"
3028
#include "MDSCacheObject.h"
31-
#include "MDSContext.h"
3229
#include "SimpleLock.h"
3330
#include "LocalLockC.h"
34-
#include "ScrubHeader.h"
3531

32+
class filepath;
33+
class BatchOp;
3634
class CInode;
3735
class CDir;
3836
class Locker;
3937
class CDentry;
4038
class LogSegment;
39+
class MDSContext;
40+
4141
class Session;
4242

4343
struct ClientLease : public boost::intrusive::set_base_hook<>
@@ -132,35 +132,13 @@ class CDentry : public MDSCacheObject, public LRUObject, public Counter<CDentry>
132132

133133
CDentry(std::string_view n, __u32 h,
134134
mempool::mds_co::string alternate_name,
135-
snapid_t f, snapid_t l) :
136-
hash(h),
137-
first(f), last(l),
138-
item_dirty(this),
139-
lock(this, &lock_type),
140-
versionlock(this, &versionlock_type),
141-
name(n),
142-
alternate_name(std::move(alternate_name))
143-
{}
135+
snapid_t f, snapid_t l);
144136
CDentry(std::string_view n, __u32 h,
145137
mempool::mds_co::string alternate_name,
146138
inodeno_t ino, inodeno_t referent_ino,
147-
unsigned char dt, snapid_t f, snapid_t l) :
148-
hash(h),
149-
first(f), last(l),
150-
item_dirty(this),
151-
lock(this, &lock_type),
152-
versionlock(this, &versionlock_type),
153-
name(n),
154-
alternate_name(std::move(alternate_name))
155-
{
156-
linkage.remote_ino = ino;
157-
linkage.remote_d_type = dt;
158-
linkage.referent_ino = referent_ino;
159-
}
139+
unsigned char dt, snapid_t f, snapid_t l);
160140

161-
~CDentry() override {
162-
ceph_assert(batch_ops.empty());
163-
}
141+
~CDentry() override;
164142

165143
std::string_view pin_name(int p) const override {
166144
switch (p) {

src/mds/CDir.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@
3030
#include "LogSegment.h"
3131
#include "MDBalancer.h"
3232
#include "SnapClient.h"
33+
#include "SnapRealm.h"
34+
#include "events/EMetaBlob.h"
3335

3436
#include "common/bloom_filter.hpp"
37+
#include "common/debug.h"
3538
#include "common/likely.h"
3639
#include "include/Context.h"
3740
#include "common/Clock.h"
@@ -42,6 +45,8 @@
4245
#include "include/ceph_assert.h"
4346
#include "include/compat.h"
4447

48+
#include "messages/MClientReply.h" // for struct DirStat
49+
4550
#define dout_context g_ceph_context
4651
#define dout_subsys ceph_subsys_mds
4752
#undef dout_prefix
@@ -219,6 +224,8 @@ CDir::CDir(CInode *in, frag_t fg, MDCache *mdc, bool auth) :
219224
state_set(STATE_AUTH);
220225
}
221226

227+
CDir::~CDir() noexcept = default;
228+
222229
/**
223230
* Check the recursive statistics on size for consistency.
224231
* If mds_debug_scatterstat is enabled, assert for correctness,
@@ -861,6 +868,10 @@ bool CDir::is_in_bloom(std::string_view name)
861868
return bloom->contains(name.data(), name.size());
862869
}
863870

871+
void CDir::remove_bloom() {
872+
bloom.reset();
873+
}
874+
864875
void CDir::remove_null_dentries() {
865876
dout(12) << __func__ << " " << *this << dendl;
866877

src/mds/CDir.h

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,24 @@
2222
#include <set>
2323
#include <string>
2424
#include <string_view>
25+
#include <vector>
2526

26-
#include "common/bloom_filter.hpp"
2727
#include "common/config.h"
2828
#include "include/buffer_fwd.h"
2929
#include "include/counter.h"
3030
#include "include/types.h"
3131

32+
#include "snap.h" // for struct sr_t
3233
#include "CInode.h"
3334
#include "MDSCacheObject.h"
34-
#include "MDSContext.h"
35-
#include "cephfs_features.h"
36-
#include "SessionMap.h"
37-
#include "messages/MClientReply.h"
35+
#include "Mutation.h" // for struct MDLockCache
3836

37+
struct DirStat;
38+
struct session_info_t;
39+
class bloom_filter;
3940
class CDentry;
4041
class MDCache;
42+
class MDSContext;
4143

4244
std::ostream& operator<<(std::ostream& out, const class CDir& dir);
4345

@@ -204,6 +206,7 @@ class CDir : public MDSCacheObject, public Counter<CDir> {
204206
static const int DUMP_DEFAULT = DUMP_ALL & (~DUMP_ITEMS);
205207

206208
CDir(CInode *in, frag_t fg, MDCache *mdc, bool auth);
209+
~CDir() noexcept;
207210

208211
std::string_view pin_name(int p) const override {
209212
switch (p) {
@@ -396,15 +399,13 @@ class CDir : public MDSCacheObject, public Counter<CDir> {
396399
void add_to_bloom(CDentry *dn);
397400
bool is_in_bloom(std::string_view name);
398401
bool has_bloom() { return (bloom ? true : false); }
399-
void remove_bloom() {
400-
bloom.reset();
401-
}
402+
void remove_bloom();
402403

403404
void try_remove_dentries_for_stray();
404405
bool try_trim_snap_dentry(CDentry *dn, const std::set<snapid_t>& snaps);
405406

406-
void split(int bits, std::vector<CDir*>* subs, MDSContext::vec& waiters, bool replay);
407-
void merge(const std::vector<CDir*>& subs, MDSContext::vec& waiters, bool replay);
407+
void split(int bits, std::vector<CDir*>* subs, std::vector<MDSContext*>& waiters, bool replay);
408+
void merge(const std::vector<CDir*>& subs, std::vector<MDSContext*>& waiters, bool replay);
408409

409410
bool should_split() const;
410411
bool should_split_fast() const;
@@ -508,10 +509,10 @@ class CDir : public MDSCacheObject, public Counter<CDir> {
508509
return waiting_on_dentry.count(string_snap_t(dname, snap));
509510
}
510511
void add_dentry_waiter(std::string_view dentry, snapid_t snap, MDSContext *c);
511-
void take_dentry_waiting(std::string_view dentry, snapid_t first, snapid_t last, MDSContext::vec& ls);
512+
void take_dentry_waiting(std::string_view dentry, snapid_t first, snapid_t last, std::vector<MDSContext*>& ls);
512513

513514
void add_waiter(uint64_t mask, MDSContext *c) override;
514-
void take_waiting(uint64_t mask, MDSContext::vec& ls) override; // may include dentry waiters
515+
void take_waiting(uint64_t mask, std::vector<MDSContext*>& ls) override; // may include dentry waiters
515516
void finish_waiting(uint64_t mask, int result = 0); // ditto
516517

517518
// -- import/export --
@@ -755,10 +756,10 @@ class CDir : public MDSCacheObject, public Counter<CDir> {
755756
/* If you set up the bloom filter, you must keep it accurate!
756757
* It's deleted when you mark_complete() and is deliberately not serialized.*/
757758

758-
mempool::mds_co::compact_map<version_t, MDSContext::vec_alloc<mempool::mds_co::pool_allocator> > waiting_for_commit;
759+
mempool::mds_co::compact_map<version_t, std::vector<MDSContext*, mempool::mds_co::pool_allocator<MDSContext*>>> waiting_for_commit;
759760

760761
// -- waiters --
761-
mempool::mds_co::map< string_snap_t, MDSContext::vec_alloc<mempool::mds_co::pool_allocator> > waiting_on_dentry; // FIXME string_snap_t not in mempool
762+
mempool::mds_co::map< string_snap_t, std::vector<MDSContext*, mempool::mds_co::pool_allocator<MDSContext*>>> waiting_on_dentry; // FIXME string_snap_t not in mempool
762763

763764
private:
764765
friend std::ostream& operator<<(std::ostream& out, const class CDir& dir);
@@ -779,9 +780,9 @@ class CDir : public MDSCacheObject, public Counter<CDir> {
779780
void remove_null_dentries();
780781

781782
void prepare_new_fragment(bool replay);
782-
void prepare_old_fragment(std::map<string_snap_t, MDSContext::vec >& dentry_waiters, bool replay);
783+
void prepare_old_fragment(std::map<string_snap_t, std::vector<MDSContext*> >& dentry_waiters, bool replay);
783784
void steal_dentry(CDentry *dn); // from another dir. used by merge/split.
784-
void finish_old_fragment(MDSContext::vec& waiters, bool replay);
785+
void finish_old_fragment(std::vector<MDSContext*>& waiters, bool replay);
785786
void init_fragment_pins();
786787
std::string get_path() const;
787788

0 commit comments

Comments
 (0)