]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - fs/btrfs/volumes.c
Merge branch 'cleanup/blocksize-diet-part2' of git://git.kernel.org/pub/scm/linux...
[mirror_ubuntu-bionic-kernel.git] / fs / btrfs / volumes.c
index 50c5a8762aedfc7bf5be640b96b3eb4622b58f88..0d9bfebdaa4c22cb012e73b15e2ab8818d1bb49e 100644 (file)
@@ -6247,8 +6247,13 @@ int btrfs_read_sys_array(struct btrfs_root *root)
        u32 cur;
        struct btrfs_key key;
 
-       sb = btrfs_find_create_tree_block(root, BTRFS_SUPER_INFO_OFFSET,
-                                         BTRFS_SUPER_INFO_SIZE);
+       ASSERT(BTRFS_SUPER_INFO_SIZE <= root->nodesize);
+       /*
+        * This will create extent buffer of nodesize, superblock size is
+        * fixed to BTRFS_SUPER_INFO_SIZE. If nodesize > sb size, this will
+        * overallocate but we can keep it as-is, only the first page is used.
+        */
+       sb = btrfs_find_create_tree_block(root, BTRFS_SUPER_INFO_OFFSET);
        if (!sb)
                return -ENOMEM;
        btrfs_set_buffer_uptodate(sb);