]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
btrfs: use appropriate define for the fsid
authorAnand Jain <anand.jain@oracle.com>
Sat, 29 Jul 2017 09:50:09 +0000 (17:50 +0800)
committerDavid Sterba <dsterba@suse.com>
Fri, 18 Aug 2017 14:36:29 +0000 (16:36 +0200)
Though BTRFS_FSID_SIZE and BTRFS_UUID_SIZE are of the same size, we
should use the matching constant for the fsid buffer.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/check-integrity.c
fs/btrfs/disk-io.c
fs/btrfs/scrub.c
fs/btrfs/volumes.c

index 7d65d98d2790d2c3ea69ea320298fe589e8eb4b0..7b9aabc2cb785d1789af28a293f7b2331346d06b 100644 (file)
@@ -1732,7 +1732,7 @@ static int btrfsic_test_for_metadata(struct btrfsic_state *state,
        num_pages = state->metablock_size >> PAGE_SHIFT;
        h = (struct btrfs_header *)datav[0];
 
-       if (memcmp(h->fsid, fs_info->fsid, BTRFS_UUID_SIZE))
+       if (memcmp(h->fsid, fs_info->fsid, BTRFS_FSID_SIZE))
                return 1;
 
        for (i = 0; i < num_pages; i++) {
index c2d3699a70bdb6b50495c47c7b0cf376be5eff15..3715478fffedc47e5a8431b421d20a994db2a0f2 100644 (file)
@@ -529,7 +529,7 @@ static int check_tree_block_fsid(struct btrfs_fs_info *fs_info,
                                 struct extent_buffer *eb)
 {
        struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
-       u8 fsid[BTRFS_UUID_SIZE];
+       u8 fsid[BTRFS_FSID_SIZE];
        int ret = 1;
 
        read_extent_buffer(eb, fsid, btrfs_header_fsid(), BTRFS_FSID_SIZE);
@@ -3681,7 +3681,7 @@ int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors)
                btrfs_set_stack_device_io_width(dev_item, dev->io_width);
                btrfs_set_stack_device_sector_size(dev_item, dev->sector_size);
                memcpy(dev_item->uuid, dev->uuid, BTRFS_UUID_SIZE);
-               memcpy(dev_item->fsid, dev->fs_devices->fsid, BTRFS_UUID_SIZE);
+               memcpy(dev_item->fsid, dev->fs_devices->fsid, BTRFS_FSID_SIZE);
 
                flags = btrfs_super_flags(sb);
                btrfs_set_super_flags(sb, flags | BTRFS_HEADER_FLAG_WRITTEN);
@@ -4120,7 +4120,7 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info)
                ret = -EINVAL;
        }
 
-       if (memcmp(fs_info->fsid, sb->dev_item.fsid, BTRFS_UUID_SIZE) != 0) {
+       if (memcmp(fs_info->fsid, sb->dev_item.fsid, BTRFS_FSID_SIZE) != 0) {
                btrfs_err(fs_info,
                           "dev_item UUID does not match fsid: %pU != %pU",
                           fs_info->fsid, sb->dev_item.fsid);
index f49b94ab3d2adafa9f13fb481340000b7f6a43d4..20c1ba19e66564887b97886d30411a5eafc27ec2 100644 (file)
@@ -1769,7 +1769,7 @@ static inline int scrub_check_fsid(u8 fsid[],
        struct btrfs_fs_devices *fs_devices = spage->dev->fs_devices;
        int ret;
 
-       ret = memcmp(fsid, fs_devices->fsid, BTRFS_UUID_SIZE);
+       ret = memcmp(fsid, fs_devices->fsid, BTRFS_FSID_SIZE);
        return !ret;
 }
 
index 12bd04a4104fa4afefad2e88ffddfcb69d2f0190..ed82edf987f44bc8499121c1f7e19942573134dc 100644 (file)
@@ -1719,7 +1719,7 @@ static int btrfs_add_device(struct btrfs_trans_handle *trans,
        ptr = btrfs_device_uuid(dev_item);
        write_extent_buffer(leaf, device->uuid, ptr, BTRFS_UUID_SIZE);
        ptr = btrfs_device_fsid(dev_item);
-       write_extent_buffer(leaf, fs_info->fsid, ptr, BTRFS_UUID_SIZE);
+       write_extent_buffer(leaf, fs_info->fsid, ptr, BTRFS_FSID_SIZE);
        btrfs_mark_buffer_dirty(leaf);
 
        ret = 0;
@@ -2249,7 +2249,7 @@ static int btrfs_finish_sprout(struct btrfs_trans_handle *trans,
        struct btrfs_dev_item *dev_item;
        struct btrfs_device *device;
        struct btrfs_key key;
-       u8 fs_uuid[BTRFS_UUID_SIZE];
+       u8 fs_uuid[BTRFS_FSID_SIZE];
        u8 dev_uuid[BTRFS_UUID_SIZE];
        u64 devid;
        int ret;
@@ -2292,7 +2292,7 @@ next_slot:
                read_extent_buffer(leaf, dev_uuid, btrfs_device_uuid(dev_item),
                                   BTRFS_UUID_SIZE);
                read_extent_buffer(leaf, fs_uuid, btrfs_device_fsid(dev_item),
-                                  BTRFS_UUID_SIZE);
+                                  BTRFS_FSID_SIZE);
                device = btrfs_find_device(fs_info, devid, dev_uuid, fs_uuid);
                BUG_ON(!device); /* Logic error */
 
@@ -6243,7 +6243,7 @@ struct btrfs_device *btrfs_find_device(struct btrfs_fs_info *fs_info, u64 devid,
        cur_devices = fs_info->fs_devices;
        while (cur_devices) {
                if (!fsid ||
-                   !memcmp(cur_devices->fsid, fsid, BTRFS_UUID_SIZE)) {
+                   !memcmp(cur_devices->fsid, fsid, BTRFS_FSID_SIZE)) {
                        device = find_device(cur_devices, devid, uuid);
                        if (device)
                                return device;
@@ -6518,7 +6518,7 @@ static struct btrfs_fs_devices *open_seed_devices(struct btrfs_fs_info *fs_info,
 
        fs_devices = fs_info->fs_devices->seed;
        while (fs_devices) {
-               if (!memcmp(fs_devices->fsid, fsid, BTRFS_UUID_SIZE))
+               if (!memcmp(fs_devices->fsid, fsid, BTRFS_FSID_SIZE))
                        return fs_devices;
 
                fs_devices = fs_devices->seed;
@@ -6571,16 +6571,16 @@ static int read_one_dev(struct btrfs_fs_info *fs_info,
        struct btrfs_device *device;
        u64 devid;
        int ret;
-       u8 fs_uuid[BTRFS_UUID_SIZE];
+       u8 fs_uuid[BTRFS_FSID_SIZE];
        u8 dev_uuid[BTRFS_UUID_SIZE];
 
        devid = btrfs_device_id(leaf, dev_item);
        read_extent_buffer(leaf, dev_uuid, btrfs_device_uuid(dev_item),
                           BTRFS_UUID_SIZE);
        read_extent_buffer(leaf, fs_uuid, btrfs_device_fsid(dev_item),
-                          BTRFS_UUID_SIZE);
+                          BTRFS_FSID_SIZE);
 
-       if (memcmp(fs_uuid, fs_info->fsid, BTRFS_UUID_SIZE)) {
+       if (memcmp(fs_uuid, fs_info->fsid, BTRFS_FSID_SIZE)) {
                fs_devices = open_seed_devices(fs_info, fs_uuid);
                if (IS_ERR(fs_devices))
                        return PTR_ERR(fs_devices);