]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: move btrfs_is_empty_uuid() from ioctl.c into fs.c
authorFilipe Manana <fdmanana@suse.com>
Mon, 16 Dec 2024 12:27:07 +0000 (12:27 +0000)
committerDavid Sterba <dsterba@suse.com>
Mon, 13 Jan 2025 13:53:17 +0000 (14:53 +0100)
It's a generic helper not specific to ioctls and used in several places,
so move it out from ioctl.c and into fs.c. While at it change its return
type from int to bool and declare the loop variable in the loop itself.

This also slightly reduces the module's size.

Before this change:

  $ size fs/btrfs/btrfs.ko
     text    data     bss     dec     hex filename
  1781492  161037   16920 1959449  1de619 fs/btrfs/btrfs.ko

After this change:

  $ size fs/btrfs/btrfs.ko
     text    data     bss     dec     hex filename
  1781340  161037   16920 1959297  1de581 fs/btrfs/btrfs.ko

Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/fs.c
fs/btrfs/fs.h
fs/btrfs/ioctl.c
fs/btrfs/ioctl.h

index 09cfb43580cbf6f7233cff06f918b5872d0f64c9..06a863252a85edee708a6e3eb5d978bc3e478c0a 100644 (file)
@@ -55,6 +55,15 @@ size_t __attribute_const__ btrfs_get_num_csums(void)
        return ARRAY_SIZE(btrfs_csums);
 }
 
+bool __pure btrfs_is_empty_uuid(const u8 *uuid)
+{
+       for (int i = 0; i < BTRFS_UUID_SIZE; i++) {
+               if (uuid[i] != 0)
+                       return false;
+       }
+       return true;
+}
+
 /*
  * Start exclusive operation @type, return true on success.
  */
index b05f2af97140a30562db4fe7adf0c402232df0fd..15c26c6f4d6e4ce45b48607a42df1c64baf88fc2 100644 (file)
@@ -988,6 +988,8 @@ const char *btrfs_super_csum_name(u16 csum_type);
 const char *btrfs_super_csum_driver(u16 csum_type);
 size_t __attribute_const__ btrfs_get_num_csums(void);
 
+bool __pure btrfs_is_empty_uuid(const u8 *uuid);
+
 /* Compatibility and incompatibility defines */
 void __btrfs_set_fs_incompat(struct btrfs_fs_info *fs_info, u64 flag,
                             const char *name);
index 243d08f37c58cbca96c9f4dea2b5fd592f251e2d..415b20801d780b1062b88fb68ee9bede034ead75 100644 (file)
@@ -471,17 +471,6 @@ static noinline int btrfs_ioctl_fitrim(struct btrfs_fs_info *fs_info,
        return ret;
 }
 
-int __pure btrfs_is_empty_uuid(const u8 *uuid)
-{
-       int i;
-
-       for (i = 0; i < BTRFS_UUID_SIZE; i++) {
-               if (uuid[i])
-                       return 0;
-       }
-       return 1;
-}
-
 /*
  * Calculate the number of transaction items to reserve for creating a subvolume
  * or snapshot, not including the inode, directory entries, or parent directory.
index 2b760c8778f882f2c94b5469195b548be545f427..ce915fcda43b58ef58e442f727ab01f0fed7cc4d 100644 (file)
@@ -19,7 +19,6 @@ int btrfs_fileattr_set(struct mnt_idmap *idmap,
                       struct dentry *dentry, struct fileattr *fa);
 int btrfs_ioctl_get_supported_features(void __user *arg);
 void btrfs_sync_inode_flags_to_i_flags(struct inode *inode);
-int __pure btrfs_is_empty_uuid(const u8 *uuid);
 void btrfs_update_ioctl_balance_args(struct btrfs_fs_info *fs_info,
                                     struct btrfs_ioctl_balance_args *bargs);
 int btrfs_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags);