From: Jaegeuk Kim Date: Fri, 13 Oct 2017 17:27:45 +0000 (-0700) Subject: f2fs: expose some sectors to user in inline data or dentry case X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=5b4267d195dd887c4412e34b5a7365baa741b679;p=openwrt%2Fstaging%2Fblogic.git f2fs: expose some sectors to user in inline data or dentry case If there's some data written through inline data or dentry, we need to shouw st_blocks. This fixes reporting zero blocks even though there is small written data. Cc: stable@vger.kernel.org Reviewed-by: Chao Yu [Jaegeuk Kim: avoid link file for quotacheck] Signed-off-by: Jaegeuk Kim --- diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 9b93aea5cbeb..8fe95f8b16b1 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -686,6 +686,12 @@ int f2fs_getattr(const struct path *path, struct kstat *stat, STATX_ATTR_NODUMP); generic_fillattr(inode, stat); + + /* we need to show initial sectors used for inline_data/dentries */ + if ((S_ISREG(inode->i_mode) && f2fs_has_inline_data(inode)) || + f2fs_has_inline_dentry(inode)) + stat->blocks += (stat->size + 511) >> 9; + return 0; }