summaryrefslogtreecommitdiffstats
path: root/fs/erofs
diff options
context:
space:
mode:
authorHongzhen Luo <hongzhen@linux.alibaba.com>2024-04-09 13:30:22 +0200
committerGao Xiang <hsiangkao@linux.alibaba.com>2024-05-08 11:12:51 +0200
commit1872df8dcd87bd1e623e1a70076d08636b9c473d (patch)
treefa177e05aa0cf8a10e5baf4ad7093ef5a00e8df2 /fs/erofs
parenterofs: add a reserved buffer pool for lz4 decompression (diff)
downloadlinux-1872df8dcd87bd1e623e1a70076d08636b9c473d.tar.xz
linux-1872df8dcd87bd1e623e1a70076d08636b9c473d.zip
erofs: derive fsid from on-disk UUID for .statfs() if possible
Use the superblock's UUID to generate the fsid when it's non-null. Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com> Reviewed-by: Jingbo Xu <jefflexu@linux.alibaba.com> Signed-off-by: Hongzhen Luo <hongzhen@linux.alibaba.com> Link: https://lore.kernel.org/r/20240409113022.74720-1-hongzhen@linux.alibaba.com Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Diffstat (limited to 'fs/erofs')
-rw-r--r--fs/erofs/super.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index c1dae1fb949b..e3438f1a7bac 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -914,22 +914,20 @@ static int erofs_statfs(struct dentry *dentry, struct kstatfs *buf)
{
struct super_block *sb = dentry->d_sb;
struct erofs_sb_info *sbi = EROFS_SB(sb);
- u64 id = 0;
-
- if (!erofs_is_fscache_mode(sb))
- id = huge_encode_dev(sb->s_bdev->bd_dev);
buf->f_type = sb->s_magic;
buf->f_bsize = sb->s_blocksize;
buf->f_blocks = sbi->total_blocks;
buf->f_bfree = buf->f_bavail = 0;
-
buf->f_files = ULLONG_MAX;
buf->f_ffree = ULLONG_MAX - sbi->inos;
-
buf->f_namelen = EROFS_NAME_LEN;
- buf->f_fsid = u64_to_fsid(id);
+ if (uuid_is_null(&sb->s_uuid))
+ buf->f_fsid = u64_to_fsid(erofs_is_fscache_mode(sb) ? 0 :
+ huge_encode_dev(sb->s_bdev->bd_dev));
+ else
+ buf->f_fsid = uuid_to_fsid(sb->s_uuid.b);
return 0;
}