blobfs: return the correct file length.

If the file have cache data and not flushed, the file length will be
not correct.

Change-Id: Idde23e158c1d010e67579b5d6a8d87d3cfbfed2d
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/393784
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Cunyin Chang 2018-01-05 22:10:54 +08:00 committed by Ben Walker
parent cacfeef389
commit 0e48ef40df

View File

@ -789,7 +789,7 @@ spdk_fs_file_stat_async(struct spdk_filesystem *fs, const char *name,
f = fs_find_file(fs, name); f = fs_find_file(fs, name);
if (f != NULL) { if (f != NULL) {
stat.blobid = f->blobid; stat.blobid = f->blobid;
stat.size = f->length; stat.size = f->append_pos >= f->length ? f->append_pos : f->length;
cb_fn(cb_arg, &stat, 0); cb_fn(cb_arg, &stat, 0);
return; return;
} }