Skip to content

Commit 1872df8

Browse files
Hongzhen Luohsiangkao
authored andcommitted
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 <[email protected]> Reviewed-by: Jingbo Xu <[email protected]> Signed-off-by: Hongzhen Luo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Gao Xiang <[email protected]>
1 parent 0f6273a commit 1872df8

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

fs/erofs/super.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -914,22 +914,20 @@ static int erofs_statfs(struct dentry *dentry, struct kstatfs *buf)
914914
{
915915
struct super_block *sb = dentry->d_sb;
916916
struct erofs_sb_info *sbi = EROFS_SB(sb);
917-
u64 id = 0;
918-
919-
if (!erofs_is_fscache_mode(sb))
920-
id = huge_encode_dev(sb->s_bdev->bd_dev);
921917

922918
buf->f_type = sb->s_magic;
923919
buf->f_bsize = sb->s_blocksize;
924920
buf->f_blocks = sbi->total_blocks;
925921
buf->f_bfree = buf->f_bavail = 0;
926-
927922
buf->f_files = ULLONG_MAX;
928923
buf->f_ffree = ULLONG_MAX - sbi->inos;
929-
930924
buf->f_namelen = EROFS_NAME_LEN;
931925

932-
buf->f_fsid = u64_to_fsid(id);
926+
if (uuid_is_null(&sb->s_uuid))
927+
buf->f_fsid = u64_to_fsid(erofs_is_fscache_mode(sb) ? 0 :
928+
huge_encode_dev(sb->s_bdev->bd_dev));
929+
else
930+
buf->f_fsid = uuid_to_fsid(sb->s_uuid.b);
933931
return 0;
934932
}
935933

0 commit comments

Comments
 (0)