diff options
author | Yu Kuai <yukuai3@huawei.com> | 2023-08-25 06:09:51 +0300 |
---|---|---|
committer | Song Liu <song@kernel.org> | 2023-09-22 20:28:26 +0300 |
commit | b8494823e236326500aa1004155e83f748dd10da (patch) | |
tree | 6985b36a3aafce55c2b067534f7e90ed28024c21 /drivers/md/md.h | |
parent | d58eff83bd3c6166944f6b159544438385d48549 (diff) | |
download | linux-b8494823e236326500aa1004155e83f748dd10da.tar.xz |
md: initialize 'writes_pending' while allocating mddev
Currently 'writes_pending' is initialized in pers->run for raid1/5/10,
and it's freed while deleing mddev, instead of pers->free. pers->run can
be called multiple times before mddev is deleted, and a helper
mddev_init_writes_pending() is used to prevent 'writes_pending' to be
initialized multiple times, this usage is safe but a litter weird.
On the other hand, 'writes_pending' is only initialized for raid1/5/10,
however, it's used in common layer, for example:
array_state_store
set_in_sync
if (!mddev->in_sync) -> in_sync is used for all levels
// access writes_pending
There might be some implicit dependency that I don't recognized to make
sure 'writes_pending' can only be accessed for raid1/5/10, but there are
no comments about that.
By the way, it make sense to initialize 'writes_pending' in common layer
because there are already three levels use it.
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20230825030956.1527023-3-yukuai1@huaweicloud.com
Diffstat (limited to 'drivers/md/md.h')
-rw-r--r-- | drivers/md/md.h | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/drivers/md/md.h b/drivers/md/md.h index 3344c47f8544..b628c292506e 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -771,7 +771,6 @@ extern void md_unregister_thread(struct mddev *mddev, struct md_thread __rcu **t extern void md_wakeup_thread(struct md_thread __rcu *thread); extern void md_check_recovery(struct mddev *mddev); extern void md_reap_sync_thread(struct mddev *mddev); -extern int mddev_init_writes_pending(struct mddev *mddev); extern bool md_write_start(struct mddev *mddev, struct bio *bi); extern void md_write_inc(struct mddev *mddev, struct bio *bi); extern void md_write_end(struct mddev *mddev); |