]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
f2fs: expose some sectors to user in inline data or dentry case
authorJaegeuk Kim <jaegeuk@kernel.org>
Fri, 13 Oct 2017 17:27:45 +0000 (10:27 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 26 Oct 2017 08:44:15 +0000 (10:44 +0200)
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 <yuchao0@huawei.com>
[Jaegeuk Kim: avoid link file for quotacheck]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/file.c

index 9b93aea5cbeb37ea0f4db5ec99d4d92d4c22ea88..8fe95f8b16b123f0716a529ec310875cf4f548c3 100644 (file)
@@ -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;
 }