Skip to content

Commit

Permalink
DAOS-16830 pool: Allow setting DAOS_POOL_RF to 0 (#15564) (#15692)
Browse files Browse the repository at this point in the history
Since 0 is the minimum RF, we should allow setting it to 0. We can
revisit naming later.

Signed-off-by: Jeff Olivier <[email protected]>
  • Loading branch information
jolivier23 authored Jan 9, 2025
1 parent cbe65ce commit 32440e4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/admin/env_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Environment variables in this section only apply to the server side.
|DAOS\_DTX\_RPC\_HELPER\_THD|DTX RPC helper threshold. The valid range is [18, unlimited). The default value is 513.|
|DAOS\_DTX\_BATCHED\_ULT\_MAX|The max count of DTX batched commit ULTs. The valid range is [0, unlimited). 0 means to commit DTX synchronously. The default value is 32.|
|DAOS\_FORWARD\_NEIGHBOR|Set to enable I/O forwarding on neighbor xstream in the absence of helper threads.|
|DAOS\_POOL\_RF|Redundancy factor for the pool. The valid range is [1, 4]. The default value is 2.|
|DAOS\_POOL\_RF|Redundancy factor for the pool. The valid range is [0, 4]. The default value is 2.|

## Server and Client environment variables

Expand Down
39 changes: 27 additions & 12 deletions src/pool/srv.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright 2016-2022 Intel Corporation.
* (C) Copyright 2016-2024 Intel Corporation.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand All @@ -21,10 +21,29 @@
#include "srv_layout.h"

bool ec_agg_disabled;
uint32_t pw_rf; /* pool wise RF */
#define PW_RF_DEFAULT (2)
#define PW_RF_MIN (1)
#define PW_RF_MAX (4)
uint32_t pw_rf = -1; /* pool wise redundancy factor */
#define PW_RF_DEFAULT (2)
#define PW_RF_MIN (0)
#define PW_RF_MAX (4)

static inline bool
check_pool_redundancy_factor(const char *variable)
{
d_getenv_uint32_t(variable, &pw_rf);
if (pw_rf == -1)
return false;

D_INFO("Checked threshold %s=%d\n", variable, pw_rf);

if (pw_rf <= PW_RF_MAX)
return true;

D_INFO("pw_rf %d is out of range [%d, %d], take default %d\n", pw_rf, PW_RF_MIN, PW_RF_MAX,
PW_RF_DEFAULT);
pw_rf = PW_RF_DEFAULT;

return true;
}

static int
init(void)
Expand Down Expand Up @@ -52,14 +71,10 @@ init(void)
if (unlikely(ec_agg_disabled))
D_WARN("EC aggregation is disabled.\n");

pw_rf = PW_RF_DEFAULT;
d_getenv_uint32_t("DAOS_POOL_RF", &pw_rf);
if (pw_rf < PW_RF_MIN || pw_rf > PW_RF_MAX) {
D_INFO("pw_rf %d is out of range [%d, %d], take default %d\n",
pw_rf, PW_RF_MIN, PW_RF_MAX, PW_RF_DEFAULT);
pw_rf = -1;
if (!check_pool_redundancy_factor("DAOS_POOL_RF"))
pw_rf = PW_RF_DEFAULT;
}
D_INFO("pool wise RF %d\n", pw_rf);
D_INFO("pool redundancy factor %d\n", pw_rf);

ds_pool_rsvc_class_register();

Expand Down

0 comments on commit 32440e4

Please sign in to comment.