Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAOS-1 test: test dfuse #15504

Open
wants to merge 1 commit into
base: google/2.6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/cart/README.env
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ This file lists the environment variables used in CaRT.
a file with the pattern <D_CLIENT_METRICS_DUMP_DIR>/<DAOS_JOBID>-<pid>.csv. As a
convenience, setting this variable automatically sets D_CLIENT_METRICS_ENABLE=1.

. D_CLIENT_METRICS_MAX_ENTRY_CNT
Set maximum metrics entry count for client side metrics, which only works if
D_CLIENT_METRICS_ENABLE is set to 1. The value is set to 1024 by default, and it only
needs to be increased if there are more concurrent daos client threads, for example
thread-count for dfuse is more than 20.

D_POST_INIT
(server only) Controls the initial number of requests that are posted on context creation.
When using a transport that supports multi-recv, also controls the maximum size
Expand Down
3 changes: 2 additions & 1 deletion src/client/api/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ daos_fini(void)
D_GOTO(unlock, rc);
}

daos_hhash_fini();

/** clean up all registered per-module metrics */
daos_metrics_fini();
#if BUILD_PIPELINE
Expand All @@ -354,7 +356,6 @@ daos_fini(void)
dc_job_fini();

pl_fini();
daos_hhash_fini();
daos_debug_fini();
module_initialized = 0;
unlock:
Expand Down
11 changes: 8 additions & 3 deletions src/client/api/metrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@
#include <gurt/telemetry_consumer.h>
#include <gurt/telemetry_producer.h>

#define INIT_JOB_NUM 1024
bool daos_client_metric;
bool daos_client_metric_retain;
uint32_t max_entry_cnt = 1024;

#define MAX_IDS_SIZE(num) (num * D_TM_METRIC_SIZE)
static inline uint32_t
client_metrics_shm_size(uint32_t num)
{
return num * D_TM_METRIC_SIZE;
}
/* The client side metrics structure looks like
* root/job_id/pid/....
*/
Expand Down Expand Up @@ -66,8 +70,9 @@ init_root(const char *name, pid_t pid, int flags)
key_t key;
int rc;

