From nobody Mon Nov 25 20:26:30 2024 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3BFD1DDA21; Thu, 24 Oct 2024 13:16:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775793; cv=none; b=IEhQbWhnbJmtDH2q26e+ulVhhWuepK1Q2tLLCy+eWSrhiWI4k5MQsrKDCQE2q1yPoYO/iPFUVhZFXXhoX0V4pUGOaBg81o0qevJCP9GpZHQXyw9CHwxhYsLceorvVzXXFvLMUef7EXv3HpwiUqytjVmw3AOlRcVYS6ytZQQcw+M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775793; c=relaxed/simple; bh=CH+OUBUP4Sw4LEnLaYHVG6Dchwt3bNNNnhLS6z99LZY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sIL6piUc9K0V+pICo1dOfLFm1Nz4PIwV9xZMgVYCVCG0vQIlu2FhOGIxIt9nfWVHOfCG3xe1x4crj0dN4b1U79y3OAILBWxKF5qPqavfRCyAtTTFutvaGdq2W8tT7L85siNWvEmAL2Z//cijDgcTH5m8zvFJcz/wMObEwmD4bJg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4XZ5yG2tQqz4f3nbj; Thu, 24 Oct 2024 21:15:50 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id AA3961A018D; Thu, 24 Oct 2024 21:16:08 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgCXysaWSBpnPGb6Ew--.10198S5; Thu, 24 Oct 2024 21:16:08 +0800 (CST) From: Yu Kuai To: song@kernel.org Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH RFC 1/4] md/md-bitmap: remove the parameter 'init' for bitmap_ops->resize() Date: Thu, 24 Oct 2024 21:13:22 +0800 Message-Id: <20241024131325.2250880-2-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241024131325.2250880-1-yukuai1@huaweicloud.com> References: <20241024131325.2250880-1-yukuai1@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: gCh0CgCXysaWSBpnPGb6Ew--.10198S5 X-Coremail-Antispam: 1UD129KBjvJXoWxJFyxAr15tr1xWw1xKw4kWFg_yoWrKw1Dpa 1xtFy3A343KrW5Wa1UXFykuFyFqw1ktr9rKryxC34fWF9rXrZrZF4rWFWqqF1Dta45XF4a qan8trWUCF1xXFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBG14x267AKxVW5JVWrJwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_Jr4l82xGYIkIc2 x26xkF7I0E14v26r1I6r4UM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0 Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJw A2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAS 0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2 IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0 Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCY1x0262kKe7AKxVWUAVWUtw CF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j 6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64 vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_ Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0x vEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUfDGrUUUUU= X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ Content-Type: text/plain; charset="utf-8" From: Yu Kuai It's set to 'false' for all callers, hence it's useless and can be removed. Signed-off-by: Yu Kuai --- drivers/md/dm-raid.c | 2 +- drivers/md/md-bitmap.c | 5 ++--- drivers/md/md-bitmap.h | 3 +-- drivers/md/md-cluster.c | 2 +- drivers/md/raid1.c | 2 +- drivers/md/raid10.c | 8 ++++---- drivers/md/raid5.c | 2 +- 7 files changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 1e0d3b9b75d6..0ca73b571c7d 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -4069,7 +4069,7 @@ static int raid_preresume(struct dm_target *ti) int chunksize =3D to_bytes(rs->requested_bitmap_chunk_sectors) ?: mddev-= >bitmap_info.chunksize; =20 r =3D mddev->bitmap_ops->resize(mddev, mddev->dev_sectors, - chunksize, false); + chunksize); if (r) DMERR("Failed to resize bitmap"); } diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c index 29da10e6f703..c5e86f9b384f 100644 --- a/drivers/md/md-bitmap.c +++ b/drivers/md/md-bitmap.c @@ -2567,15 +2567,14 @@ static int __bitmap_resize(struct bitmap *bitmap, s= ector_t blocks, return ret; } =20 -static int bitmap_resize(struct mddev *mddev, sector_t blocks, int chunksi= ze, - bool init) +static int bitmap_resize(struct mddev *mddev, sector_t blocks, int chunksi= ze) { struct bitmap *bitmap =3D mddev->bitmap; =20 if (!bitmap) return 0; =20 - return __bitmap_resize(bitmap, blocks, chunksize, init); + return __bitmap_resize(bitmap, blocks, chunksize, false); } =20 static ssize_t diff --git a/drivers/md/md-bitmap.h b/drivers/md/md-bitmap.h index 662e6fc141a7..38425bf4a110 100644 --- a/drivers/md/md-bitmap.h +++ b/drivers/md/md-bitmap.h @@ -73,8 +73,7 @@ struct md_bitmap_stats { struct bitmap_operations { bool (*enabled)(struct mddev *mddev); int (*create)(struct mddev *mddev, int slot); - int (*resize)(struct mddev *mddev, sector_t blocks, int chunksize, - bool init); + int (*resize)(struct mddev *mddev, sector_t blocks, int chunksize); =20 int (*load)(struct mddev *mddev); void (*destroy)(struct mddev *mddev); diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c index 6595f89becdb..67898a02bd3a 100644 --- a/drivers/md/md-cluster.c +++ b/drivers/md/md-cluster.c @@ -630,7 +630,7 @@ static int process_recvd_msg(struct mddev *mddev, struc= t cluster_msg *msg) if (le64_to_cpu(msg->high) !=3D mddev->pers->size(mddev, 0, 0)) ret =3D mddev->bitmap_ops->resize(mddev, le64_to_cpu(msg->high), - 0, false); + 0); break; default: ret =3D -1; diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index cd3e94dceabc..683128122d87 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -3311,7 +3311,7 @@ static int raid1_resize(struct mddev *mddev, sector_t= sectors) mddev->array_sectors > newsize) return -EINVAL; =20 - ret =3D mddev->bitmap_ops->resize(mddev, newsize, 0, false); + ret =3D mddev->bitmap_ops->resize(mddev, newsize, 0); if (ret) return ret; =20 diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index ff73db2f6c41..5bb957946a09 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -4206,7 +4206,7 @@ static int raid10_resize(struct mddev *mddev, sector_= t sectors) mddev->array_sectors > size) return -EINVAL; =20 - ret =3D mddev->bitmap_ops->resize(mddev, size, 0, false); + ret =3D mddev->bitmap_ops->resize(mddev, size, 0); if (ret) return ret; =20 @@ -4475,7 +4475,7 @@ static int raid10_start_reshape(struct mddev *mddev) newsize =3D raid10_size(mddev, 0, conf->geo.raid_disks); =20 if (!mddev_is_clustered(mddev)) { - ret =3D mddev->bitmap_ops->resize(mddev, newsize, 0, false); + ret =3D mddev->bitmap_ops->resize(mddev, newsize, 0); if (ret) goto abort; else @@ -4497,13 +4497,13 @@ static int raid10_start_reshape(struct mddev *mddev) MD_FEATURE_RESHAPE_ACTIVE)) || (oldsize =3D=3D newsize)) goto out; =20 - ret =3D mddev->bitmap_ops->resize(mddev, newsize, 0, false); + ret =3D mddev->bitmap_ops->resize(mddev, newsize, 0); if (ret) goto abort; =20 ret =3D md_cluster_ops->resize_bitmaps(mddev, newsize, oldsize); if (ret) { - mddev->bitmap_ops->resize(mddev, oldsize, 0, false); + mddev->bitmap_ops->resize(mddev, oldsize, 0); goto abort; } } diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index f5ac81dd21b2..58f71c3e1368 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -8327,7 +8327,7 @@ static int raid5_resize(struct mddev *mddev, sector_t= sectors) mddev->array_sectors > newsize) return -EINVAL; =20 - ret =3D mddev->bitmap_ops->resize(mddev, sectors, 0, false); + ret =3D mddev->bitmap_ops->resize(mddev, sectors, 0); if (ret) return ret; =20 --=20 2.39.2 From nobody Mon Nov 25 20:26:30 2024 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A8211DD9C6; Thu, 24 Oct 2024 13:16:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775793; cv=none; b=K4tRpG7wLGCLDmDm4X0WrIXVLIVsCBUBK7GQ45cp2MQ1TynIQh3QM/h8PLGkO1s9v6BDVI3Zl1HKX3QvxSdtcew4N7TCQkWU75URelRpNcZ3sUZ3OJUhvYyrcLU5Xs5kZW8h9waDGTsoh9jIZPHH4wkw+cGdZQXjkMkIOrtBhHc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775793; c=relaxed/simple; bh=e6xpKQqPzxCEs53Nn2VczOxVuFiYJmhAmAwhC3mHKng=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=unJC3Nhy/lUfWGP4Af9Brf+/FFc87gw5dbqumr0+SVbk8BaJgN0WiyZVleyWUh3EWoaIQ1Y0ajXFakaV+miQ45AllejwpZtruckvFkMcSD0atRni/qX1Bb2sDSwlXHfIDszsF5lcC0PqiDLWuADkptsBwe2SnDfuC7OZs8dCF2Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4XZ5yN4n5kz4f3m85; Thu, 24 Oct 2024 21:15:56 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 0C5661A0359; Thu, 24 Oct 2024 21:16:09 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgCXysaWSBpnPGb6Ew--.10198S6; Thu, 24 Oct 2024 21:16:08 +0800 (CST) From: Yu Kuai To: song@kernel.org Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH RFC 2/4] md/md-bitmap: merge md_bitmap_group into bitmap_operations Date: Thu, 24 Oct 2024 21:13:23 +0800 Message-Id: <20241024131325.2250880-3-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241024131325.2250880-1-yukuai1@huaweicloud.com> References: <20241024131325.2250880-1-yukuai1@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: gCh0CgCXysaWSBpnPGb6Ew--.10198S6 X-Coremail-Antispam: 1UD129KBjvJXoWxXFy5CFWktFWrtryDKFy8Xwb_yoW5WryDpF ZrJFy5Zw1rJF45Xa17Z34Uua4rX3s7trZrKFWfCw1F9Fy7XF9xJr48Ga4UAwn0gFy3CFZI qw1Yyw1Uur18WF7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBG14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_Jryl82xGYIkIc2 x26xkF7I0E14v26r4j6ryUM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0 Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJw A2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAS 0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2 IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0 Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCY1x0262kKe7AKxVWUAVWUtw CF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j 6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64 vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_ Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0x vEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUFoGdUUUUU= X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ Content-Type: text/plain; charset="utf-8" From: Yu Kuai Now that all bitmap implementations are internal, it doesn't make sense to export md_bitmap_group anymore. Signed-off-by: Yu Kuai --- drivers/md/md-bitmap.c | 5 ++++- drivers/md/md-bitmap.h | 2 ++ drivers/md/md.c | 6 +++++- drivers/md/md.h | 1 - 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c index c5e86f9b384f..f68eb79e739d 100644 --- a/drivers/md/md-bitmap.c +++ b/drivers/md/md-bitmap.c @@ -2963,7 +2963,8 @@ static struct attribute *md_bitmap_attrs[] =3D { &max_backlog_used.attr, NULL }; -const struct attribute_group md_bitmap_group =3D { + +static struct attribute_group md_bitmap_group =3D { .name =3D "bitmap", .attrs =3D md_bitmap_attrs, }; @@ -2996,6 +2997,8 @@ static struct bitmap_operations bitmap_ops =3D { .copy_from_slot =3D bitmap_copy_from_slot, .set_pages =3D bitmap_set_pages, .free =3D md_bitmap_free, + + .group =3D &md_bitmap_group, }; =20 void mddev_set_bitmap_ops(struct mddev *mddev) diff --git a/drivers/md/md-bitmap.h b/drivers/md/md-bitmap.h index 38425bf4a110..0c19983453c7 100644 --- a/drivers/md/md-bitmap.h +++ b/drivers/md/md-bitmap.h @@ -106,6 +106,8 @@ struct bitmap_operations { sector_t *hi, bool clear_bits); void (*set_pages)(void *data, unsigned long pages); void (*free)(void *data); + + struct attribute_group *group; }; =20 /* the bitmap API */ diff --git a/drivers/md/md.c b/drivers/md/md.c index 35c2e1e761aa..aad9b87cafa0 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -5660,7 +5660,6 @@ static const struct attribute_group md_redundancy_gro= up =3D { =20 static const struct attribute_group *md_attr_groups[] =3D { &md_default_group, - &md_bitmap_group, NULL, }; =20 @@ -5902,6 +5901,11 @@ struct mddev *md_alloc(dev_t dev, char *name) return ERR_PTR(error); } =20 + if (mddev->bitmap_ops && mddev->bitmap_ops->group) + if (sysfs_create_group(&mddev->kobj, mddev->bitmap_ops->group)) + pr_warn("md: cannot register extra bitmap attributes for %s\n", + mdname(mddev)); + kobject_uevent(&mddev->kobj, KOBJ_ADD); mddev->sysfs_state =3D sysfs_get_dirent_safe(mddev->kobj.sd, "array_state= "); mddev->sysfs_level =3D sysfs_get_dirent_safe(mddev->kobj.sd, "level"); diff --git a/drivers/md/md.h b/drivers/md/md.h index 4ba93af36126..a53af8818923 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -753,7 +753,6 @@ struct md_sysfs_entry { ssize_t (*show)(struct mddev *, char *); ssize_t (*store)(struct mddev *, const char *, size_t); }; -extern const struct attribute_group md_bitmap_group; =20 static inline struct kernfs_node *sysfs_get_dirent_safe(struct kernfs_node= *sd, char *name) { --=20 2.39.2 From nobody Mon Nov 25 20:26:30 2024 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F0871D63E2; Thu, 24 Oct 2024 13:16:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775792; cv=none; b=UMORSLENqJyjN0AklDBq9r8NbCjwzcJzvnWZwS8gnjNGomLEmB+DszCtVxvPR31KWoJ5kKWmJ7aKvzRHTTIUcMsEG7X5wStq/LEHLC+jwOVSO7fejAGJBotjOOv3mZyveFxCtdS0cgys6/R6Dc3GqrX3wtv2kErm5hR7TH5Gu38= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775792; c=relaxed/simple; bh=zO7RvLBTIs+27nHVUUBcxq6XQclQgiaZKHPEXC0sr1I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EQokvVmPDBqJVPnX6wwZWqsuRqQjaRvjMry5/FWn2daY+cTuiWtDq9l82S8CDA3zSwz3ZK85zuVPcbf6OQ22/d3X0HB8+SkbbQRzcWNsRPXXGvreATMfLcbVarKBrS57RKJ1UyAcoFnJa6h7ONKTJSpkPNVNsBAtRRsvnqe4Ad4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4XZ5yN71rCz4f3m86; Thu, 24 Oct 2024 21:15:56 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 59B181A0194; Thu, 24 Oct 2024 21:16:09 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgCXysaWSBpnPGb6Ew--.10198S7; Thu, 24 Oct 2024 21:16:09 +0800 (CST) From: Yu Kuai To: song@kernel.org Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH RFC 3/4] md: export some helpers Date: Thu, 24 Oct 2024 21:13:24 +0800 Message-Id: <20241024131325.2250880-4-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241024131325.2250880-1-yukuai1@huaweicloud.com> References: <20241024131325.2250880-1-yukuai1@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: gCh0CgCXysaWSBpnPGb6Ew--.10198S7 X-Coremail-Antispam: 1UD129KBjvJXoWxCF18Wr1kXr4kKrWkWFyDKFg_yoW5Kr47pa yIya45Gr45XrWYgwsrAF4kua4agwn7tFZ7try3C34fWFnIgr1DCF1Fq3WYyr98Ca4furnr X3W5KFy5uw1xWrUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBG14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JrWl82xGYIkIc2 x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0 Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJw A2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAS 0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2 IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0 Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCY1x0262kKe7AKxVWUAVWUtw CF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j 6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64 vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_ Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0x vEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JU9J5rUUUUU= X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ Content-Type: text/plain; charset="utf-8" From: Yu Kuai These helpers are used inside md-bitmap.c, prepare to build it as kernel module first, and perhaps mark it as deprecated after new lockless bitmap is introduced. Signed-off-by: Yu Kuai --- drivers/md/md.c | 15 ++++++--------- drivers/md/md.h | 10 +++++++++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index aad9b87cafa0..d16a3d0f2b90 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -252,6 +252,7 @@ void mddev_create_serial_pool(struct mddev *mddev, stru= ct md_rdev *rdev) } } } +EXPORT_SYMBOL_GPL(mddev_create_serial_pool); =20 /* * Free resource from rdev(s), and destroy serial_info_pool under conditio= ns: @@ -291,6 +292,7 @@ void mddev_destroy_serial_pool(struct mddev *mddev, str= uct md_rdev *rdev) } } } +EXPORT_SYMBOL_GPL(mddev_destroy_serial_pool); =20 static struct ctl_table_header *raid_table_header; =20 @@ -972,15 +974,7 @@ void md_super_write(struct mddev *mddev, struct md_rde= v *rdev, atomic_inc(&mddev->pending_writes); submit_bio(bio); } - -int md_super_wait(struct mddev *mddev) -{ - /* wait for all superblock writes that were scheduled to complete */ - wait_event(mddev->sb_wait, atomic_read(&mddev->pending_writes)=3D=3D0); - if (test_and_clear_bit(MD_SB_NEED_REWRITE, &mddev->sb_flags)) - return -EAGAIN; - return 0; -} +EXPORT_SYMBOL_GPL(md_super_write); =20 int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, struct page *page, blk_opf_t opf, bool metadata_op) @@ -3793,6 +3787,7 @@ int strict_strtoul_scaled(const char *cp, unsigned lo= ng *res, int scale) *res =3D result * int_pow(10, scale - decimals); return 0; } +EXPORT_SYMBOL_GPL(strict_strtoul_scaled); =20 static ssize_t safe_delay_show(struct mddev *mddev, char *page) @@ -8556,6 +8551,7 @@ int md_setup_cluster(struct mddev *mddev, int nodes) mddev->safemode_delay =3D 0; return ret; } +EXPORT_SYMBOL_GPL(md_setup_cluster); =20 void md_cluster_stop(struct mddev *mddev) { @@ -8564,6 +8560,7 @@ void md_cluster_stop(struct mddev *mddev) md_cluster_ops->leave(mddev); module_put(md_cluster_mod); } +EXPORT_SYMBOL_GPL(md_cluster_stop); =20 static int is_mddev_idle(struct mddev *mddev, int init) { diff --git a/drivers/md/md.h b/drivers/md/md.h index a53af8818923..5eaac1d84523 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -869,7 +869,6 @@ void md_free_cloned_bio(struct bio *bio); extern bool __must_check md_flush_request(struct mddev *mddev, struct bio = *bio); extern void md_super_write(struct mddev *mddev, struct md_rdev *rdev, sector_t sector, int size, struct page *page); -extern int md_super_wait(struct mddev *mddev); extern int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, struct page *page, blk_opf_t opf, bool metadata_op); extern void md_do_sync(struct md_thread *thread); @@ -994,6 +993,15 @@ static inline bool mddev_is_dm(struct mddev *mddev) return !mddev->gendisk; } =20 +static inline int md_super_wait(struct mddev *mddev) +{ + /* wait for all superblock writes that were scheduled to complete */ + wait_event(mddev->sb_wait, atomic_read(&mddev->pending_writes) =3D=3D 0); + if (test_and_clear_bit(MD_SB_NEED_REWRITE, &mddev->sb_flags)) + return -EAGAIN; + return 0; +} + static inline void mddev_trace_remap(struct mddev *mddev, struct bio *bio, sector_t sector) { --=20 2.39.2 From nobody Mon Nov 25 20:26:30 2024 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73CEE1DD0DF; Thu, 24 Oct 2024 13:16:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775794; cv=none; b=eUYVxBcxQhse5tnn+LQ+swp4FFEGgSaB0+HQ4ttjAHG5WYCIEeNz+lCgUrQE9reg/ytrg2UAi+OiEet8/UvhvH0NyfQ43Uk5T/VtsdTHaM19vsSfPzDkheAmNqnb2jvQpFBaw1KbPeMvwF2Z8cnMzDQfj1VvQ4d0vnn1BuCCdjU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775794; c=relaxed/simple; bh=5TCr4+PJXAti6vPQyC8JOEF601OifvacV9cqLUGnbE8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LQr9pKILXzi1eFQIaD0Qi/fvJcJQ7NIsCoCDJglTMDxLPpTYN+lgX/5O2s5NpPenXmjczuYZAL2LU1s5izJG9VhzOGzodSEtdhwfVzJmNFNNmqt+kfOW+3p/LU3ghfutWqZEJpGEJSfgdPfP3Iyh8uc+XlVIQacFbr8oUvvumW4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4XZ5yP2NzNz4f3m8D; Thu, 24 Oct 2024 21:15:57 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id AD8521A07B6; Thu, 24 Oct 2024 21:16:09 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgCXysaWSBpnPGb6Ew--.10198S8; Thu, 24 Oct 2024 21:16:09 +0800 (CST) From: Yu Kuai To: song@kernel.org Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH RFC 4/4] md/md-bitmap: support to build md-bitmap as kernel module Date: Thu, 24 Oct 2024 21:13:25 +0800 Message-Id: <20241024131325.2250880-5-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241024131325.2250880-1-yukuai1@huaweicloud.com> References: <20241024131325.2250880-1-yukuai1@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: gCh0CgCXysaWSBpnPGb6Ew--.10198S8 X-Coremail-Antispam: 1UD129KBjvJXoWxuw4kWw15tw17Kr43WrW7Jwb_yoWfAw4rpF 4rJ34rCr45Ja9Iqa1UGFWDuFySgr1kKrZrtryfGwsYkFnrJr9xJF48GFWUt3s8GFWfXFsx Zw4rKryUCr4UuF7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBE14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F 4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq 3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7 IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4U M4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCY1x0262kKe7AKxVWUAV WUtwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v2 6r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2 Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_ Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMI IF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUvYLPUUUUU = X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ Content-Type: text/plain; charset="utf-8" From: Yu Kuai Now that all implementations are internal, it's sensible to build it as kernel module now. Signed-off-by: Yu Kuai --- drivers/md/Kconfig | 15 +++++++ drivers/md/Makefile | 4 +- drivers/md/md-bitmap.c | 28 +++++++++++- drivers/md/md-bitmap.h | 8 +++- drivers/md/md.c | 97 +++++++++++++++++++++++++++++++++++++----- drivers/md/md.h | 1 - 6 files changed, 135 insertions(+), 18 deletions(-) diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig index 1e9db8e4acdf..452d7292b617 100644 --- a/drivers/md/Kconfig +++ b/drivers/md/Kconfig @@ -37,6 +37,21 @@ config BLK_DEV_MD =20 If unsure, say N. =20 +config MD_BITMAP + tristate "RAID bitmap support" + default y + depends on BLK_DEV_MD + help + If you say Y here, support for the write intent bitmap will be + enabled. The bitmap will be used to record the data regions that need + to be resynced after a power failure, preventing a full disk resync. + The bitmap size ranges from 4K to 132K, depending on the array size. + Each bit corresponds to 2 bytes of data and is managed in + self-maintained memory. All bits are protected by a disk-level + spinlock. + + If unsure, say Y. + config MD_AUTODETECT bool "Autodetect RAID arrays during kernel boot" depends on BLK_DEV_MD=3Dy diff --git a/drivers/md/Makefile b/drivers/md/Makefile index 476a214e4bdc..387670f766b7 100644 --- a/drivers/md/Makefile +++ b/drivers/md/Makefile @@ -27,14 +27,14 @@ dm-clone-y +=3D dm-clone-target.o dm-clone-metadata.o dm-verity-y +=3D dm-verity-target.o dm-zoned-y +=3D dm-zoned-target.o dm-zoned-metadata.o dm-zoned-reclaim.o =20 -md-mod-y +=3D md.o md-bitmap.o +md-mod-y +=3D md.o raid456-y +=3D raid5.o raid5-cache.o raid5-ppl.o =20 # Note: link order is important. All raid personalities # and must come before md.o, as they each initialise # themselves, and md.o may use the personalities when it # auto-initialised. - +obj-$(CONFIG_MD_BITMAP) +=3D md-bitmap.o obj-$(CONFIG_MD_RAID0) +=3D raid0.o obj-$(CONFIG_MD_RAID1) +=3D raid1.o obj-$(CONFIG_MD_RAID10) +=3D raid10.o diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c index f68eb79e739d..148a479d32c0 100644 --- a/drivers/md/md-bitmap.c +++ b/drivers/md/md-bitmap.c @@ -212,6 +212,8 @@ struct bitmap { int cluster_slot; }; =20 +static struct workqueue_struct *md_bitmap_wq; + static int __bitmap_resize(struct bitmap *bitmap, sector_t blocks, int chunksize, bool init); =20 @@ -2970,6 +2972,9 @@ static struct attribute_group md_bitmap_group =3D { }; =20 static struct bitmap_operations bitmap_ops =3D { + .version =3D 1, + .owner =3D THIS_MODULE, + .enabled =3D bitmap_enabled, .create =3D bitmap_create, .resize =3D bitmap_resize, @@ -3001,7 +3006,26 @@ static struct bitmap_operations bitmap_ops =3D { .group =3D &md_bitmap_group, }; =20 -void mddev_set_bitmap_ops(struct mddev *mddev) +static int __init bitmap_init(void) +{ + md_bitmap_wq =3D alloc_workqueue("md_bitmap", WQ_MEM_RECLAIM | WQ_UNBOUND, + 0); + if (!md_bitmap_wq) + return -ENOMEM; + + INIT_LIST_HEAD(&bitmap_ops.list); + register_md_bitmap(&bitmap_ops); + return 0; +} + +static void __exit bitmap_exit(void) { - mddev->bitmap_ops =3D &bitmap_ops; + destroy_workqueue(md_bitmap_wq); + unregister_md_bitmap(&bitmap_ops); } + +module_init(bitmap_init); +module_exit(bitmap_exit); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Bitmap for MD"); diff --git a/drivers/md/md-bitmap.h b/drivers/md/md-bitmap.h index 0c19983453c7..9d1bf3c43125 100644 --- a/drivers/md/md-bitmap.h +++ b/drivers/md/md-bitmap.h @@ -71,6 +71,10 @@ struct md_bitmap_stats { }; =20 struct bitmap_operations { + int version; + struct module *owner; + struct list_head list; + bool (*enabled)(struct mddev *mddev); int (*create)(struct mddev *mddev, int slot); int (*resize)(struct mddev *mddev, sector_t blocks, int chunksize); @@ -110,7 +114,7 @@ struct bitmap_operations { struct attribute_group *group; }; =20 -/* the bitmap API */ -void mddev_set_bitmap_ops(struct mddev *mddev); +void register_md_bitmap(struct bitmap_operations *op); +void unregister_md_bitmap(struct bitmap_operations *op); =20 #endif diff --git a/drivers/md/md.c b/drivers/md/md.c index d16a3d0f2b90..09fac65b83b8 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -83,6 +83,9 @@ static const char *action_name[NR_SYNC_ACTIONS] =3D { static LIST_HEAD(pers_list); static DEFINE_SPINLOCK(pers_lock); =20 +static LIST_HEAD(bitmap_list); +static DEFINE_SPINLOCK(bitmap_lock); + static const struct kobj_type md_ktype; =20 const struct md_cluster_operations *md_cluster_ops; @@ -100,7 +103,6 @@ static struct workqueue_struct *md_wq; * workqueue whith reconfig_mutex grabbed. */ static struct workqueue_struct *md_misc_wq; -struct workqueue_struct *md_bitmap_wq; =20 static int remove_and_add_spares(struct mddev *mddev, struct md_rdev *this); @@ -630,15 +632,96 @@ static void active_io_release(struct percpu_ref *ref) =20 static void no_op(struct percpu_ref *r) {} =20 +void register_md_bitmap(struct bitmap_operations *op) +{ + pr_info("md: bitmap version %d registered\n", op->version); + + spin_lock(&bitmap_lock); + list_add_tail(&op->list, &bitmap_list); + spin_unlock(&bitmap_lock); +} +EXPORT_SYMBOL_GPL(register_md_bitmap); + +void unregister_md_bitmap(struct bitmap_operations *op) +{ + pr_info("md: bitmap version %d unregistered\n", op->version); + + spin_lock(&bitmap_lock); + list_del_init(&op->list); + spin_unlock(&bitmap_lock); +} +EXPORT_SYMBOL_GPL(unregister_md_bitmap); + +static struct bitmap_operations *__find_bitmap(int version) +{ + struct bitmap_operations *op; + + list_for_each_entry(op, &bitmap_list, list) + if (op->version =3D=3D version) { + if (try_module_get(op->owner)) + return op; + else + return NULL; + } + + return NULL; +} + +static struct bitmap_operations *find_bitmap(int version) +{ + struct bitmap_operations *op =3D NULL; + + spin_lock(&bitmap_lock); + op =3D __find_bitmap(version); + spin_unlock(&bitmap_lock); + + if (op) + return op; + + if (request_module("md-bitmap") !=3D 0) + return NULL; + + spin_lock(&bitmap_lock); + op =3D __find_bitmap(version); + spin_unlock(&bitmap_lock); + + return op; +} + +/* TODO: support more versions */ +static int mddev_set_bitmap_ops(struct mddev *mddev) +{ + struct bitmap_operations *op =3D find_bitmap(1); + + if (!op) + return -ENODEV; + + mddev->bitmap_ops =3D op; + return 0; +} + +static void mddev_clear_bitmap_ops(struct mddev *mddev) +{ + module_put(mddev->bitmap_ops->owner); + mddev->bitmap_ops =3D NULL; +} + int mddev_init(struct mddev *mddev) { + int ret =3D mddev_set_bitmap_ops(mddev); + + if (ret) + return ret; =20 if (percpu_ref_init(&mddev->active_io, active_io_release, - PERCPU_REF_ALLOW_REINIT, GFP_KERNEL)) + PERCPU_REF_ALLOW_REINIT, GFP_KERNEL)) { + mddev_clear_bitmap_ops(mddev); return -ENOMEM; + } =20 if (percpu_ref_init(&mddev->writes_pending, no_op, PERCPU_REF_ALLOW_REINIT, GFP_KERNEL)) { + mddev_clear_bitmap_ops(mddev); percpu_ref_exit(&mddev->active_io); return -ENOMEM; } @@ -666,7 +749,6 @@ int mddev_init(struct mddev *mddev) mddev->resync_min =3D 0; mddev->resync_max =3D MaxSector; mddev->level =3D LEVEL_NONE; - mddev_set_bitmap_ops(mddev); =20 INIT_WORK(&mddev->sync_work, md_start_sync); INIT_WORK(&mddev->del_work, mddev_delayed_delete); @@ -677,6 +759,7 @@ EXPORT_SYMBOL_GPL(mddev_init); =20 void mddev_destroy(struct mddev *mddev) { + mddev_clear_bitmap_ops(mddev); percpu_ref_exit(&mddev->active_io); percpu_ref_exit(&mddev->writes_pending); } @@ -9898,11 +9981,6 @@ static int __init md_init(void) if (!md_misc_wq) goto err_misc_wq; =20 - md_bitmap_wq =3D alloc_workqueue("md_bitmap", WQ_MEM_RECLAIM | WQ_UNBOUND, - 0); - if (!md_bitmap_wq) - goto err_bitmap_wq; - ret =3D __register_blkdev(MD_MAJOR, "md", md_probe); if (ret < 0) goto err_md; @@ -9921,8 +9999,6 @@ static int __init md_init(void) err_mdp: unregister_blkdev(MD_MAJOR, "md"); err_md: - destroy_workqueue(md_bitmap_wq); -err_bitmap_wq: destroy_workqueue(md_misc_wq); err_misc_wq: destroy_workqueue(md_wq); @@ -10229,7 +10305,6 @@ static __exit void md_exit(void) spin_unlock(&all_mddevs_lock); =20 destroy_workqueue(md_misc_wq); - destroy_workqueue(md_bitmap_wq); destroy_workqueue(md_wq); } =20 diff --git a/drivers/md/md.h b/drivers/md/md.h index 5eaac1d84523..28347fb3af18 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -972,7 +972,6 @@ struct mdu_array_info_s; struct mdu_disk_info_s; =20 extern int mdp_major; -extern struct workqueue_struct *md_bitmap_wq; void md_autostart_arrays(int part); int md_set_array_info(struct mddev *mddev, struct mdu_array_info_s *info); int md_add_new_disk(struct mddev *mddev, struct mdu_disk_info_s *info); --=20 2.39.2