From: Yu Kuai Date: Mon, 26 Aug 2024 07:44:13 +0000 (+0800) Subject: md: use new helper md_bitmap_get_stats() in update_array_info() X-Git-Tag: v6.12-rc1~204^2~37^2~1^2~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=968153812215d68c27c0c9d90da6ec2f6d17a606;p=thirdparty%2Fkernel%2Flinux.git md: use new helper md_bitmap_get_stats() in update_array_info() There are no functional changes, avoid dereferencing bitmap directly to prepare inventing a new bitmap. Signed-off-by: Yu Kuai Link: https://lore.kernel.org/r/20240826074452.1490072-4-yukuai1@huaweicloud.com Signed-off-by: Song Liu --- diff --git a/drivers/md/md.c b/drivers/md/md.c index 22731d2717ba3..0cca8d3acfe30 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -7577,15 +7577,17 @@ static int update_array_info(struct mddev *mddev, mdu_array_info_t *info) if (rv) md_bitmap_destroy(mddev); } else { - /* remove the bitmap */ - if (!mddev->bitmap) { - rv = -ENOENT; + struct md_bitmap_stats stats; + + rv = md_bitmap_get_stats(mddev->bitmap, &stats); + if (rv) goto err; - } - if (mddev->bitmap->storage.file) { + + if (stats.file) { rv = -EINVAL; goto err; } + if (mddev->bitmap_info.nodes) { /* hold PW on all the bitmap lock */ if (md_cluster_ops->lock_all_bitmaps(mddev) <= 0) {