Merge tag 'io_uring-5.15-2021-09-11' of git://git.kernel.dk/linux-block
[linux-2.6-microblaze.git] / fs / btrfs / disk-io.c
index 2f9515d..355ea88 100644 (file)
@@ -3314,6 +3314,30 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
         */
        fs_info->compress_type = BTRFS_COMPRESS_ZLIB;
 
+       /*
+        * Flag our filesystem as having big metadata blocks if they are bigger
+        * than the page size.
+        */
+       if (btrfs_super_nodesize(disk_super) > PAGE_SIZE) {
+               if (!(features & BTRFS_FEATURE_INCOMPAT_BIG_METADATA))
+                       btrfs_info(fs_info,
+                               "flagging fs with big metadata feature");
+               features |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA;
+       }
+
+       /* Set up fs_info before parsing mount options */
+       nodesize = btrfs_super_nodesize(disk_super);
+       sectorsize = btrfs_super_sectorsize(disk_super);
+       stripesize = sectorsize;
+       fs_info->dirty_metadata_batch = nodesize * (1 + ilog2(nr_cpu_ids));
+       fs_info->delalloc_batch = sectorsize * 512 * (1 + ilog2(nr_cpu_ids));
+
+       fs_info->nodesize = nodesize;
+       fs_info->sectorsize = sectorsize;
+       fs_info->sectorsize_bits = ilog2(sectorsize);
+       fs_info->csums_per_leaf = BTRFS_MAX_ITEM_SIZE(fs_info) / fs_info->csum_size;
+       fs_info->stripesize = stripesize;
+
        ret = btrfs_parse_options(fs_info, options, sb->s_flags);
        if (ret) {
                err = ret;
@@ -3340,30 +3364,6 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
        if (features & BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA)
                btrfs_info(fs_info, "has skinny extents");
 
-       /*
-        * flag our filesystem as having big metadata blocks if
-        * they are bigger than the page size
-        */
-       if (btrfs_super_nodesize(disk_super) > PAGE_SIZE) {
-               if (!(features & BTRFS_FEATURE_INCOMPAT_BIG_METADATA))
-                       btrfs_info(fs_info,
-                               "flagging fs with big metadata feature");
-               features |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA;
-       }
-
-       nodesize = btrfs_super_nodesize(disk_super);
-       sectorsize = btrfs_super_sectorsize(disk_super);
-       stripesize = sectorsize;
-       fs_info->dirty_metadata_batch = nodesize * (1 + ilog2(nr_cpu_ids));
-       fs_info->delalloc_batch = sectorsize * 512 * (1 + ilog2(nr_cpu_ids));
-
-       /* Cache block sizes */
-       fs_info->nodesize = nodesize;
-       fs_info->sectorsize = sectorsize;
-       fs_info->sectorsize_bits = ilog2(sectorsize);
-       fs_info->csums_per_leaf = BTRFS_MAX_ITEM_SIZE(fs_info) / fs_info->csum_size;
-       fs_info->stripesize = stripesize;
-
        /*
         * mixed block groups end up with duplicate but slightly offset
         * extent buffers for the same range.  It leads to corruptions