blobfs: pass sync_req instead of file as the parameter
This avoids to get the first sync_req in the list, instead of make sure which sync_req we want to make it complete. Also release the request early. Change-Id: If6f9b2ab10f0a93e6c45088d33f2aa78d25f66cb Signed-off-by: Ziye Yang <ziye.yang@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452136 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
dfbbcc74dd
commit
9602ade769
@ -1992,13 +1992,13 @@ static void __check_sync_reqs(struct spdk_file *file);
|
||||
static void
|
||||
__file_cache_finish_sync(void *ctx, int bserrno)
|
||||
{
|
||||
struct spdk_file *file = ctx;
|
||||
struct spdk_fs_request *sync_req;
|
||||
struct spdk_file *file;
|
||||
struct spdk_fs_request *sync_req = ctx;
|
||||
struct spdk_fs_cb_args *sync_args;
|
||||
|
||||
pthread_spin_lock(&file->lock);
|
||||
sync_req = TAILQ_FIRST(&file->sync_requests);
|
||||
sync_args = &sync_req->args;
|
||||
file = sync_args->file;
|
||||
pthread_spin_lock(&file->lock);
|
||||
assert(sync_args->op.sync.offset <= file->length_flushed);
|
||||
spdk_trace_record(TRACE_BLOBFS_XATTR_END, 0, sync_args->op.sync.offset,
|
||||
0, file->trace_arg_name);
|
||||
@ -2007,11 +2007,11 @@ __file_cache_finish_sync(void *ctx, int bserrno)
|
||||
pthread_spin_unlock(&file->lock);
|
||||
|
||||
sync_args->fn.file_op(sync_args->arg, bserrno);
|
||||
__check_sync_reqs(file);
|
||||
|
||||
pthread_spin_lock(&file->lock);
|
||||
free_fs_request(sync_req);
|
||||
pthread_spin_unlock(&file->lock);
|
||||
|
||||
__check_sync_reqs(file);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2036,7 +2036,7 @@ __check_sync_reqs(struct spdk_file *file)
|
||||
pthread_spin_unlock(&file->lock);
|
||||
spdk_trace_record(TRACE_BLOBFS_XATTR_START, 0, file->length_flushed,
|
||||
0, file->trace_arg_name);
|
||||
spdk_blob_sync_md(file->blob, __file_cache_finish_sync, file);
|
||||
spdk_blob_sync_md(file->blob, __file_cache_finish_sync, sync_req);
|
||||
} else {
|
||||
pthread_spin_unlock(&file->lock);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user