Skip to content

Commit aa166fe

Browse files
committed
DAOS-18164 bio: bump default cluster_sz
Bump default BS cluster size from 32MB to 128MB in md-on-ssd mode, make the cluster size configurable through DAOS_BS_CLUSTER_MB. Signed-off-by: Niu Yawei <[email protected]>
1 parent d9ae7df commit aa166fe

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/bio/bio_xstream.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* (C) Copyright 2018-2024 Intel Corporation.
33
* (C) Copyright 2025 Google LLC
4-
* (C) Copyright 2025 Hewlett Packard Enterprise Development LP
4+
* (C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP
55
*
66
* SPDX-License-Identifier: BSD-2-Clause-Patent
77
*/
@@ -31,8 +31,8 @@
3131

3232
/* These Macros should be turned into DAOS configuration in the future */
3333
#define DAOS_MSG_RING_SZ 4096
34-
/* SPDK blob parameters */
35-
#define DAOS_BS_CLUSTER_SZ (1ULL << 25) /* 32MB */
34+
/* Default cluster size in MB */
35+
#define DAOS_DEFAULT_CLUSTER_MB 128
3636
/* DMA buffer parameters */
3737
#define DAOS_DMA_CHUNK_INIT_PCT 50 /* Default per-xstream init chunks, in percentage */
3838
#define DAOS_DMA_CHUNK_CNT_MAX 128 /* Default per-xstream max chunks, 1GB */
@@ -224,6 +224,7 @@ bio_nvme_init_ext(const char *nvme_conf, int numa_node, unsigned int mem_size,
224224
char *env;
225225
int rc, fd;
226226
unsigned int size_mb = BIO_DMA_CHUNK_MB, io_timeout_secs = 0;
227+
unsigned int cluster_mb = DAOS_DEFAULT_CLUSTER_MB;
227228

228229
if (tgt_nr <= 0) {
229230
D_ERROR("tgt_nr: %u should be > 0\n", tgt_nr);
@@ -323,8 +324,14 @@ bio_nvme_init_ext(const char *nvme_conf, int numa_node, unsigned int mem_size,
323324
D_INFO("Set per-xstream DMA buffer upper bound to %u %uMB chunks, prealloc %u chunks\n",
324325
bio_chk_cnt_max, size_mb, init_chk_cnt());
325326

327+
d_getenv_uint("DAOS_BS_CLUSTER_MB", &cluster_mb);
328+
if (cluster_mb < 32 || cluster_mb > 1024) {
329+
D_WARN("DAOS_BS_CLUSTER_MB %u is invalid, default %u is used\n", cluster_mb,
330+
DAOS_DEFAULT_CLUSTER_MB);
331+
cluster_mb = DAOS_DEFAULT_CLUSTER_MB;
332+
}
326333
spdk_bs_opts_init(&nvme_glb.bd_bs_opts, sizeof(nvme_glb.bd_bs_opts));
327-
nvme_glb.bd_bs_opts.cluster_sz = DAOS_BS_CLUSTER_SZ;
334+
nvme_glb.bd_bs_opts.cluster_sz = (cluster_mb << 20);
328335
nvme_glb.bd_bs_opts.max_channel_ops = BIO_BS_MAX_CHANNEL_OPS;
329336

330337
d_agetenv_str(&env, "VOS_BDEV_CLASS");
@@ -368,8 +375,9 @@ bio_nvme_init_ext(const char *nvme_conf, int numa_node, unsigned int mem_size,
368375
if (!bio_nvme_configured(SMD_DEV_TYPE_META))
369376
nvme_glb.bd_bs_opts.cluster_sz = (1UL << 30); /* 1GB */
370377

371-
D_INFO("MD on SSD is %s\n",
372-
bio_nvme_configured(SMD_DEV_TYPE_META) ? "enabled" : "disabled");
378+
D_INFO("MD on SSD is %s, %u cluster size is used\n",
379+
bio_nvme_configured(SMD_DEV_TYPE_META) ? "enabled" : "disabled",
380+
nvme_glb.bd_bs_opts.cluster_sz);
373381

374382
bio_spdk_inited = true;
375383

0 commit comments

Comments
 (0)