On Thu, Apr 20, 2023 at 4:31 AM Yu Kuai <yukuai1@xxxxxxxxxxxxxxx> wrote: > > From: Yu Kuai <yukuai3@xxxxxxxxxx> > > raid1-10.c contains definitions that are used both for raid1 and raid10, > it's werid to use ".c" suffix. type: weird. Please see the original discussion about raid1-10.c here: https://lore.kernel.org/linux-raid/20170712082912.491-1-ming.lei@xxxxxxxxxx/ Let's keep raid1-10.c for now. Thanks, Song > > Signed-off-by: Yu Kuai <yukuai3@xxxxxxxxxx> > --- > drivers/md/{raid1-10.c => raid1-10.h} | 10 +++++++--- > drivers/md/raid1.c | 2 -- > drivers/md/raid1.h | 2 ++ > drivers/md/raid10.c | 2 -- > drivers/md/raid10.h | 2 ++ > 5 files changed, 11 insertions(+), 7 deletions(-) > rename drivers/md/{raid1-10.c => raid1-10.h} (92%) > > diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.h > similarity index 92% > rename from drivers/md/raid1-10.c > rename to drivers/md/raid1-10.h > index e61f6cad4e08..04beef35142d 100644 > --- a/drivers/md/raid1-10.c > +++ b/drivers/md/raid1-10.h > @@ -1,4 +1,7 @@ > // SPDX-License-Identifier: GPL-2.0 > +#ifndef _RAID1_10_H > +#define _RAID1_10_H > + > /* Maximum size of each resync request */ > #define RESYNC_BLOCK_SIZE (64*1024) > #define RESYNC_PAGES ((RESYNC_BLOCK_SIZE + PAGE_SIZE-1) / PAGE_SIZE) > @@ -33,7 +36,7 @@ struct raid1_plug_cb { > struct bio_list pending; > }; > > -static void rbio_pool_free(void *rbio, void *data) > +static inline void rbio_pool_free(void *rbio, void *data) > { > kfree(rbio); > } > @@ -91,8 +94,8 @@ static inline struct resync_pages *get_resync_pages(struct bio *bio) > } > > /* generally called after bio_reset() for reseting bvec */ > -static void md_bio_reset_resync_pages(struct bio *bio, struct resync_pages *rp, > - int size) > +static inline void md_bio_reset_resync_pages(struct bio *bio, > + struct resync_pages *rp, int size) > { > int idx = 0; > > @@ -109,3 +112,4 @@ static void md_bio_reset_resync_pages(struct bio *bio, struct resync_pages *rp, > size -= len; > } while (idx++ < RESYNC_PAGES && size > 0); > } > +#endif > diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c > index 2f1011ffdf09..84724b9b20b8 100644 > --- a/drivers/md/raid1.c > +++ b/drivers/md/raid1.c > @@ -49,8 +49,6 @@ static void lower_barrier(struct r1conf *conf, sector_t sector_nr); > #define raid1_log(md, fmt, args...) \ > do { if ((md)->queue) blk_add_trace_msg((md)->queue, "raid1 " fmt, ##args); } while (0) > > -#include "raid1-10.c" > - > #define START(node) ((node)->start) > #define LAST(node) ((node)->last) > INTERVAL_TREE_DEFINE(struct serial_info, node, sector_t, _subtree_last, > diff --git a/drivers/md/raid1.h b/drivers/md/raid1.h > index 468f189da7a0..80de4d66f010 100644 > --- a/drivers/md/raid1.h > +++ b/drivers/md/raid1.h > @@ -2,6 +2,8 @@ > #ifndef _RAID1_H > #define _RAID1_H > > +#include "raid1-10.h" > + > /* > * each barrier unit size is 64MB fow now > * note: it must be larger than RESYNC_DEPTH > diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c > index a116b7c9d9f3..50d56b6af42f 100644 > --- a/drivers/md/raid10.c > +++ b/drivers/md/raid10.c > @@ -77,8 +77,6 @@ static void end_reshape(struct r10conf *conf); > #define raid10_log(md, fmt, args...) \ > do { if ((md)->queue) blk_add_trace_msg((md)->queue, "raid10 " fmt, ##args); } while (0) > > -#include "raid1-10.c" > - > #define NULL_CMD > #define cmd_before(conf, cmd) \ > do { \ > diff --git a/drivers/md/raid10.h b/drivers/md/raid10.h > index 63e48b11b552..63e88dd774f7 100644 > --- a/drivers/md/raid10.h > +++ b/drivers/md/raid10.h > @@ -2,6 +2,8 @@ > #ifndef _RAID10_H > #define _RAID10_H > > +#include "raid1-10.h" > + > /* Note: raid10_info.rdev can be set to NULL asynchronously by > * raid10_remove_disk. > * There are three safe ways to access raid10_info.rdev. > -- > 2.39.2 >