d_getenv_uint(DAOS_CLIENT_METRICS_MAX_ENTRY_CNT, &max_entry_cnt);
key = d_tm_cli_pid_key(pid);
rc = d_tm_init_with_name(key, MAX_IDS_SIZE(INIT_JOB_NUM), flags, name);
rc = d_tm_init_with_name(key, client_metrics_shm_size(max_entry_cnt), flags, name);
if (rc != 0) {
DL_ERROR(rc, "failed to initialize root for %s.", name);
return rc;
Expand Down
62 changes: 45 additions & 17 deletions src/client/dfuse/dfuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ struct dfuse_inode_entry;
* when EOF is returned to the kernel. If it's still present on release then it's freed then.
*/
struct dfuse_pre_read {
pthread_mutex_t dra_lock;
struct dfuse_event *dra_ev;
int dra_rc;
};
Expand All @@ -149,8 +148,6 @@ struct dfuse_obj_hdl {
/** the DFS object handle. Not created for directories. */
dfs_obj_t *doh_obj;

struct dfuse_pre_read *doh_readahead;

/** the inode entry for the file */
struct dfuse_inode_entry *doh_ie;

Expand All @@ -176,27 +173,26 @@ struct dfuse_obj_hdl {
* to false), the expected position of the next read and a boolean for if EOF has been
* detected.
*/
off_t doh_linear_read_pos;
bool doh_linear_read;
bool doh_linear_read_eof;

/** True if caching is enabled for this file. */
bool doh_caching;

off_t doh_linear_read_pos;
uint64_t doh_linear_read:1,
doh_linear_read_eof:1,
/** True if caching is enabled for this file. */
doh_caching:1,
/* True if the file handle is writable - used for cache invalidation */
bool doh_writeable;

doh_writeable:1,
/* Track possible kernel cache of readdir on this directory */
/* Set to true if there is any reason the kernel will not use this directory handle as the
* basis for a readdir cache. Includes if seekdir or rewind are used.
*/
bool doh_kreaddir_invalid;
doh_kreaddir_invalid:1,
/* Set to true if readdir calls are made on this handle */
bool doh_kreaddir_started;
doh_kreaddir_started:1,
/* Set to true if readdir calls reach EOF made on this handle */
bool doh_kreaddir_finished;
doh_kreaddir_finished:1,
doh_evict_on_close:1,
doh_readahead_inflight:1;

bool doh_evict_on_close;
int doh_flags;
};

/* Readdir support.
Expand Down Expand Up @@ -401,10 +397,18 @@ struct dfuse_event {
d_iov_t de_iov;
d_sg_list_t de_sgl;
d_list_t de_list;

/* Position in a list of events, this will either be off ie->ie_open_reads or
* de->de_read_slaves
*/
d_list_t de_read_list;
/* List of slave events */
d_list_t de_read_slaves;
struct dfuse_eq *de_eqt;
union {
struct dfuse_obj_hdl *de_oh;
struct dfuse_inode_entry *de_ie;
struct read_chunk_data *de_cd;
};
off_t de_req_position; /**< The file position requested by fuse */
union {
Expand Down Expand Up @@ -474,6 +478,10 @@ struct dfuse_pool {
ACTION(OPEN) \
ACTION(PRE_READ) \
ACTION(READ) \
ACTION(READ_EOF_M) \
ACTION(READ_CON) \
ACTION(READ_BUCKET) \
ACTION(READ_BUCKET_M) \
ACTION(WRITE) \
ACTION(STATFS)

Expand Down Expand Up @@ -1011,6 +1019,13 @@ struct dfuse_inode_entry {

/* Entry on the evict list */
d_list_t ie_evict_entry;

/* ie read lock is used to protect ie_open_reads and ie_readahead */
d_list_t ie_open_reads;
struct dfuse_pre_read *ie_readahead;
pthread_mutex_t ie_read_lock;

struct read_chunk_core *ie_chunk;
};

/* Flush write-back cache writes to a inode. It does this by waiting for and then releasing an
Expand Down Expand Up @@ -1108,6 +1123,13 @@ dfuse_compute_inode(struct dfuse_cont *dfs,
void
dfuse_cache_evict_dir(struct dfuse_info *dfuse_info, struct dfuse_inode_entry *ie);

/* Free any read chunk data for an inode.
*
* Returns true if feature was used.
*/
bool
read_chunk_close(struct dfuse_inode_entry *ie);

/* Metadata caching functions. */

/* Mark the cache as up-to-date from now */
Expand Down Expand Up @@ -1170,8 +1192,13 @@ dfuse_cache_evict(struct dfuse_inode_entry *ie);
bool
dfuse_dcache_get_valid(struct dfuse_inode_entry *ie, double max_age);

int
dfuse_pre_read_init(struct dfuse_info *info, struct dfuse_inode_entry *ie,
struct dfuse_event **evp);

void
dfuse_pre_read(struct dfuse_info *dfuse_info, struct dfuse_obj_hdl *oh);
dfuse_pre_read(struct dfuse_info *dfuse_info, struct dfuse_obj_hdl *oh,
struct dfuse_event *ev);

int
check_for_uns_ep(struct dfuse_info *dfuse_info, struct dfuse_inode_entry *ie, char *attr,
Expand All @@ -1183,6 +1210,7 @@ dfuse_ie_init(struct dfuse_info *dfuse_info, struct dfuse_inode_entry *ie);
#define dfuse_ie_free(_di, _ie) \
do { \
atomic_fetch_sub_relaxed(&(_di)->di_inode_count, 1); \
D_MUTEX_DESTROY(&_ie->ie_read_lock); \
D_FREE(_ie); \
} while (0)

Expand Down
8 changes: 6 additions & 2 deletions src/client/dfuse/dfuse_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,6 @@ dfuse_mcache_get_valid(struct dfuse_inode_entry *ie, double max_age, double *tim
if (timeout)
*timeout = time_left;
}

return use;
}

Expand Down Expand Up @@ -1237,7 +1236,7 @@ dfuse_open_handle_init(struct dfuse_info *dfuse_info, struct dfuse_obj_hdl *oh,
{
oh->doh_dfs = ie->ie_dfs->dfs_ns;
oh->doh_ie = ie;
oh->doh_linear_read = true;
oh->doh_linear_read = 1;
oh->doh_linear_read_pos = 0;
atomic_init(&oh->doh_il_calls, 0);
atomic_init(&oh->doh_write_count, 0);
Expand All @@ -1254,7 +1253,9 @@ dfuse_ie_init(struct dfuse_info *dfuse_info, struct dfuse_inode_entry *ie)
atomic_init(&ie->ie_linear_read, true);
atomic_fetch_add_relaxed(&dfuse_info->di_inode_count, 1);
D_INIT_LIST_HEAD(&ie->ie_evict_entry);
D_INIT_LIST_HEAD(&ie->ie_open_reads);
D_RWLOCK_INIT(&ie->ie_wlock, 0);
D_MUTEX_INIT(&ie->ie_read_lock, 0);
}

void
Expand Down Expand Up @@ -1317,6 +1318,9 @@ dfuse_read_event_size(void *arg, size_t size)
ev->de_sgl.sg_nr = 1;
}

/* D_INIT_LIST_HEAD(&ev->de_read_list); */
D_INIT_LIST_HEAD(&ev->de_read_slaves);

rc = daos_event_init(&ev->de_ev, ev->de_eqt->de_eq, NULL);
if (rc != -DER_SUCCESS) {
return false;
Expand Down
6 changes: 3 additions & 3 deletions src/client/dfuse/dfuse_fuseops.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright 2016-2023 Intel Corporation.
* (C) Copyright 2016-2024 Intel Corporation.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -88,7 +88,7 @@ dfuse_fuse_init(void *arg, struct fuse_conn_info *conn)
DFUSE_TRA_INFO(dfuse_info, "kernel readdir cache support compiled in");

conn->want |= FUSE_CAP_READDIRPLUS;
conn->want |= FUSE_CAP_READDIRPLUS_AUTO;
conn->want &= ~FUSE_CAP_READDIRPLUS_AUTO;

#ifdef FUSE_CAP_CACHE_SYMLINKS
conn->want |= FUSE_CAP_CACHE_SYMLINKS;
Expand Down Expand Up @@ -197,7 +197,7 @@ df_ll_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr, int to_set,

if (handle) {
inode = handle->doh_ie;
handle->doh_linear_read = false;
handle->doh_linear_read = 0;
DFUSE_IE_STAT_ADD(inode, DS_FSETATTR);

} else {
Expand Down
8 changes: 4 additions & 4 deletions src/client/dfuse/ops/create.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright 2016-2023 Intel Corporation.
* (C) Copyright 2016-2024 Intel Corporation.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -170,7 +170,7 @@ dfuse_cb_create(fuse_req_t req, struct dfuse_inode_entry *parent, const char *na
if (flags & O_APPEND)
flags &= ~O_APPEND;

oh->doh_linear_read = false;
oh->doh_linear_read = 0;

if (!dfuse_info->di_multi_user) {
rc = _dfuse_mode_update(req, parent, &mode);
Expand All @@ -192,7 +192,7 @@ dfuse_cb_create(fuse_req_t req, struct dfuse_inode_entry *parent, const char *na
if (rc)
D_GOTO(release, rc);

oh->doh_writeable = true;
oh->doh_writeable = 1;

if (dfs->dfc_data_timeout != 0 || ie->ie_dfs->dfc_data_otoc) {
if (fi->flags & O_DIRECT)
Expand All @@ -205,7 +205,7 @@ dfuse_cb_create(fuse_req_t req, struct dfuse_inode_entry *parent, const char *na
fi_out.direct_io = 0;

if (!fi_out.direct_io)
oh->doh_caching = true;
oh->doh_caching = 1;

fi_out.fh = (uint64_t)oh;

Expand Down
2 changes: 1 addition & 1 deletion src/client/dfuse/ops/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ handle_cont_query_ioctl(struct dfuse_obj_hdl *oh, fuse_req_t req, const void *in
static void
handle_cont_evict_ioctl(fuse_req_t req, struct dfuse_obj_hdl *oh)
{
oh->doh_evict_on_close = true;
oh->doh_evict_on_close = 1;

handle_cont_qe_ioctl_helper(oh, req, NULL);
}
Expand Down
1 change: 1 addition & 0 deletions src/client/dfuse/ops/lookup.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ dfuse_cb_lookup(fuse_req_t req, struct dfuse_inode_entry *parent,
DFUSE_TRA_UP(ie, parent, "inode");

dfuse_ie_init(dfuse_info, ie);
dfuse_dcache_set_time(ie);

ie->ie_parent = parent->ie_stat.st_ino;
ie->ie_dfs = parent->ie_dfs;
Expand Down
Loading
Loading