Re: [PATCH md-6.15 2/7] md: only include md-cluster.h if necessary

Su Yue
2025-02-18T03:45:33Z

On Tue 18 Feb 2025 at 10:40, Yu Kuai <yukuai1@huaweicloud.com>
wrote:

> Hi,
>
> 在 2025/02/17 18:20, Glass Su 写道:
>>
>>> On Feb 15, 2025, at 17:22, Yu Kuai <yukuai1@huaweicloud.com>
>>> wrote:
>>>
>>> From: Yu Kuai <yukuai3@huawei.com>
>>>
>>> md-cluster is only supportted by raid1 and raid10, there is no
>>> need to
>>> include md-cluster.h for other personalities.
>>>
>>> Also move APIs that is only used in md-cluster.c from md.h to
>>> md-cluster.h.
>>>
>>> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
>> Reviewed-by: Su Yue <glass.su@suse.com>
>
> Thanks for the review! Any ideas for the remaining patches?
>
Just did slight tests for md cluster. Sent RVB for remaining
patches.
Thanks for taking care of md cluster.

--
Su
> Kuai
>
>>> ---
>>> drivers/md/md-bitmap.c | 2 ++
>>> drivers/md/md-cluster.h | 7 +++++++
>>> drivers/md/md.h | 7 -------
>>> drivers/md/raid1.c | 1 +
>>> drivers/md/raid10.c | 1 +
>>> 5 files changed, 11 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
>>> index 23c09d22fcdb..71aa7dc80e26 100644
>>> --- a/drivers/md/md-bitmap.c
>>> +++ b/drivers/md/md-bitmap.c
>>> @@ -29,8 +29,10 @@
>>> #include <linux/buffer_head.h>
>>> #include <linux/seq_file.h>
>>> #include <trace/events/block.h>
>>> +
>>> #include "md.h"
>>> #include "md-bitmap.h"
>>> +#include "md-cluster.h"
>>>
>>> #define BITMAP_MAJOR_LO 3
>>> /* version 4 insists the bitmap is in little-endian order
>>> diff --git a/drivers/md/md-cluster.h b/drivers/md/md-cluster.h
>>> index 470bf18ffde5..6c7aad00f5da 100644
>>> --- a/drivers/md/md-cluster.h
>>> +++ b/drivers/md/md-cluster.h
>>> @@ -35,4 +35,11 @@ struct md_cluster_operations {
>>> void (*update_size)(struct mddev *mddev, sector_t
>>> old_dev_sectors);
>>> };
>>>
>>> +extern int register_md_cluster_operations(const struct
>>> md_cluster_operations *ops,
>>> + struct module *module);
>>> +extern int unregister_md_cluster_operations(void);
>>> +extern int md_setup_cluster(struct mddev *mddev, int nodes);
>>> +extern void md_cluster_stop(struct mddev *mddev);
>>> +extern void md_reload_sb(struct mddev *mddev, int raid_disk);
>>> +
>>> #endif /* _MD_CLUSTER_H */
>>> diff --git a/drivers/md/md.h b/drivers/md/md.h
>>> index def808064ad8..c9bc70e6d5b4 100644
>>> --- a/drivers/md/md.h
>>> +++ b/drivers/md/md.h
>>> @@ -19,7 +19,6 @@
>>> #include <linux/wait.h>
>>> #include <linux/workqueue.h>
>>> #include <trace/events/block.h>
>>> -#include "md-cluster.h"
>>>
>>> #define MaxSector (~(sector_t)0)
>>>
>>> @@ -845,11 +844,6 @@ static inline void safe_put_page(struct
>>> page *p)
>>>
>>> extern int register_md_personality(struct md_personality *p);
>>> extern int unregister_md_personality(struct md_personality
>>> *p);
>>> -extern int register_md_cluster_operations(const struct
>>> md_cluster_operations *ops,
>>> - struct module *module);
>>> -extern int unregister_md_cluster_operations(void);
>>> -extern int md_setup_cluster(struct mddev *mddev, int nodes);
>>> -extern void md_cluster_stop(struct mddev *mddev);
>>> extern struct md_thread *md_register_thread(
>>> void (*run)(struct md_thread *thread),
>>> struct mddev *mddev,
>>> @@ -906,7 +900,6 @@ extern void md_idle_sync_thread(struct
>>> mddev *mddev);
>>> extern void md_frozen_sync_thread(struct mddev *mddev);
>>> extern void md_unfrozen_sync_thread(struct mddev *mddev);
>>>
>>> -extern void md_reload_sb(struct mddev *mddev, int raid_disk);
>>> extern void md_update_sb(struct mddev *mddev, int force);
>>> extern void mddev_create_serial_pool(struct mddev *mddev,
>>> struct md_rdev *rdev);
>>> extern void mddev_destroy_serial_pool(struct mddev *mddev,
>>> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
>>> index 9d57a88dbd26..e55db07e43d4 100644
>>> --- a/drivers/md/raid1.c
>>> +++ b/drivers/md/raid1.c
>>> @@ -36,6 +36,7 @@
>>> #include "md.h"
>>> #include "raid1.h"
>>> #include "md-bitmap.h"
>>> +#include "md-cluster.h"
>>>
>>> #define UNSUPPORTED_MDDEV_FLAGS \
>>> ((1L << MD_HAS_JOURNAL) | \
>>> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
>>> index efe93b979167..3df39b2399b2 100644
>>> --- a/drivers/md/raid10.c
>>> +++ b/drivers/md/raid10.c
>>> @@ -24,6 +24,7 @@
>>> #include "raid10.h"
>>> #include "raid0.h"
>>> #include "md-bitmap.h"
>>> +#include "md-cluster.h"
>>>
>>> /*
>>> * RAID10 provides a combination of RAID0 and RAID1
>>> functionality.
>>> -- 2.39.2
>>>
>>>
>> .
>>