blobfs: fix the length value of file.

In function spdk_fs_file_stat_async, the
stat.size = f->append_pos >= f->length ? f->append_pos : f->length;

but in spdk_file_get_length, we return f->length.

So generally, it should all use the same method to return the file
length, and this patch will fix this issue.

Change-Id: Idb9aa9e737711fcd48ac0075c7f7ffed825fe3b0
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/c/439627
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ziye Yang 2019-01-09 10:43:47 +08:00 committed by Jim Harris
parent 55ce66a0ad
commit 13a58c41ad

View File

@ -1451,9 +1451,13 @@ spdk_file_get_name(struct spdk_file *file)
uint64_t
spdk_file_get_length(struct spdk_file *file)
{
uint64_t length;
assert(file != NULL);
SPDK_DEBUGLOG(SPDK_LOG_BLOBFS, "file=%s length=0x%jx\n", file->name, file->length);
return file->length;
length = file->append_pos >= file->length ? file->append_pos : file->length;
SPDK_DEBUGLOG(SPDK_LOG_BLOBFS, "file=%s length=0x%jx\n", file->name, length);
return length;
}
static void