]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
btrfs: raid56: enable bs > ps support
authorQu Wenruo <wqu@suse.com>
Fri, 14 Nov 2025 08:45:28 +0000 (19:15 +1030)
committerDavid Sterba <dsterba@suse.com>
Tue, 25 Nov 2025 00:48:52 +0000 (01:48 +0100)
The support code for bs > ps is complete, enable it and update
assertions.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c
fs/btrfs/raid56.c

index 0df81a09a3d144cf57c1cde86a3335569219f86e..fe62f5a244f5902d315841c4cf770f976d1845cb 100644 (file)
@@ -3258,12 +3258,6 @@ int btrfs_check_features(struct btrfs_fs_info *fs_info, bool is_rw_mount)
                           PAGE_SIZE, fs_info->sectorsize);
                return -EINVAL;
        }
-       if (fs_info->sectorsize > PAGE_SIZE && btrfs_fs_incompat(fs_info, RAID56)) {
-               btrfs_err(fs_info,
-               "RAID56 is not supported for page size %lu with sectorsize %u",
-                         PAGE_SIZE, fs_info->sectorsize);
-               return -EINVAL;
-       }
 
        /* This can be called by remount, we need to protect the super block. */
        spin_lock(&fs_info->super_lock);
index 4ebb6b6ba4a6ab6147a03f91a446419730c137b3..fca9c73b01ea11740d14f900c52a3d049d90a05c 100644 (file)
@@ -1070,8 +1070,12 @@ static struct btrfs_raid_bio *alloc_rbio(struct btrfs_fs_info *fs_info,
        const unsigned int sector_nsteps = fs_info->sectorsize / step;
        struct btrfs_raid_bio *rbio;
 
-       /* PAGE_SIZE must also be aligned to sectorsize for subpage support */
-       ASSERT(IS_ALIGNED(PAGE_SIZE, fs_info->sectorsize));
+       /*
+        * For bs <= ps cases, ps must be aligned to bs.
+        * For bs > ps cases, bs must be aligned to ps.
+        */
+       ASSERT(IS_ALIGNED(PAGE_SIZE, fs_info->sectorsize) ||
+              IS_ALIGNED(fs_info->sectorsize, PAGE_SIZE));
        /*
         * Our current stripe len should be fixed to 64k thus stripe_nsectors
         * (at most 16) should be no larger than BITS_PER_LONG.
@@ -3014,9 +3018,6 @@ void raid56_parity_cache_data_folios(struct btrfs_raid_bio *rbio,
        unsigned int foffset = 0;
        int ret;
 
-       /* We shouldn't hit RAID56 for bs > ps cases for now. */
-       ASSERT(fs_info->sectorsize <= PAGE_SIZE);
-
        /*
         * If we hit ENOMEM temporarily, but later at
         * raid56_parity_submit_scrub_rbio() time it succeeded, we just do