Skip to content

Commit

Permalink
DAOS-16686 dfuse: Detect matching reads to avoid network access
Browse files Browse the repository at this point in the history
From #15528

If a read matches a current outstanding read then simply
connect the two and when there's a reply from the network
then respond to both requests.

Ashley Pittman <[email protected]>
Required-githooks: true
  • Loading branch information
wangdi1 committed Dec 18, 2024
1 parent e644113 commit fd27521
Show file tree
Hide file tree
Showing 4 changed files with 229 additions and 167 deletions.
10 changes: 9 additions & 1 deletion src/client/dfuse/dfuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,13 @@ 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 active->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;
Expand Down Expand Up @@ -1017,6 +1024,7 @@ struct dfuse_inode_entry {

struct active_inode {
d_list_t chunks;
d_list_t open_reads;
pthread_spinlock_t lock;
struct dfuse_pre_read *readahead;
};
Expand Down Expand Up @@ -1133,7 +1141,7 @@ dfuse_cache_evict_dir(struct dfuse_info *dfuse_info, struct dfuse_inode_entry *i
* Returns true if feature was used.
*/
bool
read_chunk_close(struct active_inode *active);
read_chunk_close(struct dfuse_inode_entry *ie);

/* Metadata caching functions. */

Expand Down
2 changes: 2 additions & 0 deletions src/client/dfuse/dfuse_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,8 @@ dfuse_read_event_size(void *arg, size_t size)
ev->de_sgl.sg_nr = 1;
}

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
5 changes: 3 additions & 2 deletions src/client/dfuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ active_ie_init(struct dfuse_inode_entry *ie, bool *preread)
goto out;
}
D_INIT_LIST_HEAD(&ie->ie_active->chunks);
D_INIT_LIST_HEAD(&ie->ie_active->open_reads);
if (preread && *preread) {
D_ALLOC_PTR(ie->ie_active->readahead);
if (ie->ie_active->readahead) {
Expand Down Expand Up @@ -96,7 +97,7 @@ active_oh_decref(struct dfuse_info *dfuse_info, struct dfuse_obj_hdl *oh)
if (oc != 1)
goto out;

rcb = read_chunk_close(oh->doh_ie->ie_active);
rcb = read_chunk_close(oh->doh_ie);

ah_free(dfuse_info, oh->doh_ie);
out:
Expand All @@ -118,7 +119,7 @@ active_ie_decref(struct dfuse_info *dfuse_info, struct dfuse_inode_entry *ie)
if (oc != 1)
goto out;

read_chunk_close(ie->ie_active);
read_chunk_close(ie);

ah_free(dfuse_info, ie);
out:
Expand Down
Loading

0 comments on commit fd27521

Please sign in to comment.