blob: b3fe4b562db03d4190db8ab65ccbd51c325e0502 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#pragma once
#include <map>
#include <seastar/core/future.hh>
#include <seastar/core/shared_future.hh>
#include "include/types.h"
#include "crimson/common/type_helpers.h"
#include "crimson/osd/osd_operation.h"
#include "crimson/osd/pg.h"
#include "osd/osd_types.h"
namespace crimson::osd {
class PG;
class PGMap {
struct PGCreationState : BlockerT<PGCreationState> {
static constexpr const char * type_name = "PGCreation";
void dump_detail(Formatter *f) const final;
spg_t pgid;
seastar::shared_promise<Ref<PG>> promise;
bool creating = false;
PGCreationState(spg_t pgid);
PGCreationState(const PGCreationState &) = delete;
PGCreationState(PGCreationState &&) = delete;
PGCreationState &operator=(const PGCreationState &) = delete;
PGCreationState &operator=(PGCreationState &&) = delete;
~PGCreationState();
};
std::map<spg_t, PGCreationState> pgs_creating;
using pgs_t = std::map<spg_t, Ref<PG>>;
pgs_t pgs;
public:
/**
* Get future for pg with a bool indicating whether it's already being
* created.
*/
std::pair<blocking_future<Ref<PG>>, bool> wait_for_pg(spg_t pgid);
/**
* get PG in non-blocking manner
*/
Ref<PG> get_pg(spg_t pgid);
/**
* Set creating
*/
void set_creating(spg_t pgid);
/**
* Set newly created pg
*/
void pg_created(spg_t pgid, Ref<PG> pg);
/**
* Add newly loaded pg
*/
void pg_loaded(spg_t pgid, Ref<PG> pg);
pgs_t& get_pgs() { return pgs; }
const pgs_t& get_pgs() const { return pgs; }
PGMap() = default;
~PGMap();
};
}
|