blobfs: Add trace for file metadata operation.

The purpose of is patch is to track whether there is
req allocation failure for those file metadata related
operation in order to find the bug.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I171a5b7fca214675fb1356ca650a01eeb20b4c8c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454829
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Ziye Yang 2019-05-17 16:33:30 +08:00 committed by Changpeng Liu
parent 9e68223c81
commit a731731792

View File

@ -718,6 +718,7 @@ iter_cb(void *ctx, struct spdk_blob *blob, int rc)
f = file_alloc(fs);
if (f == NULL) {
SPDK_ERRLOG("Cannot allocate file to handle deleted file on disk\n");
args->fn.fs_op_with_handle(args->arg, fs, -ENOMEM);
free_fs_request(req);
return;
@ -958,6 +959,7 @@ spdk_fs_file_stat(struct spdk_filesystem *fs, struct spdk_fs_thread_ctx *ctx,
req = alloc_fs_request(channel);
if (req == NULL) {
SPDK_ERRLOG("Cannot allocate stat req on file=%s\n", name);
return -ENOMEM;
}
@ -1062,12 +1064,14 @@ spdk_fs_create_file_async(struct spdk_filesystem *fs, const char *name,
file = file_alloc(fs);
if (file == NULL) {
SPDK_ERRLOG("Cannot allocate new file for creation\n");
cb_fn(cb_arg, -ENOMEM);
return;
}
req = alloc_fs_request(fs->md_target.md_fs_channel);
if (req == NULL) {
SPDK_ERRLOG("Cannot allocate create async req for file=%s\n", name);
cb_fn(cb_arg, -ENOMEM);
return;
}
@ -1115,6 +1119,7 @@ spdk_fs_create_file(struct spdk_filesystem *fs, struct spdk_fs_thread_ctx *ctx,
req = alloc_fs_request(channel);
if (req == NULL) {
SPDK_ERRLOG("Cannot allocate req to create file=%s\n", name);
return -ENOMEM;
}
@ -1209,6 +1214,7 @@ spdk_fs_open_file_async(struct spdk_filesystem *fs, const char *name, uint32_t f
req = alloc_fs_request(fs->md_target.md_fs_channel);
if (req == NULL) {
SPDK_ERRLOG("Cannot allocate async open req for file=%s\n", name);
cb_fn(cb_arg, NULL, -ENOMEM);
return;
}
@ -1262,6 +1268,7 @@ spdk_fs_open_file(struct spdk_filesystem *fs, struct spdk_fs_thread_ctx *ctx,
req = alloc_fs_request(channel);
if (req == NULL) {
SPDK_ERRLOG("Cannot allocate req for opening file=%s\n", name);
return -ENOMEM;
}
@ -1347,6 +1354,8 @@ spdk_fs_rename_file_async(struct spdk_filesystem *fs,
req = alloc_fs_request(fs->md_target.md_fs_channel);
if (req == NULL) {
SPDK_ERRLOG("Cannot allocate rename async req for renaming file from %s to %s\n", old_name,
new_name);
cb_fn(cb_arg, -ENOMEM);
return;
}
@ -1401,6 +1410,7 @@ spdk_fs_rename_file(struct spdk_filesystem *fs, struct spdk_fs_thread_ctx *ctx,
req = alloc_fs_request(channel);
if (req == NULL) {
SPDK_ERRLOG("Cannot allocate rename req for file=%s\n", old_name);
return -ENOMEM;
}
@ -1445,14 +1455,14 @@ spdk_fs_delete_file_async(struct spdk_filesystem *fs, const char *name,
f = fs_find_file(fs, name);
if (f == NULL) {
SPDK_DEBUGLOG(SPDK_LOG_BLOBFS, "Cannot find the file=%s to deleted\n", name);
SPDK_ERRLOG("Cannot find the file=%s to deleted\n", name);
cb_fn(cb_arg, -ENOENT);
return;
}
req = alloc_fs_request(fs->md_target.md_fs_channel);
if (req == NULL) {
SPDK_DEBUGLOG(SPDK_LOG_BLOBFS, "Cannot allocate the req for the file=%s to deleted\n", name);
SPDK_ERRLOG("Cannot allocate the req for the file=%s to deleted\n", name);
cb_fn(cb_arg, -ENOMEM);
return;
}
@ -2571,6 +2581,7 @@ _file_sync(struct spdk_file *file, struct spdk_fs_channel *channel,
sync_req = alloc_fs_request(channel);
if (!sync_req) {
SPDK_ERRLOG("Cannot allocate sync req for file=%s\n", file->name);
pthread_spin_unlock(&file->lock);
cb_fn(cb_arg, -ENOMEM);
return;
@ -2579,6 +2590,7 @@ _file_sync(struct spdk_file *file, struct spdk_fs_channel *channel,
flush_req = alloc_fs_request(channel);
if (!flush_req) {
SPDK_ERRLOG("Cannot allocate flush req for file=%s\n", file->name);
pthread_spin_unlock(&file->lock);
cb_fn(cb_arg, -ENOMEM);
return;
@ -2693,6 +2705,7 @@ spdk_file_close_async(struct spdk_file *file, spdk_file_op_complete cb_fn, void
req = alloc_fs_request(file->fs->md_target.md_fs_channel);
if (req == NULL) {
SPDK_ERRLOG("Cannot allocate close async req for file=%s\n", file->name);
cb_fn(cb_arg, -ENOMEM);
return;
}
@ -2724,6 +2737,7 @@ spdk_file_close(struct spdk_file *file, struct spdk_fs_thread_ctx *ctx)
req = alloc_fs_request(channel);
if (req == NULL) {
SPDK_ERRLOG("Cannot allocate close req for file=%s\n", file->name);
return -ENOMEM;
}