Skip to content

Commit

Permalink
DAOS-14348 client: GC for pil4dfs dentry cache (#14995)
Browse files Browse the repository at this point in the history
Hotfix of miscellaneous issues:
- invalid type of atomic_flag
- invalid usage of DL_WARN macro

Signed-off-by: Cedric Koch-Hofer <[email protected]>
  • Loading branch information
knard-intel authored Aug 29, 2024
1 parent 663237c commit 3d129b2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
12 changes: 6 additions & 6 deletions src/client/dfuse/pil4dfs/dfs_dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct dfs_dcache {
/** Next Garbage collection date */
struct timespec dd_expire_gc;
/** True iff one thread is running the garbage collection */
_Atomic bool dd_running_gc;
atomic_flag dd_running_gc;
/** Destroy a dfs dir-cache */
destroy_fn_t destroy_fn;
/** Return the dir-cahe record of a given location and insert it if needed */
Expand All @@ -95,7 +95,7 @@ struct dcache_rec {
/** Reference counter used to manage memory deallocation */
_Atomic uint32_t dr_ref;
/** True iff this record was deleted from the hash table*/
_Atomic bool dr_deleted;
atomic_flag dr_deleted;
/** Entry in the garbage collector list */
d_list_t dr_entry_gc;
/** True iff this record is not in the garbage collector list */
Expand Down Expand Up @@ -309,7 +309,7 @@ gc_reclaim(dfs_dcache_t *dcache)
dcache->dd_count_gc);

out_unset:
atomic_store_relaxed(&dcache->dd_running_gc, false);
atomic_flag_clear(&dcache->dd_running_gc);
out:
return rc;
}
Expand Down Expand Up @@ -417,7 +417,7 @@ dcache_add_root(dfs_dcache_t *dcache, dfs_obj_t *obj)

rec->dr_obj = obj;
atomic_init(&rec->dr_ref, 0);
atomic_init(&rec->dr_deleted, false);
atomic_flag_clear(&rec->dr_deleted);
memcpy(&rec->dr_key_child_prefix[0], &dcache->dd_key_root_prefix[0], DCACHE_KEY_PREF_SIZE);
memcpy(&rec->dr_key[0], &dcache->dd_key_root_prefix[0], DCACHE_KEY_PREF_SIZE);
rec->dr_key_len = DCACHE_KEY_PREF_SIZE - 1;
Expand Down Expand Up @@ -470,7 +470,7 @@ dcache_create_act(dfs_t *dfs, uint32_t bits, uint32_t rec_timeout, uint32_t gc_p
rc = D_MUTEX_INIT(&dcache_tmp->dd_mutex_gc, NULL);
if (rc != 0)
D_GOTO(error_mutex, daos_errno2der(rc));
atomic_init(&dcache_tmp->dd_running_gc, false);
atomic_flag_clear(&dcache_tmp->dd_running_gc);
D_INIT_LIST_HEAD(&dcache_tmp->dd_head_gc);

rc = d_hash_table_create_inplace(D_HASH_FT_MUTEX | D_HASH_FT_LRU, bits, NULL,
Expand Down Expand Up @@ -571,7 +571,7 @@ dcache_add(dfs_dcache_t *dcache, dcache_rec_t *parent, const char *name, const c
D_GOTO(error, rc = -DER_NOMEM);

atomic_init(&rec_tmp->dr_ref, 1);
atomic_init(&rec_tmp->dr_deleted, false);
atomic_flag_clear(&rec_tmp->dr_deleted);

rc = dfs_lookup_rel(dcache->dd_dfs, parent->dr_obj, name, O_RDWR, &obj, &mode, NULL);
if (rc != 0)
Expand Down
12 changes: 4 additions & 8 deletions src/client/dfuse/pil4dfs/int_dfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -6776,26 +6776,22 @@ init_myhook(void)
dcache_size_bits = DCACHE_SIZE_BITS;
rc = d_getenv_uint32_t("D_IL_DCACHE_SIZE_BITS", &dcache_size_bits);
if (rc != -DER_SUCCESS && rc != -DER_NONEXIST)
DS_WARN(daos_der2errno(rc),
"'D_IL_DCACHE_SIZE_BITS' env variable could not be used");
DL_WARN(rc, "'D_IL_DCACHE_SIZE_BITS' env variable could not be used");

dcache_rec_timeout = DCACHE_REC_TIMEOUT;
rc = d_getenv_uint32_t("D_IL_DCACHE_REC_TIMEOUT", &dcache_rec_timeout);
if (rc != -DER_SUCCESS && rc != -DER_NONEXIST)
DS_WARN(daos_der2errno(rc),
"'D_IL_DCACHE_REC_TIMEOUT' env variable could not be used");
DL_WARN(rc, "'D_IL_DCACHE_REC_TIMEOUT' env variable could not be used");

dcache_gc_period = DCACHE_GC_PERIOD;
rc = d_getenv_uint32_t("D_IL_DCACHE_GC_PERIOD", &dcache_gc_period);
if (rc != -DER_SUCCESS && rc != -DER_NONEXIST)
DS_WARN(daos_der2errno(rc),
"'D_IL_DCACHE_GC_PERIOD' env variable could not be used");
DL_WARN(rc, "'D_IL_DCACHE_GC_PERIOD' env variable could not be used");

dcache_gc_reclaim_max = DCACHE_GC_RECLAIM_MAX;
rc = d_getenv_uint32_t("D_IL_DCACHE_GC_RECLAIM_MAX", &dcache_gc_reclaim_max);
if (rc != -DER_SUCCESS && rc != -DER_NONEXIST)
DS_WARN(daos_der2errno(rc),
"'D_IL_DCACHE_GC_RECLAIM_MAX' env variable could not be used");
DL_WARN(rc, "'D_IL_DCACHE_GC_RECLAIM_MAX' env variable could not be used");
if (dcache_gc_reclaim_max == 0) {
D_WARN("'D_IL_DCACHE_GC_RECLAIM_MAX' env variable could not be used: value == 0.");
dcache_gc_reclaim_max = DCACHE_GC_RECLAIM_MAX;
Expand Down

0 comments on commit 3d129b2

Please sign in to comment.