bcachefs: Switch to uuid_to_fsid()
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 3 Feb 2024 20:05:17 +0000 (15:05 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 10 Mar 2024 19:34:09 +0000 (15:34 -0400)
switch the statfs code from something horrible and open coded to the
more standard uuid_to_fsid()

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/fs.c

index 77ae65542db9166a4168a78a55064295bb1d9ebf..ec9cf4b8faf1ba783d1091d7c93b2874024ad025 100644 (file)
@@ -1572,7 +1572,6 @@ static int bch2_statfs(struct dentry *dentry, struct kstatfs *buf)
         * number:
         */
        u64 avail_inodes = ((usage.capacity - usage.used) << 3);
-       u64 fsid;
 
        buf->f_type     = BCACHEFS_STATFS_MAGIC;
        buf->f_bsize    = sb->s_blocksize;
@@ -1583,10 +1582,7 @@ static int bch2_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_files    = usage.nr_inodes + avail_inodes;
        buf->f_ffree    = avail_inodes;
 
-       fsid = le64_to_cpup((void *) c->sb.user_uuid.b) ^
-              le64_to_cpup((void *) c->sb.user_uuid.b + sizeof(u64));
-       buf->f_fsid.val[0] = fsid & 0xFFFFFFFFUL;
-       buf->f_fsid.val[1] = (fsid >> 32) & 0xFFFFFFFFUL;
+       buf->f_fsid     = uuid_to_fsid(c->sb.user_uuid.b);
        buf->f_namelen  = BCH_NAME_MAX;
 
        return 0;