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

Revert "cleaner: Remove complete_queue" #801

Merged
merged 1 commit into from
Jul 30, 2024
Merged
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
3 changes: 3 additions & 0 deletions src/ocf_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ struct ocf_request {
uint8_t part_evict : 1;
/* !< Some cachelines from request's partition must be evicted */

uint8_t complete_queue : 1;
/* !< Request needs to be completed from the queue context */

uint8_t lock_idx : OCF_METADATA_GLOBAL_LOCK_IDX_BITS;
/* !< Selected global metadata read lock */

Expand Down
28 changes: 23 additions & 5 deletions src/utils/utils_cleaner.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ static struct ocf_request *_ocf_cleaner_alloc_master_req(
/* In master, save completion context and function */
req->priv = attribs->cmpl_context;
req->master_io_req = attribs->cmpl_fn;
req->complete_queue = attribs->cmpl_queue;

/* The count of all requests */
env_atomic_set(&req->master_remaining, 1);
Expand Down Expand Up @@ -177,6 +178,17 @@ static void _ocf_cleaner_set_error(struct ocf_request *req)
master->error = -OCF_ERR_IO;
}

static int _ocf_cleaner_complete(struct ocf_request *master)
{
ocf_req_end_t cmpl;

cmpl = master->master_io_req;
cmpl(master->priv, master->error);
ocf_req_put(master);

return 0;
}

static void _ocf_cleaner_complete_req(struct ocf_request *req)
{
struct ocf_request *master = NULL;
Expand All @@ -203,12 +215,18 @@ static void _ocf_cleaner_complete_req(struct ocf_request *req)

OCF_DEBUG_MSG(req->cache, "All cleaning request completed");

/* Only master contains completion function and priv */
cmpl = master->master_io_req;
cmpl(master->priv, master->error);
if (master->complete_queue) {
ocf_req_get(master);
ocf_engine_push_req_front_cb(master,
_ocf_cleaner_complete, true);
} else {
/* Only master contains completion function and priv */
cmpl = master->master_io_req;
cmpl(master->priv, master->error);

/* For additional get on master allocation */
ocf_req_put(master);
/* For additional get on master allocation */
ocf_req_put(master);
}
robertbaldyga marked this conversation as resolved.
Show resolved Hide resolved
}

static void _ocf_cleaner_on_resume(struct ocf_request *req)
Expand Down
Loading