Thread (12 messages) 12 messages, 3 authors, 2021-11-12

Re: [PATCH 018 of 29] md: Support changing rdev size on running arrays.

From: Markus Hochholdinger <hidden>
Date: 2021-11-11 13:10:15

Hi,

Am Mittwoch, 10. November 2021, 18:51:19 CET schrieb Markus Hochholdinger:
It is working es (I) expected till at least kernel 5.4.158.
It is not working with 5.10.x till 5.15.1.
it is working with
  5.8.18
and is not working with
  5.9.16

Currently I'm looking into the diff md.c between these two kernel versions to 
find the error (I'll try to figure this out):
@@ -2184,13 +2212,22 @@ super_1_rdev_size_change(struct md_rdev *rdev, 
sector_t num_sectors)
                return 0;
        } else {
                /* minor version 0; superblock after data */
-               sector_t sb_start;
-               sb_start = (i_size_read(rdev->bdev->bd_inode) >> 9) - 8*2;
+               sector_t sb_start, bm_space;
+               sector_t dev_size = i_size_read(rdev->bdev->bd_inode) >> 9;
+
+               /* 8K is for superblock */
+               sb_start = dev_size - 8*2;
                sb_start &= ~(sector_t)(4*2 - 1);
-               max_sectors = rdev->sectors + sb_start - rdev->sb_start;
+
+               bm_space = super_1_choose_bm_space(dev_size);
+
+               /* Space that can be used to store date needs to decrease
+                * superblock bitmap space and bad block space(4K)
+                */
+               max_sectors = sb_start - bm_space - 4*2;
+
                if (!num_sectors || num_sectors > max_sectors)
                        num_sectors = max_sectors;
-               rdev->sb_start = sb_start;
        }
        sb = page_address(rdev->sb_page);
        sb->data_size = cpu_to_le64(num_sectors);


-- 
Mfg

Markus Hochholdinger
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help