Skip to content

Commit d4c8950

Browse files
committed
common/mclock_common: move profile defaults to header
Signed-off-by: Samuel Just <[email protected]>
1 parent 785976e commit d4c8950

File tree

2 files changed

+58
-51
lines changed

2 files changed

+58
-51
lines changed

src/common/mclock_common.cc

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -187,64 +187,16 @@ void MclockConfig::set_config_defaults_from_profile()
187187
return;
188188
}
189189

190-
/**
191-
* high_client_ops
192-
*
193-
* Client Allocation:
194-
* reservation: 60% | weight: 2 | limit: 0 (max) |
195-
* Background Recovery Allocation:
196-
* reservation: 40% | weight: 1 | limit: 0 (max) |
197-
* Background Best Effort Allocation:
198-
* reservation: 0 (min) | weight: 1 | limit: 70% |
199-
*/
200-
static constexpr profile_t high_client_ops_profile{
201-
{ .6, 2, 0 },
202-
{ .4, 1, 0 },
203-
{ 0, 1, .7 }
204-
};
205-
206-
/**
207-
* high_recovery_ops
208-
*
209-
* Client Allocation:
210-
* reservation: 30% | weight: 1 | limit: 0 (max) |
211-
* Background Recovery Allocation:
212-
* reservation: 70% | weight: 2 | limit: 0 (max) |
213-
* Background Best Effort Allocation:
214-
* reservation: 0 (min) | weight: 1 | limit: 0 (max) |
215-
*/
216-
static constexpr profile_t high_recovery_ops_profile{
217-
{ .3, 1, 0 },
218-
{ .7, 2, 0 },
219-
{ 0, 1, 0 }
220-
};
221-
222-
/**
223-
* balanced
224-
*
225-
* Client Allocation:
226-
* reservation: 50% | weight: 1 | limit: 0 (max) |
227-
* Background Recovery Allocation:
228-
* reservation: 50% | weight: 1 | limit: 0 (max) |
229-
* Background Best Effort Allocation:
230-
* reservation: 0 (min) | weight: 1 | limit: 90% |
231-
*/
232-
static constexpr profile_t balanced_profile{
233-
{ .5, 1, 0 },
234-
{ .5, 1, 0 },
235-
{ 0, 1, .9 }
236-
};
237-
238190
const profile_t *profile = nullptr;
239191
auto mclock_profile = cct->_conf.get_val<std::string>("osd_mclock_profile");
240192
if (mclock_profile == "high_client_ops") {
241-
profile = &high_client_ops_profile;
193+
profile = &HIGH_CLIENT_OPS;
242194
dout(10) << "Setting high_client_ops profile " << *profile << dendl;
243195
} else if (mclock_profile == "high_recovery_ops") {
244-
profile = &high_recovery_ops_profile;
196+
profile = &HIGH_RECOVERY_OPS;
245197
dout(10) << "Setting high_recovery_ops profile " << *profile << dendl;
246198
} else if (mclock_profile == "balanced") {
247-
profile = &balanced_profile;
199+
profile = &BALANCED;
248200
dout(10) << "Setting balanced profile " << *profile << dendl;
249201
} else if (mclock_profile == "custom") {
250202
dout(10) << "Profile set to custom, not setting defaults" << dendl;

src/common/mclock_common.h

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,61 @@ struct profile_t {
8080
client_config_t client;
8181
client_config_t background_recovery;
8282
client_config_t background_best_effort;
83+
84+
constexpr profile_t(
85+
client_config_t client,
86+
client_config_t background_recovery,
87+
client_config_t background_best_effort
88+
) : client(client), background_recovery(background_recovery),
89+
background_best_effort(background_best_effort) {}
90+
};
91+
92+
/**
93+
* high_client_ops
94+
*
95+
* Client Allocation:
96+
* reservation: 60% | weight: 2 | limit: 0 (max) |
97+
* Background Recovery Allocation:
98+
* reservation: 40% | weight: 1 | limit: 0 (max) |
99+
* Background Best Effort Allocation:
100+
* reservation: 0 (min) | weight: 1 | limit: 70% |
101+
*/
102+
constexpr profile_t HIGH_CLIENT_OPS{
103+
{ .6, 2, 0 },
104+
{ .4, 1, 0 },
105+
{ 0, 1, .7 }
106+
};
107+
108+
/**
109+
* high_recovery_ops
110+
*
111+
* Client Allocation:
112+
* reservation: 30% | weight: 1 | limit: 0 (max) |
113+
* Background Recovery Allocation:
114+
* reservation: 70% | weight: 2 | limit: 0 (max) |
115+
* Background Best Effort Allocation:
116+
* reservation: 0 (min) | weight: 1 | limit: 0 (max) |
117+
*/
118+
constexpr profile_t HIGH_RECOVERY_OPS{
119+
{ .3, 1, 0 },
120+
{ .7, 2, 0 },
121+
{ 0, 1, 0 }
122+
};
123+
124+
/**
125+
* balanced
126+
*
127+
* Client Allocation:
128+
* reservation: 50% | weight: 1 | limit: 0 (max) |
129+
* Background Recovery Allocation:
130+
* reservation: 50% | weight: 1 | limit: 0 (max) |
131+
* Background Best Effort Allocation:
132+
* reservation: 0 (min) | weight: 1 | limit: 90% |
133+
*/
134+
constexpr profile_t BALANCED{
135+
{ .5, 1, 0 },
136+
{ .5, 1, 0 },
137+
{ 0, 1, .9 }
83138
};
84139

85140
struct client_profile_id_t {

0 commit comments

Comments
 (0)