From 0e48ef40df9d58e666a7f93082a09ac4403136a5 Mon Sep 17 00:00:00 2001 From: Cunyin Chang Date: Fri, 5 Jan 2018 22:10:54 +0800 Subject: [PATCH] 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 Reviewed-on: https://review.gerrithub.io/393784 Reviewed-by: Jim Harris Reviewed-by: Ben Walker Tested-by: SPDK Automated Test System --- lib/blobfs/blobfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/blobfs/blobfs.c b/lib/blobfs/blobfs.c index b83c1f5c1..9f8527e9c 100644 --- a/lib/blobfs/blobfs.c +++ b/lib/blobfs/blobfs.c @@ -789,7 +789,7 @@ spdk_fs_file_stat_async(struct spdk_filesystem *fs, const char *name, f = fs_find_file(fs, name); if (f != NULL) { 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); return; }