OSDN Git Service

md: fix max sectors calculation for super 1.0
authorXiao Ni <xni@redhat.com>
Tue, 30 Jun 2020 07:55:36 +0000 (15:55 +0800)
committerSong Liu <songliubraving@fb.com>
Mon, 3 Aug 2020 06:03:51 +0000 (23:03 -0700)
commitd9c0fa509eafb31605bddda34e2e39f4354563b6
treef7cee21f2490bad7e8c1fe0c3a7cfab25daad174
parenta9e8e18aaf914bf273ed63480c4c3d8dd626c95f
md: fix max sectors calculation for super 1.0

To grow size of super 1.0 raid array, it is necessary to check the device
max usable size.

Now it uses rdev->sectors for max usable size. If one disk is 500G and the
raid device only uses the 100GB of this disk. rdev->sectors can't tell the
real max usable size. The max usable size should be

dev_size-(superblock_size+bitmap_size+badblock_size).

Also, remove unnecessary sb_start update in super_1_rdev_size_change().

Signed-off-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
drivers/md/md.c