From 1c032dd7aa4018d05986e0917cf599bf49342c3a Mon Sep 17 00:00:00 2001 From: Jeff Olivier Date: Fri, 23 Aug 2024 22:04:44 -0600 Subject: [PATCH] DAOS-16445 client: Try cycling different method We've noticed that with 8GB files we fill space pretty quickly. Just trying another method to see if it works any better. Required-githooks: true Signed-off-by: Jeff Olivier --- src/client/dfs/dfs_internal.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/client/dfs/dfs_internal.h b/src/client/dfs/dfs_internal.h index 4aac7a690de1..345c067ea6c6 100644 --- a/src/client/dfs/dfs_internal.h +++ b/src/client/dfs/dfs_internal.h @@ -102,6 +102,15 @@ /** MAX value for the HI OID */ #define MAX_OID_HI ((1UL << 32) - 1) +/** Use a large prime for cycling through all oids */ +#define OID_INC (10009729) + +static inline void +oid_inc(daos_obj_id_t *oid) +{ + oid->hi = (oid->hi + OID_INC) & MAX_OID_HI; +} + typedef uint64_t dfs_magic_t; typedef uint16_t dfs_sb_ver_t; typedef uint16_t dfs_layout_ver_t; @@ -337,7 +346,7 @@ oid_gen(dfs_t *dfs, daos_oclass_id_t oclass, bool file, daos_obj_id_t *oid) D_MUTEX_LOCK(&dfs->lock); /** If we ran out of local OIDs, alloc one from the container */ - if (dfs->oid.hi >= MAX_OID_HI) { + if (dfs->oid.hi == 0) { /** Allocate an OID for the namespace */ rc = daos_cont_alloc_oids(dfs->coh, 1, &dfs->oid.lo, NULL); if (rc) { @@ -345,12 +354,13 @@ oid_gen(dfs_t *dfs, daos_oclass_id_t oclass, bool file, daos_obj_id_t *oid) D_MUTEX_UNLOCK(&dfs->lock); return daos_der2errno(rc); } - dfs->oid.hi = 0; + /** Start with OID_INC so final value will be 0 */ + dfs->oid.hi = OID_INC; } /** set oid and lo, bump the current hi value */ oid->lo = dfs->oid.lo; - oid->hi = dfs->oid.hi++; + oid_inc(&oid); D_MUTEX_UNLOCK(&dfs->lock); /** if a regular file, use UINT64 typed dkeys for the array object */