Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e8096360 authored by NeilBrown's avatar NeilBrown
Browse files

md/raid1: typedef removal: conf_t -> struct r1conf



Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent e879a879
Loading
Loading
Loading
Loading
+47 −47
Original line number Original line Diff line number Diff line
@@ -46,8 +46,8 @@
#define	NR_RAID1_BIOS 256
#define	NR_RAID1_BIOS 256




static void allow_barrier(conf_t *conf);
static void allow_barrier(struct r1conf *conf);
static void lower_barrier(conf_t *conf);
static void lower_barrier(struct r1conf *conf);


static void * r1bio_pool_alloc(gfp_t gfp_flags, void *data)
static void * r1bio_pool_alloc(gfp_t gfp_flags, void *data)
{
{
@@ -154,7 +154,7 @@ static void r1buf_pool_free(void *__r1_bio, void *data)
	r1bio_pool_free(r1bio, data);
	r1bio_pool_free(r1bio, data);
}
}


static void put_all_bios(conf_t *conf, struct r1bio *r1_bio)
static void put_all_bios(struct r1conf *conf, struct r1bio *r1_bio)
{
{
	int i;
	int i;


@@ -168,7 +168,7 @@ static void put_all_bios(conf_t *conf, struct r1bio *r1_bio)


static void free_r1bio(struct r1bio *r1_bio)
static void free_r1bio(struct r1bio *r1_bio)
{
{
	conf_t *conf = r1_bio->mddev->private;
	struct r1conf *conf = r1_bio->mddev->private;


	put_all_bios(conf, r1_bio);
	put_all_bios(conf, r1_bio);
	mempool_free(r1_bio, conf->r1bio_pool);
	mempool_free(r1_bio, conf->r1bio_pool);
@@ -176,7 +176,7 @@ static void free_r1bio(struct r1bio *r1_bio)


static void put_buf(struct r1bio *r1_bio)
static void put_buf(struct r1bio *r1_bio)
{
{
	conf_t *conf = r1_bio->mddev->private;
	struct r1conf *conf = r1_bio->mddev->private;
	int i;
	int i;


	for (i=0; i<conf->raid_disks; i++) {
	for (i=0; i<conf->raid_disks; i++) {
@@ -194,7 +194,7 @@ static void reschedule_retry(struct r1bio *r1_bio)
{
{
	unsigned long flags;
	unsigned long flags;
	struct mddev *mddev = r1_bio->mddev;
	struct mddev *mddev = r1_bio->mddev;
	conf_t *conf = mddev->private;
	struct r1conf *conf = mddev->private;


	spin_lock_irqsave(&conf->device_lock, flags);
	spin_lock_irqsave(&conf->device_lock, flags);
	list_add(&r1_bio->retry_list, &conf->retry_list);
	list_add(&r1_bio->retry_list, &conf->retry_list);
@@ -214,7 +214,7 @@ static void call_bio_endio(struct r1bio *r1_bio)
{
{
	struct bio *bio = r1_bio->master_bio;
	struct bio *bio = r1_bio->master_bio;
	int done;
	int done;
	conf_t *conf = r1_bio->mddev->private;
	struct r1conf *conf = r1_bio->mddev->private;


	if (bio->bi_phys_segments) {
	if (bio->bi_phys_segments) {
		unsigned long flags;
		unsigned long flags;
@@ -259,7 +259,7 @@ static void raid_end_bio_io(struct r1bio *r1_bio)
 */
 */
static inline void update_head_pos(int disk, struct r1bio *r1_bio)
static inline void update_head_pos(int disk, struct r1bio *r1_bio)
{
{
	conf_t *conf = r1_bio->mddev->private;
	struct r1conf *conf = r1_bio->mddev->private;


	conf->mirrors[disk].head_position =
	conf->mirrors[disk].head_position =
		r1_bio->sector + (r1_bio->sectors);
		r1_bio->sector + (r1_bio->sectors);
@@ -288,7 +288,7 @@ static void raid1_end_read_request(struct bio *bio, int error)
	int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
	int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
	struct r1bio *r1_bio = bio->bi_private;
	struct r1bio *r1_bio = bio->bi_private;
	int mirror;
	int mirror;
	conf_t *conf = r1_bio->mddev->private;
	struct r1conf *conf = r1_bio->mddev->private;


	mirror = r1_bio->read_disk;
	mirror = r1_bio->read_disk;
	/*
	/*
@@ -373,7 +373,7 @@ static void raid1_end_write_request(struct bio *bio, int error)
	int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
	int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
	struct r1bio *r1_bio = bio->bi_private;
	struct r1bio *r1_bio = bio->bi_private;
	int mirror, behind = test_bit(R1BIO_BehindIO, &r1_bio->state);
	int mirror, behind = test_bit(R1BIO_BehindIO, &r1_bio->state);
	conf_t *conf = r1_bio->mddev->private;
	struct r1conf *conf = r1_bio->mddev->private;
	struct bio *to_put = NULL;
	struct bio *to_put = NULL;


	mirror = find_bio_disk(r1_bio, bio);
	mirror = find_bio_disk(r1_bio, bio);
@@ -466,7 +466,7 @@ static void raid1_end_write_request(struct bio *bio, int error)
 *
 *
 * The rdev for the device selected will have nr_pending incremented.
 * The rdev for the device selected will have nr_pending incremented.
 */
 */
static int read_balance(conf_t *conf, struct r1bio *r1_bio, int *max_sectors)
static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sectors)
{
{
	const sector_t this_sector = r1_bio->sector;
	const sector_t this_sector = r1_bio->sector;
	int sectors;
	int sectors;
@@ -595,7 +595,7 @@ static int read_balance(conf_t *conf, struct r1bio *r1_bio, int *max_sectors)


int md_raid1_congested(struct mddev *mddev, int bits)
int md_raid1_congested(struct mddev *mddev, int bits)
{
{
	conf_t *conf = mddev->private;
	struct r1conf *conf = mddev->private;
	int i, ret = 0;
	int i, ret = 0;


	rcu_read_lock();
	rcu_read_lock();
@@ -628,7 +628,7 @@ static int raid1_congested(void *data, int bits)
		md_raid1_congested(mddev, bits);
		md_raid1_congested(mddev, bits);
}
}


static void flush_pending_writes(conf_t *conf)
static void flush_pending_writes(struct r1conf *conf)
{
{
	/* Any writes that have been queued but are awaiting
	/* Any writes that have been queued but are awaiting
	 * bitmap updates get flushed here.
	 * bitmap updates get flushed here.
@@ -676,7 +676,7 @@ static void flush_pending_writes(conf_t *conf)
 */
 */
#define RESYNC_DEPTH 32
#define RESYNC_DEPTH 32


static void raise_barrier(conf_t *conf)
static void raise_barrier(struct r1conf *conf)
{
{
	spin_lock_irq(&conf->resync_lock);
	spin_lock_irq(&conf->resync_lock);


@@ -695,7 +695,7 @@ static void raise_barrier(conf_t *conf)
	spin_unlock_irq(&conf->resync_lock);
	spin_unlock_irq(&conf->resync_lock);
}
}


static void lower_barrier(conf_t *conf)
static void lower_barrier(struct r1conf *conf)
{
{
	unsigned long flags;
	unsigned long flags;
	BUG_ON(conf->barrier <= 0);
	BUG_ON(conf->barrier <= 0);
@@ -705,7 +705,7 @@ static void lower_barrier(conf_t *conf)
	wake_up(&conf->wait_barrier);
	wake_up(&conf->wait_barrier);
}
}


static void wait_barrier(conf_t *conf)
static void wait_barrier(struct r1conf *conf)
{
{
	spin_lock_irq(&conf->resync_lock);
	spin_lock_irq(&conf->resync_lock);
	if (conf->barrier) {
	if (conf->barrier) {
@@ -719,7 +719,7 @@ static void wait_barrier(conf_t *conf)
	spin_unlock_irq(&conf->resync_lock);
	spin_unlock_irq(&conf->resync_lock);
}
}


static void allow_barrier(conf_t *conf)
static void allow_barrier(struct r1conf *conf)
{
{
	unsigned long flags;
	unsigned long flags;
	spin_lock_irqsave(&conf->resync_lock, flags);
	spin_lock_irqsave(&conf->resync_lock, flags);
@@ -728,7 +728,7 @@ static void allow_barrier(conf_t *conf)
	wake_up(&conf->wait_barrier);
	wake_up(&conf->wait_barrier);
}
}


static void freeze_array(conf_t *conf)
static void freeze_array(struct r1conf *conf)
{
{
	/* stop syncio and normal IO and wait for everything to
	/* stop syncio and normal IO and wait for everything to
	 * go quite.
	 * go quite.
@@ -751,7 +751,7 @@ static void freeze_array(conf_t *conf)
			    flush_pending_writes(conf));
			    flush_pending_writes(conf));
	spin_unlock_irq(&conf->resync_lock);
	spin_unlock_irq(&conf->resync_lock);
}
}
static void unfreeze_array(conf_t *conf)
static void unfreeze_array(struct r1conf *conf)
{
{
	/* reverse the effect of the freeze */
	/* reverse the effect of the freeze */
	spin_lock_irq(&conf->resync_lock);
	spin_lock_irq(&conf->resync_lock);
@@ -798,7 +798,7 @@ do_sync_io:


static int make_request(struct mddev *mddev, struct bio * bio)
static int make_request(struct mddev *mddev, struct bio * bio)
{
{
	conf_t *conf = mddev->private;
	struct r1conf *conf = mddev->private;
	struct mirror_info *mirror;
	struct mirror_info *mirror;
	struct r1bio *r1_bio;
	struct r1bio *r1_bio;
	struct bio *read_bio;
	struct bio *read_bio;
@@ -1140,7 +1140,7 @@ read_again:


static void status(struct seq_file *seq, struct mddev *mddev)
static void status(struct seq_file *seq, struct mddev *mddev)
{
{
	conf_t *conf = mddev->private;
	struct r1conf *conf = mddev->private;
	int i;
	int i;


	seq_printf(seq, " [%d/%d] [", conf->raid_disks,
	seq_printf(seq, " [%d/%d] [", conf->raid_disks,
@@ -1159,7 +1159,7 @@ static void status(struct seq_file *seq, struct mddev *mddev)
static void error(struct mddev *mddev, struct md_rdev *rdev)
static void error(struct mddev *mddev, struct md_rdev *rdev)
{
{
	char b[BDEVNAME_SIZE];
	char b[BDEVNAME_SIZE];
	conf_t *conf = mddev->private;
	struct r1conf *conf = mddev->private;


	/*
	/*
	 * If it is not operational, then we have already marked it as dead
	 * If it is not operational, then we have already marked it as dead
@@ -1199,7 +1199,7 @@ static void error(struct mddev *mddev, struct md_rdev *rdev)
	       mdname(mddev), conf->raid_disks - mddev->degraded);
	       mdname(mddev), conf->raid_disks - mddev->degraded);
}
}


static void print_conf(conf_t *conf)
static void print_conf(struct r1conf *conf)
{
{
	int i;
	int i;


@@ -1224,7 +1224,7 @@ static void print_conf(conf_t *conf)
	rcu_read_unlock();
	rcu_read_unlock();
}
}


static void close_sync(conf_t *conf)
static void close_sync(struct r1conf *conf)
{
{
	wait_barrier(conf);
	wait_barrier(conf);
	allow_barrier(conf);
	allow_barrier(conf);
@@ -1236,7 +1236,7 @@ static void close_sync(conf_t *conf)
static int raid1_spare_active(struct mddev *mddev)
static int raid1_spare_active(struct mddev *mddev)
{
{
	int i;
	int i;
	conf_t *conf = mddev->private;
	struct r1conf *conf = mddev->private;
	int count = 0;
	int count = 0;
	unsigned long flags;
	unsigned long flags;


@@ -1265,7 +1265,7 @@ static int raid1_spare_active(struct mddev *mddev)


static int raid1_add_disk(struct mddev *mddev, struct md_rdev *rdev)
static int raid1_add_disk(struct mddev *mddev, struct md_rdev *rdev)
{
{
	conf_t *conf = mddev->private;
	struct r1conf *conf = mddev->private;
	int err = -EEXIST;
	int err = -EEXIST;
	int mirror = 0;
	int mirror = 0;
	struct mirror_info *p;
	struct mirror_info *p;
@@ -1313,7 +1313,7 @@ static int raid1_add_disk(struct mddev *mddev, struct md_rdev *rdev)


static int raid1_remove_disk(struct mddev *mddev, int number)
static int raid1_remove_disk(struct mddev *mddev, int number)
{
{
	conf_t *conf = mddev->private;
	struct r1conf *conf = mddev->private;
	int err = 0;
	int err = 0;
	struct md_rdev *rdev;
	struct md_rdev *rdev;
	struct mirror_info *p = conf->mirrors+ number;
	struct mirror_info *p = conf->mirrors+ number;
@@ -1375,7 +1375,7 @@ static void end_sync_write(struct bio *bio, int error)
	int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
	int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
	struct r1bio *r1_bio = bio->bi_private;
	struct r1bio *r1_bio = bio->bi_private;
	struct mddev *mddev = r1_bio->mddev;
	struct mddev *mddev = r1_bio->mddev;
	conf_t *conf = mddev->private;
	struct r1conf *conf = mddev->private;
	int mirror=0;
	int mirror=0;
	sector_t first_bad;
	sector_t first_bad;
	int bad_sectors;
	int bad_sectors;
@@ -1447,7 +1447,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
	 * will have bi_end_io clear.
	 * will have bi_end_io clear.
	 */
	 */
	struct mddev *mddev = r1_bio->mddev;
	struct mddev *mddev = r1_bio->mddev;
	conf_t *conf = mddev->private;
	struct r1conf *conf = mddev->private;
	struct bio *bio = r1_bio->bios[r1_bio->read_disk];
	struct bio *bio = r1_bio->bios[r1_bio->read_disk];
	sector_t sect = r1_bio->sector;
	sector_t sect = r1_bio->sector;
	int sectors = r1_bio->sectors;
	int sectors = r1_bio->sectors;
@@ -1563,7 +1563,7 @@ static int process_checks(struct r1bio *r1_bio)
	 * attempt an over-write
	 * attempt an over-write
	 */
	 */
	struct mddev *mddev = r1_bio->mddev;
	struct mddev *mddev = r1_bio->mddev;
	conf_t *conf = mddev->private;
	struct r1conf *conf = mddev->private;
	int primary;
	int primary;
	int i;
	int i;


@@ -1637,7 +1637,7 @@ static int process_checks(struct r1bio *r1_bio)


static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio)
static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio)
{
{
	conf_t *conf = mddev->private;
	struct r1conf *conf = mddev->private;
	int i;
	int i;
	int disks = conf->raid_disks;
	int disks = conf->raid_disks;
	struct bio *bio, *wbio;
	struct bio *bio, *wbio;
@@ -1687,7 +1687,7 @@ static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio)
 *	3.	Performs writes following reads for array synchronising.
 *	3.	Performs writes following reads for array synchronising.
 */
 */


static void fix_read_error(conf_t *conf, int read_disk,
static void fix_read_error(struct r1conf *conf, int read_disk,
			   sector_t sect, int sectors)
			   sector_t sect, int sectors)
{
{
	struct mddev *mddev = conf->mddev;
	struct mddev *mddev = conf->mddev;
@@ -1793,7 +1793,7 @@ static int submit_bio_wait(int rw, struct bio *bio)
static int narrow_write_error(struct r1bio *r1_bio, int i)
static int narrow_write_error(struct r1bio *r1_bio, int i)
{
{
	struct mddev *mddev = r1_bio->mddev;
	struct mddev *mddev = r1_bio->mddev;
	conf_t *conf = mddev->private;
	struct r1conf *conf = mddev->private;
	struct md_rdev *rdev = conf->mirrors[i].rdev;
	struct md_rdev *rdev = conf->mirrors[i].rdev;
	int vcnt, idx;
	int vcnt, idx;
	struct bio_vec *vec;
	struct bio_vec *vec;
@@ -1866,7 +1866,7 @@ static int narrow_write_error(struct r1bio *r1_bio, int i)
	return ok;
	return ok;
}
}


static void handle_sync_write_finished(conf_t *conf, struct r1bio *r1_bio)
static void handle_sync_write_finished(struct r1conf *conf, struct r1bio *r1_bio)
{
{
	int m;
	int m;
	int s = r1_bio->sectors;
	int s = r1_bio->sectors;
@@ -1889,7 +1889,7 @@ static void handle_sync_write_finished(conf_t *conf, struct r1bio *r1_bio)
	md_done_sync(conf->mddev, s, 1);
	md_done_sync(conf->mddev, s, 1);
}
}


static void handle_write_finished(conf_t *conf, struct r1bio *r1_bio)
static void handle_write_finished(struct r1conf *conf, struct r1bio *r1_bio)
{
{
	int m;
	int m;
	for (m = 0; m < conf->raid_disks ; m++)
	for (m = 0; m < conf->raid_disks ; m++)
@@ -1918,7 +1918,7 @@ static void handle_write_finished(conf_t *conf, struct r1bio *r1_bio)
	raid_end_bio_io(r1_bio);
	raid_end_bio_io(r1_bio);
}
}


static void handle_read_error(conf_t *conf, struct r1bio *r1_bio)
static void handle_read_error(struct r1conf *conf, struct r1bio *r1_bio)
{
{
	int disk;
	int disk;
	int max_sectors;
	int max_sectors;
@@ -2012,7 +2012,7 @@ static void raid1d(struct mddev *mddev)
{
{
	struct r1bio *r1_bio;
	struct r1bio *r1_bio;
	unsigned long flags;
	unsigned long flags;
	conf_t *conf = mddev->private;
	struct r1conf *conf = mddev->private;
	struct list_head *head = &conf->retry_list;
	struct list_head *head = &conf->retry_list;
	struct blk_plug plug;
	struct blk_plug plug;


@@ -2061,7 +2061,7 @@ static void raid1d(struct mddev *mddev)
}
}




static int init_resync(conf_t *conf)
static int init_resync(struct r1conf *conf)
{
{
	int buffs;
	int buffs;


@@ -2087,7 +2087,7 @@ static int init_resync(conf_t *conf)


static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipped, int go_faster)
static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipped, int go_faster)
{
{
	conf_t *conf = mddev->private;
	struct r1conf *conf = mddev->private;
	struct r1bio *r1_bio;
	struct r1bio *r1_bio;
	struct bio *bio;
	struct bio *bio;
	sector_t max_sector, nr_sectors;
	sector_t max_sector, nr_sectors;
@@ -2365,15 +2365,15 @@ static sector_t raid1_size(struct mddev *mddev, sector_t sectors, int raid_disks
	return mddev->dev_sectors;
	return mddev->dev_sectors;
}
}


static conf_t *setup_conf(struct mddev *mddev)
static struct r1conf *setup_conf(struct mddev *mddev)
{
{
	conf_t *conf;
	struct r1conf *conf;
	int i;
	int i;
	struct mirror_info *disk;
	struct mirror_info *disk;
	struct md_rdev *rdev;
	struct md_rdev *rdev;
	int err = -ENOMEM;
	int err = -ENOMEM;


	conf = kzalloc(sizeof(conf_t), GFP_KERNEL);
	conf = kzalloc(sizeof(struct r1conf), GFP_KERNEL);
	if (!conf)
	if (!conf)
		goto abort;
		goto abort;


@@ -2468,7 +2468,7 @@ static conf_t *setup_conf(struct mddev *mddev)


static int run(struct mddev *mddev)
static int run(struct mddev *mddev)
{
{
	conf_t *conf;
	struct r1conf *conf;
	int i;
	int i;
	struct md_rdev *rdev;
	struct md_rdev *rdev;


@@ -2548,7 +2548,7 @@ static int run(struct mddev *mddev)


static int stop(struct mddev *mddev)
static int stop(struct mddev *mddev)
{
{
	conf_t *conf = mddev->private;
	struct r1conf *conf = mddev->private;
	struct bitmap *bitmap = mddev->bitmap;
	struct bitmap *bitmap = mddev->bitmap;


	/* wait for behind writes to complete */
	/* wait for behind writes to complete */
@@ -2613,7 +2613,7 @@ static int raid1_reshape(struct mddev *mddev)
	mempool_t *newpool, *oldpool;
	mempool_t *newpool, *oldpool;
	struct pool_info *newpoolinfo;
	struct pool_info *newpoolinfo;
	struct mirror_info *newmirrors;
	struct mirror_info *newmirrors;
	conf_t *conf = mddev->private;
	struct r1conf *conf = mddev->private;
	int cnt, raid_disks;
	int cnt, raid_disks;
	unsigned long flags;
	unsigned long flags;
	int d, d2, err;
	int d, d2, err;
@@ -2705,7 +2705,7 @@ static int raid1_reshape(struct mddev *mddev)


static void raid1_quiesce(struct mddev *mddev, int state)
static void raid1_quiesce(struct mddev *mddev, int state)
{
{
	conf_t *conf = mddev->private;
	struct r1conf *conf = mddev->private;


	switch(state) {
	switch(state) {
	case 2: /* wake for suspend */
	case 2: /* wake for suspend */
@@ -2726,7 +2726,7 @@ static void *raid1_takeover(struct mddev *mddev)
	 *  raid5 with 2 devices, any layout or chunk size
	 *  raid5 with 2 devices, any layout or chunk size
	 */
	 */
	if (mddev->level == 5 && mddev->raid_disks == 2) {
	if (mddev->level == 5 && mddev->raid_disks == 2) {
		conf_t *conf;
		struct r1conf *conf;
		mddev->new_level = 1;
		mddev->new_level = 1;
		mddev->new_layout = 0;
		mddev->new_layout = 0;
		mddev->new_chunk_sectors = 0;
		mddev->new_chunk_sectors = 0;
+1 −3
Original line number Original line Diff line number Diff line
@@ -19,7 +19,7 @@ struct pool_info {
	int	raid_disks;
	int	raid_disks;
};
};


struct r1_private_data_s {
struct r1conf {
	struct mddev		*mddev;
	struct mddev		*mddev;
	struct mirror_info		*mirrors;
	struct mirror_info		*mirrors;
	int			raid_disks;
	int			raid_disks;
@@ -90,8 +90,6 @@ struct r1_private_data_s {
	struct md_thread	*thread;
	struct md_thread	*thread;
};
};


typedef struct r1_private_data_s conf_t;

/*
/*
 * this is our 'private' RAID1 bio.
 * this is our 'private' RAID1 bio.
 *
 *