lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4e113774-e74f-874f-0e80-256c7bf1b508@huaweicloud.com>
Date: Fri, 14 Feb 2025 11:01:30 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: Yu Kuai <yukuai1@...weicloud.com>, song@...nel.org, agk@...hat.com,
 snitzer@...nel.org, mpatocka@...hat.com
Cc: linux-raid@...r.kernel.org, dm-devel@...ts.linux.dev,
 linux-kernel@...r.kernel.org, yi.zhang@...wei.com, yangerkun@...wei.com,
 "yukuai (C)" <yukuai3@...wei.com>
Subject: Re: [PATCH v3 md-6.15 11/11] md/md-bitmap: introducet
 CONFIG_MD_BITMAP

Hi,

在 2025/01/23 10:07, Yu Kuai 写道:
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 264756a54f59..9451cc5cc574 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -83,6 +83,9 @@ static const char *action_name[NR_SYNC_ACTIONS] = {
>   static LIST_HEAD(pers_list);
>   static DEFINE_SPINLOCK(pers_lock);
>   
> +static LIST_HEAD(bitmap_list);
> +static DEFINE_SPINLOCK(bitmap_lock);
> +
>   static const struct kobj_type md_ktype;
>   
>   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;
>   
>   static int remove_and_add_spares(struct mddev *mddev,
>   				 struct md_rdev *this);
> @@ -650,15 +652,73 @@ static void active_io_release(struct percpu_ref *ref)
>   
>   static void no_op(struct percpu_ref *r) {}
>   
> +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);
> +}
> +
> +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);
> +}
> +
> +static struct bitmap_operations *find_bitmap(int version)
> +{
> +	struct bitmap_operations *op = NULL;
> +	struct bitmap_operations *tmp;
> +
> +	spin_lock(&bitmap_lock);
> +	list_for_each_entry(tmp, &bitmap_list, list) {
> +		if (tmp->version == version) {
> +			op = tmp;
> +			break;
> +		}
> +	}
> +	spin_unlock(&bitmap_lock);
> +
> +	return op;
> +}

Noted that, we already have pers_lock and pers_list for personalities,
md_cluster_ops and md_cluster_mod for md-cluster. Now, add bitmap_lock
and bitmap_list is a bit ugly.

I decided to refactor this a bit, by adding a new struct
md_submodule_head and unify all sub modules registeration,
unregisteration and lookup. Will send a set soon :)

Thanks,
Kuai


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