From 5a537df44d52331a3d2792ca21a296959bd2ac3a Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 21 Sep 2011 15:37:46 +1000 Subject: md/bitmap: rename and tidy up BITMAP_PAGE_CLEAN The flag 'BITMAP_PAGE_CLEAN' has a confusing name as it doesn't mean that the page is clean, but rather that there are counters in the page which allow bits in the bitmap to be cleared - i.e. maybe cleaning can happen. So change it to BITMAP_PAGE_PENDING and fix some irregularities: - Don't set it in bitmap_init_from_disk as bitmap_set_memory_bits sets it when needed - in bitmap_daemon_work, if we find a counter that is '1', but need_sync is set, then set BITMAP_PAGE_PENDING again (it was recently cleared) to ensure we don't forget about this bit. Signed-off-by: NeilBrown --- drivers/md/bitmap.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 0dc6546b77a8..69a6f256ce35 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c @@ -868,7 +868,8 @@ static void bitmap_file_kick(struct bitmap *bitmap) enum bitmap_page_attr { BITMAP_PAGE_DIRTY = 0, /* there are set bits that need to be synced */ - BITMAP_PAGE_CLEAN = 1, /* there are bits that might need to be cleared */ + BITMAP_PAGE_PENDING = 1, /* there are bits that are being cleaned. + * i.e. counter is 1 or 2. */ BITMAP_PAGE_NEEDWRITE = 2, /* there are cleared bits that need to be synced */ }; @@ -1111,7 +1112,6 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) (sector_t)i << CHUNK_BLOCK_SHIFT(bitmap), needed); bit_cnt++; - set_page_attr(bitmap, page, BITMAP_PAGE_CLEAN); } } @@ -1204,7 +1204,7 @@ void bitmap_daemon_work(mddev_t *mddev) if (page != lastpage) { /* skip this page unless it's marked as needing cleaning */ - if (!test_page_attr(bitmap, page, BITMAP_PAGE_CLEAN)) { + if (!test_page_attr(bitmap, page, BITMAP_PAGE_PENDING)) { int need_write = test_page_attr(bitmap, page, BITMAP_PAGE_NEEDWRITE); if (need_write) @@ -1249,19 +1249,17 @@ void bitmap_daemon_work(mddev_t *mddev) } spin_lock_irqsave(&bitmap->lock, flags); if (!bitmap->need_sync) - clear_page_attr(bitmap, page, BITMAP_PAGE_CLEAN); + clear_page_attr(bitmap, page, BITMAP_PAGE_PENDING); } bmc = bitmap_get_counter(bitmap, (sector_t)j << CHUNK_BLOCK_SHIFT(bitmap), &blocks, 0); - if (bmc) { - if (*bmc) - bitmap->allclean = 0; + if (!bmc) + j |= PAGE_COUNTER_MASK; + else if (*bmc) { + bitmap->allclean = 0; - if (*bmc == 2) { - *bmc = 1; /* maybe clear the bit next time */ - set_page_attr(bitmap, page, BITMAP_PAGE_CLEAN); - } else if (*bmc == 1 && !bitmap->need_sync) { + if (*bmc == 1 && !bitmap->need_sync) { /* we can clear the bit */ *bmc = 0; bitmap_count_page(bitmap, @@ -1275,13 +1273,15 @@ void bitmap_daemon_work(mddev_t *mddev) paddr); else __clear_bit_le( - file_page_offset(bitmap, - j), - paddr); + file_page_offset(bitmap, + j), + paddr); kunmap_atomic(paddr, KM_USER0); + } else if (*bmc <= 2) { + *bmc = 1; /* maybe clear the bit next time */ + set_page_attr(bitmap, page, BITMAP_PAGE_PENDING); } - } else - j |= PAGE_COUNTER_MASK; + } } spin_unlock_irqrestore(&bitmap->lock, flags); @@ -1458,7 +1458,7 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto filemap_get_page( bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap)), - BITMAP_PAGE_CLEAN); + BITMAP_PAGE_PENDING); spin_unlock_irqrestore(&bitmap->lock, flags); offset += blocks; @@ -1546,7 +1546,7 @@ void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, sector_t *blocks, i if (*bmc <= 2) set_page_attr(bitmap, filemap_get_page(bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap)), - BITMAP_PAGE_CLEAN); + BITMAP_PAGE_PENDING); } } unlock: @@ -1622,7 +1622,7 @@ static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, int n *bmc = 1 | (needed ? NEEDED_MASK : 0); bitmap_count_page(bitmap, offset, 1); page = filemap_get_page(bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap)); - set_page_attr(bitmap, page, BITMAP_PAGE_CLEAN); + set_page_attr(bitmap, page, BITMAP_PAGE_PENDING); } spin_unlock_irq(&bitmap->lock); bitmap->allclean = 0; -- cgit v1.2.2 From 2585f3ef8c7fffe750ef1feb2775023716d799a8 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 21 Sep 2011 15:37:46 +1000 Subject: md/bitmap: improve handling of 'allclean'. The 'allclean' flag is used to cache the fact that there is nothing to do, so we can avoid waking up and scanning the bitmap regularly. The two sorts of pages that might need the attention of the bitmap daemon are BITMAP_PAGE_PENDING and BITMAP_PAGE_NEEDWRITE pages. So make sure allclean reflects exactly when there are none of those. So: set it before scanning all pages with either bit set. clear it whenever these bits are set clear it when we desire not to clear one of these bits. don't clear it any other time. Signed-off-by: NeilBrown --- drivers/md/bitmap.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 69a6f256ce35..689623c3cffa 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c @@ -1146,6 +1146,7 @@ void bitmap_write_all(struct bitmap *bitmap) for (i = 0; i < bitmap->file_pages; i++) set_page_attr(bitmap, bitmap->filemap[i], BITMAP_PAGE_NEEDWRITE); + bitmap->allclean = 0; } static void bitmap_count_page(struct bitmap *bitmap, sector_t offset, int inc) @@ -1211,10 +1212,8 @@ void bitmap_daemon_work(mddev_t *mddev) clear_page_attr(bitmap, page, BITMAP_PAGE_NEEDWRITE); spin_unlock_irqrestore(&bitmap->lock, flags); - if (need_write) { + if (need_write) write_page(bitmap, page, 0); - bitmap->allclean = 0; - } spin_lock_irqsave(&bitmap->lock, flags); j |= (PAGE_BITS - 1); continue; @@ -1222,12 +1221,16 @@ void bitmap_daemon_work(mddev_t *mddev) /* grab the new page, sync and release the old */ if (lastpage != NULL) { - if (test_page_attr(bitmap, lastpage, BITMAP_PAGE_NEEDWRITE)) { - clear_page_attr(bitmap, lastpage, BITMAP_PAGE_NEEDWRITE); + if (test_page_attr(bitmap, lastpage, + BITMAP_PAGE_NEEDWRITE)) { + clear_page_attr(bitmap, lastpage, + BITMAP_PAGE_NEEDWRITE); spin_unlock_irqrestore(&bitmap->lock, flags); write_page(bitmap, lastpage, 0); } else { - set_page_attr(bitmap, lastpage, BITMAP_PAGE_NEEDWRITE); + set_page_attr(bitmap, lastpage, + BITMAP_PAGE_NEEDWRITE); + bitmap->allclean = 0; spin_unlock_irqrestore(&bitmap->lock, flags); } } else @@ -1250,6 +1253,8 @@ void bitmap_daemon_work(mddev_t *mddev) spin_lock_irqsave(&bitmap->lock, flags); if (!bitmap->need_sync) clear_page_attr(bitmap, page, BITMAP_PAGE_PENDING); + else + bitmap->allclean = 0; } bmc = bitmap_get_counter(bitmap, (sector_t)j << CHUNK_BLOCK_SHIFT(bitmap), @@ -1257,8 +1262,6 @@ void bitmap_daemon_work(mddev_t *mddev) if (!bmc) j |= PAGE_COUNTER_MASK; else if (*bmc) { - bitmap->allclean = 0; - if (*bmc == 1 && !bitmap->need_sync) { /* we can clear the bit */ *bmc = 0; @@ -1280,6 +1283,7 @@ void bitmap_daemon_work(mddev_t *mddev) } else if (*bmc <= 2) { *bmc = 1; /* maybe clear the bit next time */ set_page_attr(bitmap, page, BITMAP_PAGE_PENDING); + bitmap->allclean = 0; } } } @@ -1294,6 +1298,7 @@ void bitmap_daemon_work(mddev_t *mddev) write_page(bitmap, lastpage, 0); } else { set_page_attr(bitmap, lastpage, BITMAP_PAGE_NEEDWRITE); + bitmap->allclean = 0; spin_unlock_irqrestore(&bitmap->lock, flags); } } @@ -1407,7 +1412,6 @@ int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sect else sectors = 0; } - bitmap->allclean = 0; return 0; } EXPORT_SYMBOL(bitmap_startwrite); @@ -1453,13 +1457,14 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto wake_up(&bitmap->overflow_wait); (*bmc)--; - if (*bmc <= 2) + if (*bmc <= 2) { set_page_attr(bitmap, filemap_get_page( bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap)), BITMAP_PAGE_PENDING); - + bitmap->allclean = 0; + } spin_unlock_irqrestore(&bitmap->lock, flags); offset += blocks; if (sectors > blocks) @@ -1495,7 +1500,6 @@ static int __bitmap_start_sync(struct bitmap *bitmap, sector_t offset, sector_t } } spin_unlock_irq(&bitmap->lock); - bitmap->allclean = 0; return rv; } @@ -1543,15 +1547,16 @@ void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, sector_t *blocks, i if (!NEEDED(*bmc) && aborted) *bmc |= NEEDED_MASK; else { - if (*bmc <= 2) + if (*bmc <= 2) { set_page_attr(bitmap, filemap_get_page(bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap)), BITMAP_PAGE_PENDING); + bitmap->allclean = 0; + } } } unlock: spin_unlock_irqrestore(&bitmap->lock, flags); - bitmap->allclean = 0; } EXPORT_SYMBOL(bitmap_end_sync); @@ -1623,9 +1628,9 @@ static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, int n bitmap_count_page(bitmap, offset, 1); page = filemap_get_page(bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap)); set_page_attr(bitmap, page, BITMAP_PAGE_PENDING); + bitmap->allclean = 0; } spin_unlock_irq(&bitmap->lock); - bitmap->allclean = 0; } /* dirty the memory and file bits for bitmap chunks "s" to "e" */ -- cgit v1.2.2 From 7e841526263b3e0042a423513147dfd06c8e998d Mon Sep 17 00:00:00 2001 From: Wang Sheng-Hui Date: Wed, 21 Sep 2011 15:37:46 +1000 Subject: trival: md_k.h should be md.h in the beginning comment of file md.h Signed-off-by: Wang Sheng-Hui Signed-off-by: NeilBrown --- drivers/md/md.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/md.h b/drivers/md/md.h index 0a309dc29b45..f412b6e3aa73 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -1,5 +1,5 @@ /* - md_k.h : kernel internal structure of the Linux MD driver + md.h : kernel internal structure of the Linux MD driver Copyright (C) 1996-98 Ingo Molnar, Gadi Oxman This program is free software; you can redistribute it and/or modify -- cgit v1.2.2 From 2dba6a911c284603d2085fec1e2d3c142f58a010 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Fri, 23 Sep 2011 10:40:45 +0100 Subject: md: don't delay reboot by 1 second if no MD devices exist The md_notify_reboot() method includes a call to mdelay(1000), to deal with "exotic SCSI devices" which are too volatile on reboot. The delay is unconditional. Even if the machine does not have any block devices, let alone MD devices, the kernel shutdown sequence is slowed down. 1 second does not matter much with physical hardware, but with certain virtualization use cases any wasted time in the bootup & shutdown sequence counts for alot. * drivers/md/md.c: md_notify_reboot() - only impose a delay if there was at least one MD device to be stopped during reboot Signed-off-by: Daniel P. Berrange Signed-off-by: NeilBrown --- drivers/md/md.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 5c95ccb59500..accae4422c06 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -8075,12 +8075,13 @@ static int md_notify_reboot(struct notifier_block *this, { struct list_head *tmp; mddev_t *mddev; + int need_delay = 0; if ((code == SYS_DOWN) || (code == SYS_HALT) || (code == SYS_POWER_OFF)) { printk(KERN_INFO "md: stopping all md devices.\n"); - for_each_mddev(mddev, tmp) + for_each_mddev(mddev, tmp) { if (mddev_trylock(mddev)) { /* Force a switch to readonly even array * appears to still be in use. Hence @@ -8089,13 +8090,16 @@ static int md_notify_reboot(struct notifier_block *this, md_set_readonly(mddev, 100); mddev_unlock(mddev); } + need_delay = 1; + } /* * certain more exotic SCSI devices are known to be * volatile wrt too early system reboots. While the * right place to handle this issue is the given * driver, we do want to have a safe RAID driver ... */ - mdelay(1000*1); + if (need_delay) + mdelay(1000*1); } return NOTIFY_DONE; } -- cgit v1.2.2 From ce550c2059a67ee7834fc6f64cf895391d36a58e Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 7 Oct 2011 14:22:33 +1100 Subject: md/raid1: add documentation to r1_private_data_s data structure. There wasn't much and it is inconsistent. Also rearrange fields to keep related fields together. Reported-by: Aapo Laine Signed-off-by: NeilBrown --- drivers/md/raid1.h | 59 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/drivers/md/raid1.h b/drivers/md/raid1.h index e0d676b48974..a3d5483873a2 100644 --- a/drivers/md/raid1.h +++ b/drivers/md/raid1.h @@ -28,42 +28,67 @@ struct r1_private_data_s { mddev_t *mddev; mirror_info_t *mirrors; int raid_disks; + + /* When choose the best device for a read (read_balance()) + * we try to keep sequential reads one the same device + * using 'last_used' and 'next_seq_sect' + */ int last_used; sector_t next_seq_sect; + /* During resync, read_balancing is only allowed on the part + * of the array that has been resynced. 'next_resync' tells us + * where that is. + */ + sector_t next_resync; + spinlock_t device_lock; + /* list of 'r1bio_t' that need to be processed by raid1d, whether + * to retry a read, writeout a resync or recovery block, or + * anything else. + */ struct list_head retry_list; - /* queue pending writes and submit them on unplug */ - struct bio_list pending_bio_list; - /* for use when syncing mirrors: */ + /* queue pending writes to be submitted on unplug */ + struct bio_list pending_bio_list; + /* for use when syncing mirrors: + * We don't allow both normal IO and resync/recovery IO at + * the same time - resync/recovery can only happen when there + * is no other IO. So when either is active, the other has to wait. + * See more details description in raid1.c near raise_barrier(). + */ + wait_queue_head_t wait_barrier; spinlock_t resync_lock; int nr_pending; int nr_waiting; int nr_queued; int barrier; - sector_t next_resync; - int fullsync; /* set to 1 if a full sync is needed, - * (fresh device added). - * Cleared when a sync completes. - */ - int recovery_disabled; /* when the same as - * mddev->recovery_disabled - * we don't allow recovery - * to be attempted as we - * expect a read error - */ - wait_queue_head_t wait_barrier; + /* Set to 1 if a full sync is needed, (fresh device added). + * Cleared when a sync completes. + */ + int fullsync; - struct pool_info *poolinfo; + /* When the same as mddev->recovery_disabled we don't allow + * recovery to be attempted as we expect a read error. + */ + int recovery_disabled; - struct page *tmppage; + /* poolinfo contains information about the content of the + * mempools - it changes when the array grows or shrinks + */ + struct pool_info *poolinfo; mempool_t *r1bio_pool; mempool_t *r1buf_pool; + /* temporary buffer to synchronous IO when attempting to repair + * a read error. + */ + struct page *tmppage; + + /* When taking over an array from a different personality, we store * the new thread here until we fully activate the array. */ -- cgit v1.2.2 From e4f869d9de18bc8272df8d0ab764178aa24bdf33 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 7 Oct 2011 14:22:49 +1100 Subject: md/raid5: remove pointless NULL test. In the 'abort' branch of run(), 'conf' cannot possibly be NULL, so remove the test. Reported-by: Zdenek Kabelac Signed-off-by: NeilBrown --- drivers/md/raid5.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index ac5e8b57e50f..6ab3434b2359 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -4942,10 +4942,8 @@ static int run(mddev_t *mddev) return 0; abort: md_unregister_thread(&mddev->thread); - if (conf) { - print_raid5_conf(conf); - free_conf(conf); - } + print_raid5_conf(conf); + free_conf(conf); mddev->private = NULL; printk(KERN_ALERT "md/raid:%s: failed to run raid set.\n", mdname(mddev)); return -EIO; -- cgit v1.2.2 From ba3ae3bee317f0a5db813c026c8a8c113a4e40fb Mon Sep 17 00:00:00 2001 From: Namhyung Kim Date: Fri, 7 Oct 2011 14:22:53 +1100 Subject: md/raid1: factor out common bio handling code When normal-write and sync-read/write bio completes, we should find out the disk number the bio belongs to. Factor those common code out to a separate function. Signed-off-by: Namhyung Kim Signed-off-by: NeilBrown --- drivers/md/raid1.c | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index d9587dffe533..a0c02fb8af2a 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -268,6 +268,24 @@ static inline void update_head_pos(int disk, r1bio_t *r1_bio) r1_bio->sector + (r1_bio->sectors); } +/* + * Find the disk number which triggered given bio + */ +static int find_bio_disk(r1bio_t *r1_bio, struct bio *bio) +{ + int mirror; + int raid_disks = r1_bio->mddev->raid_disks; + + for (mirror = 0; mirror < raid_disks; mirror++) + if (r1_bio->bios[mirror] == bio) + break; + + BUG_ON(mirror == raid_disks); + update_head_pos(mirror, r1_bio); + + return mirror; +} + static void raid1_end_read_request(struct bio *bio, int error) { int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); @@ -361,10 +379,7 @@ static void raid1_end_write_request(struct bio *bio, int error) conf_t *conf = r1_bio->mddev->private; struct bio *to_put = NULL; - - for (mirror = 0; mirror < conf->raid_disks; mirror++) - if (r1_bio->bios[mirror] == bio) - break; + mirror = find_bio_disk(r1_bio, bio); /* * 'one mirror IO has finished' event handler: @@ -400,8 +415,6 @@ static void raid1_end_write_request(struct bio *bio, int error) } } - update_head_pos(mirror, r1_bio); - if (behind) { if (test_bit(WriteMostly, &conf->mirrors[mirror].rdev->flags)) atomic_dec(&r1_bio->behind_remaining); @@ -1344,13 +1357,10 @@ abort: static void end_sync_read(struct bio *bio, int error) { r1bio_t *r1_bio = bio->bi_private; - int i; - for (i=r1_bio->mddev->raid_disks; i--; ) - if (r1_bio->bios[i] == bio) - break; - BUG_ON(i < 0); - update_head_pos(i, r1_bio); + /* this will call update_head_pos() */ + find_bio_disk(r1_bio, bio); + /* * we have read a block, now it needs to be re-written, * or re-read if the read failed. @@ -1369,16 +1379,12 @@ static void end_sync_write(struct bio *bio, int error) r1bio_t *r1_bio = bio->bi_private; mddev_t *mddev = r1_bio->mddev; conf_t *conf = mddev->private; - int i; int mirror=0; sector_t first_bad; int bad_sectors; - for (i = 0; i < conf->raid_disks; i++) - if (r1_bio->bios[i] == bio) { - mirror = i; - break; - } + mirror = find_bio_disk(r1_bio, bio); + if (!uptodate) { sector_t sync_blocks = 0; sector_t s = r1_bio->sector; @@ -1404,8 +1410,6 @@ static void end_sync_write(struct bio *bio, int error) ) set_bit(R1BIO_MadeGood, &r1_bio->state); - update_head_pos(mirror, r1_bio); - if (atomic_dec_and_test(&r1_bio->remaining)) { int s = r1_bio->sectors; if (test_bit(R1BIO_MadeGood, &r1_bio->state) || -- cgit v1.2.2 From 0fc280f606742e8a2969776b2ab11cf6a614d9e1 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 7 Oct 2011 14:22:55 +1100 Subject: md/raid1/ avoid bio search in end_sync_read() We know which device we just read from so we don't need to search the bios to find out. Just use ->read_disk. Signed-off-by: NeilBrown --- drivers/md/raid1.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index a0c02fb8af2a..77fab07abcee 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1358,8 +1358,7 @@ static void end_sync_read(struct bio *bio, int error) { r1bio_t *r1_bio = bio->bi_private; - /* this will call update_head_pos() */ - find_bio_disk(r1_bio, bio); + update_head_pos(r1_bio->read_disk, r1_bio); /* * we have read a block, now it needs to be re-written, -- cgit v1.2.2 From db298e1946c074c83d97f1c959fbc0def2af2c86 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 7 Oct 2011 14:23:00 +1100 Subject: md/raid5: convert to macros into inline functions. More type-safety. Easier to read. Signed-off-by: NeilBrown --- drivers/md/raid5.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 6ab3434b2359..01163c81e740 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -70,7 +70,11 @@ #define NR_HASH (PAGE_SIZE / sizeof(struct hlist_head)) #define HASH_MASK (NR_HASH - 1) -#define stripe_hash(conf, sect) (&((conf)->stripe_hashtbl[((sect) >> STRIPE_SHIFT) & HASH_MASK])) +static inline struct hlist_head *stripe_hash(raid5_conf_t *conf, sector_t sect) +{ + int hash = (sect >> STRIPE_SHIFT) & HASH_MASK; + return &conf->stripe_hashtbl[hash]; +} /* bio's attached to a stripe+device for I/O are linked together in bi_sector * order without overlap. There may be several bio's per stripe+device, and @@ -78,10 +82,17 @@ * When walking this list for a particular stripe+device, we must never proceed * beyond a bio that extends past this device, as the next bio might no longer * be valid. - * This macro is used to determine the 'next' bio in the list, given the sector + * This function is used to determine the 'next' bio in the list, given the sector * of the current stripe+device */ -#define r5_next_bio(bio, sect) ( ( (bio)->bi_sector + ((bio)->bi_size>>9) < sect + STRIPE_SECTORS) ? (bio)->bi_next : NULL) +static inline struct bio *r5_next_bio(struct bio *bio, sector_t sector) +{ + int sectors = bio->bi_size >> 9; + if (bio->bi_sector + sectors < sector + STRIPE_SECTORS) + return bio->bi_next; + else + return NULL; +} /* * The following can be used to debug the driver */ -- cgit v1.2.2 From bdc04e6b15f70a8f96d8cdfe21df159a6466b49a Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 7 Oct 2011 14:23:04 +1100 Subject: md: remove some old DEBUGging code. This code is not really helpful and is hard to maintain, so just discard it. Signed-off-by: NeilBrown --- drivers/md/raid0.c | 27 -------------------------- drivers/md/raid5.c | 57 ------------------------------------------------------ 2 files changed, 84 deletions(-) diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index e86bf3682e1e..20823b20bfcf 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -528,33 +528,6 @@ bad_map: static void raid0_status(struct seq_file *seq, mddev_t *mddev) { -#undef MD_DEBUG -#ifdef MD_DEBUG - int j, k, h; - char b[BDEVNAME_SIZE]; - raid0_conf_t *conf = mddev->private; - int raid_disks = conf->strip_zone[0].nb_dev; - - sector_t zone_size; - sector_t zone_start = 0; - h = 0; - - for (j = 0; j < conf->nr_strip_zones; j++) { - seq_printf(seq, " z%d", j); - seq_printf(seq, "=["); - for (k = 0; k < conf->strip_zone[j].nb_dev; k++) - seq_printf(seq, "%s/", bdevname( - conf->devlist[j*raid_disks + k] - ->bdev, b)); - - zone_size = conf->strip_zone[j].zone_end - zone_start; - seq_printf(seq, "] ze=%lld ds=%lld s=%lld\n", - (unsigned long long)zone_start>>1, - (unsigned long long)conf->strip_zone[j].dev_start>>1, - (unsigned long long)zone_size>>1); - zone_start = conf->strip_zone[j].zone_end; - } -#endif seq_printf(seq, " %dk chunks", mddev->chunk_sectors / 2); return; } diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 01163c81e740..245946e9e4c9 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -93,20 +93,6 @@ static inline struct bio *r5_next_bio(struct bio *bio, sector_t sector) else return NULL; } -/* - * The following can be used to debug the driver - */ -#define RAID5_PARANOIA 1 -#if RAID5_PARANOIA && defined(CONFIG_SMP) -# define CHECK_DEVLOCK() assert_spin_locked(&conf->device_lock) -#else -# define CHECK_DEVLOCK() -#endif - -#ifdef DEBUG -#define inline -#define __inline__ -#endif /* * We maintain a biased count of active stripes in the bottom 16 bits of @@ -262,7 +248,6 @@ static inline void insert_hash(raid5_conf_t *conf, struct stripe_head *sh) pr_debug("insert_hash(), stripe %llu\n", (unsigned long long)sh->sector); - CHECK_DEVLOCK(); hlist_add_head(&sh->hash, hp); } @@ -273,7 +258,6 @@ static struct stripe_head *get_free_stripe(raid5_conf_t *conf) struct stripe_head *sh = NULL; struct list_head *first; - CHECK_DEVLOCK(); if (list_empty(&conf->inactive_list)) goto out; first = conf->inactive_list.next; @@ -329,7 +313,6 @@ static void init_stripe(struct stripe_head *sh, sector_t sector, int previous) BUG_ON(test_bit(STRIPE_HANDLE, &sh->state)); BUG_ON(stripe_operations_active(sh)); - CHECK_DEVLOCK(); pr_debug("init_stripe called, stripe %llu\n", (unsigned long long)sh->sector); @@ -365,7 +348,6 @@ static struct stripe_head *__find_stripe(raid5_conf_t *conf, sector_t sector, struct stripe_head *sh; struct hlist_node *hn; - CHECK_DEVLOCK(); pr_debug("__find_stripe, sector %llu\n", (unsigned long long)sector); hlist_for_each_entry(sh, hn, stripe_hash(conf, sector), hash) if (sh->sector == sector && sh->generation == generation) @@ -4973,41 +4955,6 @@ static int stop(mddev_t *mddev) return 0; } -#ifdef DEBUG -static void print_sh(struct seq_file *seq, struct stripe_head *sh) -{ - int i; - - seq_printf(seq, "sh %llu, pd_idx %d, state %ld.\n", - (unsigned long long)sh->sector, sh->pd_idx, sh->state); - seq_printf(seq, "sh %llu, count %d.\n", - (unsigned long long)sh->sector, atomic_read(&sh->count)); - seq_printf(seq, "sh %llu, ", (unsigned long long)sh->sector); - for (i = 0; i < sh->disks; i++) { - seq_printf(seq, "(cache%d: %p %ld) ", - i, sh->dev[i].page, sh->dev[i].flags); - } - seq_printf(seq, "\n"); -} - -static void printall(struct seq_file *seq, raid5_conf_t *conf) -{ - struct stripe_head *sh; - struct hlist_node *hn; - int i; - - spin_lock_irq(&conf->device_lock); - for (i = 0; i < NR_HASH; i++) { - hlist_for_each_entry(sh, hn, &conf->stripe_hashtbl[i], hash) { - if (sh->raid_conf != conf) - continue; - print_sh(seq, sh); - } - } - spin_unlock_irq(&conf->device_lock); -} -#endif - static void status(struct seq_file *seq, mddev_t *mddev) { raid5_conf_t *conf = mddev->private; @@ -5021,10 +4968,6 @@ static void status(struct seq_file *seq, mddev_t *mddev) conf->disks[i].rdev && test_bit(In_sync, &conf->disks[i].rdev->flags) ? "U" : "_"); seq_printf (seq, "]"); -#ifdef DEBUG - seq_printf (seq, "\n"); - printall(seq, conf); -#endif } static void print_raid5_conf (raid5_conf_t *conf) -- cgit v1.2.2 From 36a4e1fe0f454146724c174bf7c1e8e76297a212 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 7 Oct 2011 14:23:17 +1100 Subject: md: remove PRINTK and dprintk debugging and use pr_debug Being able to dynamically enable these make them much more useful. Signed-off-by: NeilBrown --- drivers/md/bitmap.c | 33 +++++++++++++-------------------- drivers/md/md.c | 28 +++++++++++----------------- drivers/md/raid1.c | 24 +++++++++++------------- 3 files changed, 35 insertions(+), 50 deletions(-) diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 689623c3cffa..cd722b83a0c9 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c @@ -50,14 +50,6 @@ #define INJECT_FATAL_FAULT_3 0 /* undef */ #endif -#ifndef PRINTK -# if DEBUG > 0 -# define PRINTK(x...) printk(KERN_DEBUG x) -# else -# define PRINTK(x...) -# endif -#endif - static inline char *bmname(struct bitmap *bitmap) { return bitmap->mddev ? mdname(bitmap->mddev) : "mdX"; @@ -78,8 +70,8 @@ static unsigned char *bitmap_alloc_page(struct bitmap *bitmap) if (!page) printk("%s: bitmap_alloc_page FAILED\n", bmname(bitmap)); else - PRINTK("%s: bitmap_alloc_page: allocated page at %p\n", - bmname(bitmap), page); + pr_debug("%s: bitmap_alloc_page: allocated page at %p\n", + bmname(bitmap), page); return page; } @@ -88,7 +80,7 @@ static unsigned char *bitmap_alloc_page(struct bitmap *bitmap) */ static void bitmap_free_page(struct bitmap *bitmap, unsigned char *page) { - PRINTK("%s: bitmap_free_page: free page %p\n", bmname(bitmap), page); + pr_debug("%s: bitmap_free_page: free page %p\n", bmname(bitmap), page); kfree(page); } @@ -133,8 +125,8 @@ __acquires(bitmap->lock) spin_lock_irq(&bitmap->lock); if (mappage == NULL) { - PRINTK("%s: bitmap map page allocation failed, hijacking\n", - bmname(bitmap)); + pr_debug("%s: bitmap map page allocation failed, hijacking\n", + bmname(bitmap)); /* failed - set the hijacked flag so that we can use the * pointer as a counter */ if (!bitmap->bp[page].map) @@ -409,8 +401,8 @@ static struct page *read_page(struct file *file, unsigned long index, struct buffer_head *bh; sector_t block; - PRINTK("read bitmap file (%dB @ %llu)\n", (int)PAGE_SIZE, - (unsigned long long)index << PAGE_SHIFT); + pr_debug("read bitmap file (%dB @ %llu)\n", (int)PAGE_SIZE, + (unsigned long long)index << PAGE_SHIFT); page = alloc_page(GFP_KERNEL); if (!page) @@ -920,7 +912,7 @@ static void bitmap_file_set_bit(struct bitmap *bitmap, sector_t block) else __set_bit_le(bit, kaddr); kunmap_atomic(kaddr, KM_USER0); - PRINTK("set file bit %lu page %lu\n", bit, page->index); + pr_debug("set file bit %lu page %lu\n", bit, page->index); /* record page number so it gets flushed to disk when unplug occurs */ set_page_attr(bitmap, page, BITMAP_PAGE_DIRTY); } @@ -1364,8 +1356,8 @@ int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sect if (bw > bitmap->behind_writes_used) bitmap->behind_writes_used = bw; - PRINTK(KERN_DEBUG "inc write-behind count %d/%d\n", - bw, bitmap->max_write_behind); + pr_debug("inc write-behind count %d/%lu\n", + bw, bitmap->mddev->bitmap_info.max_write_behind); } while (sectors) { @@ -1424,8 +1416,9 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto if (behind) { if (atomic_dec_and_test(&bitmap->behind_writes)) wake_up(&bitmap->behind_wait); - PRINTK(KERN_DEBUG "dec write-behind count %d/%d\n", - atomic_read(&bitmap->behind_writes), bitmap->max_write_behind); + pr_debug("dec write-behind count %d/%lu\n", + atomic_read(&bitmap->behind_writes), + bitmap->mddev->bitmap_info.max_write_behind); } if (bitmap->mddev->degraded) /* Never clear bits or update events_cleared when degraded */ diff --git a/drivers/md/md.c b/drivers/md/md.c index accae4422c06..ca4c283cf462 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -54,9 +54,6 @@ #include "md.h" #include "bitmap.h" -#define DEBUG 0 -#define dprintk(x...) ((void)(DEBUG && printk(x))) - #ifndef MODULE static void autostart_arrays(int part); #endif @@ -2442,27 +2439,23 @@ repeat: sync_sbs(mddev, nospares); spin_unlock_irq(&mddev->write_lock); - dprintk(KERN_INFO - "md: updating %s RAID superblock on device (in sync %d)\n", - mdname(mddev),mddev->in_sync); + pr_debug("md: updating %s RAID superblock on device (in sync %d)\n", + mdname(mddev), mddev->in_sync); bitmap_update_sb(mddev->bitmap); list_for_each_entry(rdev, &mddev->disks, same_set) { char b[BDEVNAME_SIZE]; - dprintk(KERN_INFO "md: "); + if (rdev->sb_loaded != 1) continue; /* no noise on spare devices */ - if (test_bit(Faulty, &rdev->flags)) - dprintk("(skipping faulty "); - dprintk("%s ", bdevname(rdev->bdev,b)); if (!test_bit(Faulty, &rdev->flags)) { md_super_write(mddev,rdev, rdev->sb_start, rdev->sb_size, rdev->sb_page); - dprintk(KERN_INFO "(write) %s's sb offset: %llu\n", - bdevname(rdev->bdev,b), - (unsigned long long)rdev->sb_start); + pr_debug("md: (write) %s's sb offset: %llu\n", + bdevname(rdev->bdev, b), + (unsigned long long)rdev->sb_start); rdev->sb_events = mddev->events; if (rdev->badblocks.size) { md_super_write(mddev, rdev, @@ -2473,7 +2466,8 @@ repeat: } } else - dprintk(")\n"); + pr_debug("md: %s (skipping faulty)\n", + bdevname(rdev->bdev, b)); if (mddev->level == LEVEL_MULTIPATH) /* only need to write one superblock... */ break; @@ -6408,7 +6402,7 @@ static int md_thread(void * arg) void md_wakeup_thread(mdk_thread_t *thread) { if (thread) { - dprintk("md: waking up MD thread %s.\n", thread->tsk->comm); + pr_debug("md: waking up MD thread %s.\n", thread->tsk->comm); set_bit(THREAD_WAKEUP, &thread->flags); wake_up(&thread->wqueue); } @@ -6444,7 +6438,7 @@ void md_unregister_thread(mdk_thread_t **threadp) mdk_thread_t *thread = *threadp; if (!thread) return; - dprintk("interrupting MD-thread pid %d\n", task_pid_nr(thread->tsk)); + pr_debug("interrupting MD-thread pid %d\n", task_pid_nr(thread->tsk)); /* Locking ensures that mddev_unlock does not wake_up a * non-existent thread */ @@ -8112,7 +8106,7 @@ static struct notifier_block md_notifier = { static void md_geninit(void) { - dprintk("md: sizeof(mdp_super_t) = %d\n", (int)sizeof(mdp_super_t)); + pr_debug("md: sizeof(mdp_super_t) = %d\n", (int)sizeof(mdp_super_t)); proc_create("mdstat", S_IRUGO, NULL, &md_seq_fops); } diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 77fab07abcee..c8993fb8286c 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -40,9 +40,6 @@ #include "raid1.h" #include "bitmap.h" -#define DEBUG 0 -#define PRINTK(x...) do { if (DEBUG) printk(x); } while (0) - /* * Number of guaranteed r1bios in case of extreme VM load: */ @@ -246,11 +243,11 @@ static void raid_end_bio_io(r1bio_t *r1_bio) /* if nobody has done the final endio yet, do it now */ if (!test_and_set_bit(R1BIO_Returned, &r1_bio->state)) { - PRINTK(KERN_DEBUG "raid1: sync end %s on sectors %llu-%llu\n", - (bio_data_dir(bio) == WRITE) ? "write" : "read", - (unsigned long long) bio->bi_sector, - (unsigned long long) bio->bi_sector + - (bio->bi_size >> 9) - 1); + pr_debug("raid1: sync end %s on sectors %llu-%llu\n", + (bio_data_dir(bio) == WRITE) ? "write" : "read", + (unsigned long long) bio->bi_sector, + (unsigned long long) bio->bi_sector + + (bio->bi_size >> 9) - 1); call_bio_endio(r1_bio); } @@ -431,10 +428,11 @@ static void raid1_end_write_request(struct bio *bio, int error) /* Maybe we can return now */ if (!test_and_set_bit(R1BIO_Returned, &r1_bio->state)) { struct bio *mbio = r1_bio->master_bio; - PRINTK(KERN_DEBUG "raid1: behind end write sectors %llu-%llu\n", - (unsigned long long) mbio->bi_sector, - (unsigned long long) mbio->bi_sector + - (mbio->bi_size >> 9) - 1); + pr_debug("raid1: behind end write sectors" + " %llu-%llu\n", + (unsigned long long) mbio->bi_sector, + (unsigned long long) mbio->bi_sector + + (mbio->bi_size >> 9) - 1); call_bio_endio(r1_bio); } } @@ -795,7 +793,7 @@ do_sync_io: if (bvecs[i].bv_page) put_page(bvecs[i].bv_page); kfree(bvecs); - PRINTK("%dB behind alloc failed, doing sync I/O\n", bio->bi_size); + pr_debug("%dB behind alloc failed, doing sync I/O\n", bio->bi_size); } static int make_request(mddev_t *mddev, struct bio * bio) -- cgit v1.2.2 From 50de8df4abca1b27dbf7b2f81a56451bd8b5a7d8 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 7 Oct 2011 14:23:22 +1100 Subject: md/raid0: convert some printks to pr_debug. When md assembles a RAID0 array it prints out lots of info which is really just for debugging, so convert that to pr_debug. It also prints out the resulting configuration which could be interesting, so keep that as 'printk' but tidy it up a bit. Signed-off-by: NeilBrown --- drivers/md/raid0.c | 98 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 20823b20bfcf..138ecd7eef51 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -49,32 +49,32 @@ static int raid0_congested(void *data, int bits) */ static void dump_zones(mddev_t *mddev) { - int j, k, h; + int j, k; sector_t zone_size = 0; sector_t zone_start = 0; char b[BDEVNAME_SIZE]; raid0_conf_t *conf = mddev->private; int raid_disks = conf->strip_zone[0].nb_dev; - printk(KERN_INFO "******* %s configuration *********\n", - mdname(mddev)); - h = 0; + printk(KERN_INFO "md: RAID0 configuration for %s - %d zone%s\n", + mdname(mddev), + conf->nr_strip_zones, conf->nr_strip_zones==1?"":"s"); for (j = 0; j < conf->nr_strip_zones; j++) { - printk(KERN_INFO "zone%d=[", j); + printk(KERN_INFO "md: zone%d=[", j); for (k = 0; k < conf->strip_zone[j].nb_dev; k++) - printk(KERN_CONT "%s/", + printk(KERN_CONT "%s%s", k?"/":"", bdevname(conf->devlist[j*raid_disks + k]->bdev, b)); printk(KERN_CONT "]\n"); zone_size = conf->strip_zone[j].zone_end - zone_start; - printk(KERN_INFO " zone offset=%llukb " - "device offset=%llukb size=%llukb\n", + printk(KERN_INFO " zone-offset=%10lluKB, " + "device-offset=%10lluKB, size=%10lluKB\n", (unsigned long long)zone_start>>1, (unsigned long long)conf->strip_zone[j].dev_start>>1, (unsigned long long)zone_size>>1); zone_start = conf->strip_zone[j].zone_end; } - printk(KERN_INFO "**********************************\n\n"); + printk(KERN_INFO "\n"); } static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) @@ -85,14 +85,15 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) struct strip_zone *zone; int cnt; char b[BDEVNAME_SIZE]; + char b2[BDEVNAME_SIZE]; raid0_conf_t *conf = kzalloc(sizeof(*conf), GFP_KERNEL); if (!conf) return -ENOMEM; list_for_each_entry(rdev1, &mddev->disks, same_set) { - printk(KERN_INFO "md/raid0:%s: looking at %s\n", - mdname(mddev), - bdevname(rdev1->bdev, b)); + pr_debug("md/raid0:%s: looking at %s\n", + mdname(mddev), + bdevname(rdev1->bdev, b)); c = 0; /* round size to chunk_size */ @@ -101,16 +102,16 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) rdev1->sectors = sectors * mddev->chunk_sectors; list_for_each_entry(rdev2, &mddev->disks, same_set) { - printk(KERN_INFO "md/raid0:%s: comparing %s(%llu)", - mdname(mddev), - bdevname(rdev1->bdev,b), - (unsigned long long)rdev1->sectors); - printk(KERN_CONT " with %s(%llu)\n", - bdevname(rdev2->bdev,b), - (unsigned long long)rdev2->sectors); + pr_debug("md/raid0:%s: comparing %s(%llu)" + " with %s(%llu)\n", + mdname(mddev), + bdevname(rdev1->bdev,b), + (unsigned long long)rdev1->sectors, + bdevname(rdev2->bdev,b2), + (unsigned long long)rdev2->sectors); if (rdev2 == rdev1) { - printk(KERN_INFO "md/raid0:%s: END\n", - mdname(mddev)); + pr_debug("md/raid0:%s: END\n", + mdname(mddev)); break; } if (rdev2->sectors == rdev1->sectors) { @@ -118,24 +119,24 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) * Not unique, don't count it as a new * group */ - printk(KERN_INFO "md/raid0:%s: EQUAL\n", - mdname(mddev)); + pr_debug("md/raid0:%s: EQUAL\n", + mdname(mddev)); c = 1; break; } - printk(KERN_INFO "md/raid0:%s: NOT EQUAL\n", - mdname(mddev)); + pr_debug("md/raid0:%s: NOT EQUAL\n", + mdname(mddev)); } if (!c) { - printk(KERN_INFO "md/raid0:%s: ==> UNIQUE\n", - mdname(mddev)); + pr_debug("md/raid0:%s: ==> UNIQUE\n", + mdname(mddev)); conf->nr_strip_zones++; - printk(KERN_INFO "md/raid0:%s: %d zones\n", - mdname(mddev), conf->nr_strip_zones); + pr_debug("md/raid0:%s: %d zones\n", + mdname(mddev), conf->nr_strip_zones); } } - printk(KERN_INFO "md/raid0:%s: FINAL %d zones\n", - mdname(mddev), conf->nr_strip_zones); + pr_debug("md/raid0:%s: FINAL %d zones\n", + mdname(mddev), conf->nr_strip_zones); err = -ENOMEM; conf->strip_zone = kzalloc(sizeof(struct strip_zone)* conf->nr_strip_zones, GFP_KERNEL); @@ -218,44 +219,45 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) zone = conf->strip_zone + i; dev = conf->devlist + i * mddev->raid_disks; - printk(KERN_INFO "md/raid0:%s: zone %d\n", - mdname(mddev), i); + pr_debug("md/raid0:%s: zone %d\n", mdname(mddev), i); zone->dev_start = smallest->sectors; smallest = NULL; c = 0; for (j=0; jdevlist[j]; - printk(KERN_INFO "md/raid0:%s: checking %s ...", - mdname(mddev), - bdevname(rdev->bdev, b)); if (rdev->sectors <= zone->dev_start) { - printk(KERN_CONT " nope.\n"); + pr_debug("md/raid0:%s: checking %s ... nope\n", + mdname(mddev), + bdevname(rdev->bdev, b)); continue; } - printk(KERN_CONT " contained as device %d\n", c); + pr_debug("md/raid0:%s: checking %s ..." + " contained as device %d\n", + mdname(mddev), + bdevname(rdev->bdev, b), c); dev[c] = rdev; c++; if (!smallest || rdev->sectors < smallest->sectors) { smallest = rdev; - printk(KERN_INFO "md/raid0:%s: (%llu) is smallest!.\n", - mdname(mddev), - (unsigned long long)rdev->sectors); + pr_debug("md/raid0:%s: (%llu) is smallest!.\n", + mdname(mddev), + (unsigned long long)rdev->sectors); } } zone->nb_dev = c; sectors = (smallest->sectors - zone->dev_start) * c; - printk(KERN_INFO "md/raid0:%s: zone->nb_dev: %d, sectors: %llu\n", - mdname(mddev), - zone->nb_dev, (unsigned long long)sectors); + pr_debug("md/raid0:%s: zone->nb_dev: %d, sectors: %llu\n", + mdname(mddev), + zone->nb_dev, (unsigned long long)sectors); curr_zone_end += sectors; zone->zone_end = curr_zone_end; - printk(KERN_INFO "md/raid0:%s: current zone start: %llu\n", - mdname(mddev), - (unsigned long long)smallest->sectors); + pr_debug("md/raid0:%s: current zone start: %llu\n", + mdname(mddev), + (unsigned long long)smallest->sectors); } mddev->queue->backing_dev_info.congested_fn = raid0_congested; mddev->queue->backing_dev_info.congested_data = mddev; @@ -275,7 +277,7 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) blk_queue_io_opt(mddev->queue, (mddev->chunk_sectors << 9) * mddev->raid_disks); - printk(KERN_INFO "md/raid0:%s: done.\n", mdname(mddev)); + pr_debug("md/raid0:%s: done.\n", mdname(mddev)); *private_conf = conf; return 0; -- cgit v1.2.2 From 3cb03002000f133f9f97269edefd73611eafc873 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 11 Oct 2011 16:45:26 +1100 Subject: md: removing typedefs: mdk_rdev_t -> struct md_rdev The typedefs are just annoying. 'mdk' probably refers to 'md_k.h' which used to be an include file that defined this thing. Signed-off-by: NeilBrown --- drivers/md/bitmap.c | 8 +- drivers/md/dm-raid.c | 18 ++--- drivers/md/faulty.c | 4 +- drivers/md/linear.c | 4 +- drivers/md/linear.h | 2 +- drivers/md/md.c | 212 +++++++++++++++++++++++++------------------------ drivers/md/md.h | 34 ++++---- drivers/md/multipath.c | 14 ++-- drivers/md/multipath.h | 2 +- drivers/md/raid0.c | 14 ++-- drivers/md/raid0.h | 2 +- drivers/md/raid1.c | 46 +++++------ drivers/md/raid1.h | 2 +- drivers/md/raid10.c | 36 ++++----- drivers/md/raid10.h | 2 +- drivers/md/raid5.c | 34 ++++---- drivers/md/raid5.h | 4 +- 17 files changed, 219 insertions(+), 219 deletions(-) diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index cd722b83a0c9..70e8736e3009 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c @@ -185,7 +185,7 @@ static struct page *read_sb_page(mddev_t *mddev, loff_t offset, { /* choose a good rdev and read the page from there */ - mdk_rdev_t *rdev; + struct md_rdev *rdev; sector_t target; int did_alloc = 0; @@ -218,7 +218,7 @@ static struct page *read_sb_page(mddev_t *mddev, loff_t offset, } -static mdk_rdev_t *next_active_rdev(mdk_rdev_t *rdev, mddev_t *mddev) +static struct md_rdev *next_active_rdev(struct md_rdev *rdev, mddev_t *mddev) { /* Iterate the disks of an mddev, using rcu to protect access to the * linked list, and raising the refcount of devices we return to ensure @@ -239,7 +239,7 @@ static mdk_rdev_t *next_active_rdev(mdk_rdev_t *rdev, mddev_t *mddev) pos = &rdev->same_set; } list_for_each_continue_rcu(pos, &mddev->disks) { - rdev = list_entry(pos, mdk_rdev_t, same_set); + rdev = list_entry(pos, struct md_rdev, same_set); if (rdev->raid_disk >= 0 && !test_bit(Faulty, &rdev->flags)) { /* this is a usable devices */ @@ -254,7 +254,7 @@ static mdk_rdev_t *next_active_rdev(mdk_rdev_t *rdev, mddev_t *mddev) static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait) { - mdk_rdev_t *rdev = NULL; + struct md_rdev *rdev = NULL; struct block_device *bdev; mddev_t *mddev = bitmap->mddev; diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index a002dd85db1e..a2213d5808f4 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -37,7 +37,7 @@ struct raid_dev { */ struct dm_dev *meta_dev; struct dm_dev *data_dev; - struct mdk_rdev_s rdev; + struct md_rdev rdev; }; /* @@ -594,7 +594,7 @@ struct dm_raid_superblock { /* Always set to 0 when writing. */ } __packed; -static int read_disk_sb(mdk_rdev_t *rdev, int size) +static int read_disk_sb(struct md_rdev *rdev, int size) { BUG_ON(!rdev->sb_page); @@ -611,9 +611,9 @@ static int read_disk_sb(mdk_rdev_t *rdev, int size) return 0; } -static void super_sync(mddev_t *mddev, mdk_rdev_t *rdev) +static void super_sync(mddev_t *mddev, struct md_rdev *rdev) { - mdk_rdev_t *r, *t; + struct md_rdev *r, *t; uint64_t failed_devices; struct dm_raid_superblock *sb; @@ -651,7 +651,7 @@ static void super_sync(mddev_t *mddev, mdk_rdev_t *rdev) * * Return: 1 if use rdev, 0 if use refdev, -Exxx otherwise */ -static int super_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev) +static int super_load(struct md_rdev *rdev, struct md_rdev *refdev) { int ret; struct dm_raid_superblock *sb; @@ -689,7 +689,7 @@ static int super_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev) return (events_sb > events_refsb) ? 1 : 0; } -static int super_init_validation(mddev_t *mddev, mdk_rdev_t *rdev) +static int super_init_validation(mddev_t *mddev, struct md_rdev *rdev) { int role; struct raid_set *rs = container_of(mddev, struct raid_set, md); @@ -698,7 +698,7 @@ static int super_init_validation(mddev_t *mddev, mdk_rdev_t *rdev) struct dm_raid_superblock *sb; uint32_t new_devs = 0; uint32_t rebuilds = 0; - mdk_rdev_t *r, *t; + struct md_rdev *r, *t; struct dm_raid_superblock *sb2; sb = page_address(rdev->sb_page); @@ -809,7 +809,7 @@ static int super_init_validation(mddev_t *mddev, mdk_rdev_t *rdev) return 0; } -static int super_validate(mddev_t *mddev, mdk_rdev_t *rdev) +static int super_validate(mddev_t *mddev, struct md_rdev *rdev) { struct dm_raid_superblock *sb = page_address(rdev->sb_page); @@ -849,7 +849,7 @@ static int super_validate(mddev_t *mddev, mdk_rdev_t *rdev) static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs) { int ret; - mdk_rdev_t *rdev, *freshest, *tmp; + struct md_rdev *rdev, *freshest, *tmp; mddev_t *mddev = &rs->md; freshest = NULL; diff --git a/drivers/md/faulty.c b/drivers/md/faulty.c index 23078dabb6df..a0fa5a01ee2f 100644 --- a/drivers/md/faulty.c +++ b/drivers/md/faulty.c @@ -87,7 +87,7 @@ typedef struct faulty_conf { sector_t faults[MaxFault]; int modes[MaxFault]; int nfaults; - mdk_rdev_t *rdev; + struct md_rdev *rdev; } conf_t; static int check_mode(conf_t *conf, int mode) @@ -297,7 +297,7 @@ static sector_t faulty_size(mddev_t *mddev, sector_t sectors, int raid_disks) static int run(mddev_t *mddev) { - mdk_rdev_t *rdev; + struct md_rdev *rdev; int i; conf_t *conf; diff --git a/drivers/md/linear.c b/drivers/md/linear.c index 6cd2c313e800..0b5cac0fda1a 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c @@ -126,7 +126,7 @@ static sector_t linear_size(mddev_t *mddev, sector_t sectors, int raid_disks) static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) { linear_conf_t *conf; - mdk_rdev_t *rdev; + struct md_rdev *rdev; int i, cnt; conf = kzalloc (sizeof (*conf) + raid_disks*sizeof(dev_info_t), @@ -213,7 +213,7 @@ static int linear_run (mddev_t *mddev) return md_integrity_register(mddev); } -static int linear_add(mddev_t *mddev, mdk_rdev_t *rdev) +static int linear_add(mddev_t *mddev, struct md_rdev *rdev) { /* Adding a drive to a linear array allows the array to grow. * It is permitted if the new drive has a matching superblock diff --git a/drivers/md/linear.h b/drivers/md/linear.h index 2f2da05b2ce9..367967a53009 100644 --- a/drivers/md/linear.h +++ b/drivers/md/linear.h @@ -2,7 +2,7 @@ #define _LINEAR_H struct dev_info { - mdk_rdev_t *rdev; + struct md_rdev *rdev; sector_t end_sector; }; diff --git a/drivers/md/md.c b/drivers/md/md.c index ca4c283cf462..e015f403d69e 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -420,7 +420,7 @@ EXPORT_SYMBOL(mddev_congested); static void md_end_flush(struct bio *bio, int err) { - mdk_rdev_t *rdev = bio->bi_private; + struct md_rdev *rdev = bio->bi_private; mddev_t *mddev = rdev->mddev; rdev_dec_pending(rdev, mddev); @@ -437,7 +437,7 @@ static void md_submit_flush_data(struct work_struct *ws); static void submit_flushes(struct work_struct *ws) { mddev_t *mddev = container_of(ws, mddev_t, flush_work); - mdk_rdev_t *rdev; + struct md_rdev *rdev; INIT_WORK(&mddev->flush_work, md_submit_flush_data); atomic_set(&mddev->flush_pending, 1); @@ -749,9 +749,9 @@ static void mddev_unlock(mddev_t * mddev) spin_unlock(&pers_lock); } -static mdk_rdev_t * find_rdev_nr(mddev_t *mddev, int nr) +static struct md_rdev * find_rdev_nr(mddev_t *mddev, int nr) { - mdk_rdev_t *rdev; + struct md_rdev *rdev; list_for_each_entry(rdev, &mddev->disks, same_set) if (rdev->desc_nr == nr) @@ -760,9 +760,9 @@ static mdk_rdev_t * find_rdev_nr(mddev_t *mddev, int nr) return NULL; } -static mdk_rdev_t * find_rdev(mddev_t * mddev, dev_t dev) +static struct md_rdev * find_rdev(mddev_t * mddev, dev_t dev) { - mdk_rdev_t *rdev; + struct md_rdev *rdev; list_for_each_entry(rdev, &mddev->disks, same_set) if (rdev->bdev->bd_dev == dev) @@ -784,13 +784,13 @@ static struct mdk_personality *find_pers(int level, char *clevel) } /* return the offset of the super block in 512byte sectors */ -static inline sector_t calc_dev_sboffset(mdk_rdev_t *rdev) +static inline sector_t calc_dev_sboffset(struct md_rdev *rdev) { sector_t num_sectors = i_size_read(rdev->bdev->bd_inode) / 512; return MD_NEW_SIZE_SECTORS(num_sectors); } -static int alloc_disk_sb(mdk_rdev_t * rdev) +static int alloc_disk_sb(struct md_rdev * rdev) { if (rdev->sb_page) MD_BUG(); @@ -804,7 +804,7 @@ static int alloc_disk_sb(mdk_rdev_t * rdev) return 0; } -static void free_disk_sb(mdk_rdev_t * rdev) +static void free_disk_sb(struct md_rdev * rdev) { if (rdev->sb_page) { put_page(rdev->sb_page); @@ -822,7 +822,7 @@ static void free_disk_sb(mdk_rdev_t * rdev) static void super_written(struct bio *bio, int error) { - mdk_rdev_t *rdev = bio->bi_private; + struct md_rdev *rdev = bio->bi_private; mddev_t *mddev = rdev->mddev; if (error || !test_bit(BIO_UPTODATE, &bio->bi_flags)) { @@ -837,7 +837,7 @@ static void super_written(struct bio *bio, int error) bio_put(bio); } -void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, +void md_super_write(mddev_t *mddev, struct md_rdev *rdev, sector_t sector, int size, struct page *page) { /* write first size bytes of page to sector of rdev @@ -876,7 +876,7 @@ static void bi_complete(struct bio *bio, int error) complete((struct completion*)bio->bi_private); } -int sync_page_io(mdk_rdev_t *rdev, sector_t sector, int size, +int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, struct page *page, int rw, bool metadata_op) { struct bio *bio = bio_alloc_mddev(GFP_NOIO, 1, rdev->mddev); @@ -904,7 +904,7 @@ int sync_page_io(mdk_rdev_t *rdev, sector_t sector, int size, } EXPORT_SYMBOL_GPL(sync_page_io); -static int read_disk_sb(mdk_rdev_t * rdev, int size) +static int read_disk_sb(struct md_rdev * rdev, int size) { char b[BDEVNAME_SIZE]; if (!rdev->sb_page) { @@ -1011,7 +1011,7 @@ static unsigned int calc_sb_csum(mdp_super_t * sb) * We rely on user-space to write the initial superblock, and support * reading and updating of superblocks. * Interface methods are: - * int load_super(mdk_rdev_t *dev, mdk_rdev_t *refdev, int minor_version) + * int load_super(struct md_rdev *dev, struct md_rdev *refdev, int minor_version) * loads and validates a superblock on dev. * if refdev != NULL, compare superblocks on both devices * Return: @@ -1021,13 +1021,13 @@ static unsigned int calc_sb_csum(mdp_super_t * sb) * -EINVAL superblock incompatible or invalid * -othererror e.g. -EIO * - * int validate_super(mddev_t *mddev, mdk_rdev_t *dev) + * int validate_super(mddev_t *mddev, struct md_rdev *dev) * Verify that dev is acceptable into mddev. * The first time, mddev->raid_disks will be 0, and data from * dev should be merged in. Subsequent calls check that dev * is new enough. Return 0 or -EINVAL * - * void sync_super(mddev_t *mddev, mdk_rdev_t *dev) + * void sync_super(mddev_t *mddev, struct md_rdev *dev) * Update the superblock for rdev with data in mddev * This does not write to disc. * @@ -1036,11 +1036,11 @@ static unsigned int calc_sb_csum(mdp_super_t * sb) struct super_type { char *name; struct module *owner; - int (*load_super)(mdk_rdev_t *rdev, mdk_rdev_t *refdev, + int (*load_super)(struct md_rdev *rdev, struct md_rdev *refdev, int minor_version); - int (*validate_super)(mddev_t *mddev, mdk_rdev_t *rdev); - void (*sync_super)(mddev_t *mddev, mdk_rdev_t *rdev); - unsigned long long (*rdev_size_change)(mdk_rdev_t *rdev, + int (*validate_super)(mddev_t *mddev, struct md_rdev *rdev); + void (*sync_super)(mddev_t *mddev, struct md_rdev *rdev); + unsigned long long (*rdev_size_change)(struct md_rdev *rdev, sector_t num_sectors); }; @@ -1065,7 +1065,7 @@ EXPORT_SYMBOL(md_check_no_bitmap); /* * load_super for 0.90.0 */ -static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version) +static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_version) { char b[BDEVNAME_SIZE], b2[BDEVNAME_SIZE]; mdp_super_t *sb; @@ -1160,7 +1160,7 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version /* * validate_super for 0.90.0 */ -static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev) +static int super_90_validate(mddev_t *mddev, struct md_rdev *rdev) { mdp_disk_t *desc; mdp_super_t *sb = page_address(rdev->sb_page); @@ -1272,10 +1272,10 @@ static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev) /* * sync_super for 0.90.0 */ -static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev) +static void super_90_sync(mddev_t *mddev, struct md_rdev *rdev) { mdp_super_t *sb; - mdk_rdev_t *rdev2; + struct md_rdev *rdev2; int next_spare = mddev->raid_disks; @@ -1416,7 +1416,7 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev) * rdev_size_change for 0.90.0 */ static unsigned long long -super_90_rdev_size_change(mdk_rdev_t *rdev, sector_t num_sectors) +super_90_rdev_size_change(struct md_rdev *rdev, sector_t num_sectors) { if (num_sectors && num_sectors < rdev->mddev->dev_sectors) return 0; /* component must fit device */ @@ -1466,7 +1466,7 @@ static __le32 calc_sb_1_csum(struct mdp_superblock_1 * sb) static int md_set_badblocks(struct badblocks *bb, sector_t s, int sectors, int acknowledged); -static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version) +static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_version) { struct mdp_superblock_1 *sb; int ret; @@ -1622,7 +1622,7 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version) return ret; } -static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev) +static int super_1_validate(mddev_t *mddev, struct md_rdev *rdev) { struct mdp_superblock_1 *sb = page_address(rdev->sb_page); __u64 ev1 = le64_to_cpu(sb->events); @@ -1723,10 +1723,10 @@ static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev) return 0; } -static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev) +static void super_1_sync(mddev_t *mddev, struct md_rdev *rdev) { struct mdp_superblock_1 *sb; - mdk_rdev_t *rdev2; + struct md_rdev *rdev2; int max_dev, i; /* make rdev->sb match mddev and rdev data. */ @@ -1848,7 +1848,7 @@ retry: } static unsigned long long -super_1_rdev_size_change(mdk_rdev_t *rdev, sector_t num_sectors) +super_1_rdev_size_change(struct md_rdev *rdev, sector_t num_sectors) { struct mdp_superblock_1 *sb; sector_t max_sectors; @@ -1902,7 +1902,7 @@ static struct super_type super_types[] = { }, }; -static void sync_super(mddev_t *mddev, mdk_rdev_t *rdev) +static void sync_super(mddev_t *mddev, struct md_rdev *rdev) { if (mddev->sync_super) { mddev->sync_super(mddev, rdev); @@ -1916,7 +1916,7 @@ static void sync_super(mddev_t *mddev, mdk_rdev_t *rdev) static int match_mddev_units(mddev_t *mddev1, mddev_t *mddev2) { - mdk_rdev_t *rdev, *rdev2; + struct md_rdev *rdev, *rdev2; rcu_read_lock(); rdev_for_each_rcu(rdev, mddev1) @@ -1941,7 +1941,7 @@ static LIST_HEAD(pending_raid_disks); */ int md_integrity_register(mddev_t *mddev) { - mdk_rdev_t *rdev, *reference = NULL; + struct md_rdev *rdev, *reference = NULL; if (list_empty(&mddev->disks)) return 0; /* nothing to do */ @@ -1986,7 +1986,7 @@ int md_integrity_register(mddev_t *mddev) EXPORT_SYMBOL(md_integrity_register); /* Disable data integrity if non-capable/non-matching disk is being added */ -void md_integrity_add_rdev(mdk_rdev_t *rdev, mddev_t *mddev) +void md_integrity_add_rdev(struct md_rdev *rdev, mddev_t *mddev) { struct blk_integrity *bi_rdev = bdev_get_integrity(rdev->bdev); struct blk_integrity *bi_mddev = blk_get_integrity(mddev->gendisk); @@ -2003,7 +2003,7 @@ void md_integrity_add_rdev(mdk_rdev_t *rdev, mddev_t *mddev) } EXPORT_SYMBOL(md_integrity_add_rdev); -static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev) +static int bind_rdev_to_array(struct md_rdev * rdev, mddev_t * mddev) { char b[BDEVNAME_SIZE]; struct kobject *ko; @@ -2083,12 +2083,12 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev) static void md_delayed_delete(struct work_struct *ws) { - mdk_rdev_t *rdev = container_of(ws, mdk_rdev_t, del_work); + struct md_rdev *rdev = container_of(ws, struct md_rdev, del_work); kobject_del(&rdev->kobj); kobject_put(&rdev->kobj); } -static void unbind_rdev_from_array(mdk_rdev_t * rdev) +static void unbind_rdev_from_array(struct md_rdev * rdev) { char b[BDEVNAME_SIZE]; if (!rdev->mddev) { @@ -2120,14 +2120,14 @@ static void unbind_rdev_from_array(mdk_rdev_t * rdev) * otherwise reused by a RAID array (or any other kernel * subsystem), by bd_claiming the device. */ -static int lock_rdev(mdk_rdev_t *rdev, dev_t dev, int shared) +static int lock_rdev(struct md_rdev *rdev, dev_t dev, int shared) { int err = 0; struct block_device *bdev; char b[BDEVNAME_SIZE]; bdev = blkdev_get_by_dev(dev, FMODE_READ|FMODE_WRITE|FMODE_EXCL, - shared ? (mdk_rdev_t *)lock_rdev : rdev); + shared ? (struct md_rdev *)lock_rdev : rdev); if (IS_ERR(bdev)) { printk(KERN_ERR "md: could not open %s.\n", __bdevname(dev, b)); @@ -2137,7 +2137,7 @@ static int lock_rdev(mdk_rdev_t *rdev, dev_t dev, int shared) return err; } -static void unlock_rdev(mdk_rdev_t *rdev) +static void unlock_rdev(struct md_rdev *rdev) { struct block_device *bdev = rdev->bdev; rdev->bdev = NULL; @@ -2148,7 +2148,7 @@ static void unlock_rdev(mdk_rdev_t *rdev) void md_autodetect_dev(dev_t dev); -static void export_rdev(mdk_rdev_t * rdev) +static void export_rdev(struct md_rdev * rdev) { char b[BDEVNAME_SIZE]; printk(KERN_INFO "md: export_rdev(%s)\n", @@ -2164,7 +2164,7 @@ static void export_rdev(mdk_rdev_t * rdev) kobject_put(&rdev->kobj); } -static void kick_rdev_from_array(mdk_rdev_t * rdev) +static void kick_rdev_from_array(struct md_rdev * rdev) { unbind_rdev_from_array(rdev); export_rdev(rdev); @@ -2172,7 +2172,7 @@ static void kick_rdev_from_array(mdk_rdev_t * rdev) static void export_array(mddev_t *mddev) { - mdk_rdev_t *rdev, *tmp; + struct md_rdev *rdev, *tmp; rdev_for_each(rdev, tmp, mddev) { if (!rdev->mddev) { @@ -2268,7 +2268,7 @@ static void print_sb_1(struct mdp_superblock_1 *sb) ); } -static void print_rdev(mdk_rdev_t *rdev, int major_version) +static void print_rdev(struct md_rdev *rdev, int major_version) { char b[BDEVNAME_SIZE]; printk(KERN_INFO "md: rdev %s, Sect:%08llu F:%d S:%d DN:%u\n", @@ -2292,7 +2292,7 @@ static void print_rdev(mdk_rdev_t *rdev, int major_version) static void md_print_devices(void) { struct list_head *tmp; - mdk_rdev_t *rdev; + struct md_rdev *rdev; mddev_t *mddev; char b[BDEVNAME_SIZE]; @@ -2326,7 +2326,7 @@ static void sync_sbs(mddev_t * mddev, int nospares) * (which would mean they aren't being marked as dirty * with the rest of the array) */ - mdk_rdev_t *rdev; + struct md_rdev *rdev; list_for_each_entry(rdev, &mddev->disks, same_set) { if (rdev->sb_events == mddev->events || (nospares && @@ -2343,7 +2343,7 @@ static void sync_sbs(mddev_t * mddev, int nospares) static void md_update_sb(mddev_t * mddev, int force_change) { - mdk_rdev_t *rdev; + struct md_rdev *rdev; int sync_req; int nospares = 0; int any_badblocks_changed = 0; @@ -2521,12 +2521,12 @@ static int cmd_match(const char *cmd, const char *str) struct rdev_sysfs_entry { struct attribute attr; - ssize_t (*show)(mdk_rdev_t *, char *); - ssize_t (*store)(mdk_rdev_t *, const char *, size_t); + ssize_t (*show)(struct md_rdev *, char *); + ssize_t (*store)(struct md_rdev *, const char *, size_t); }; static ssize_t -state_show(mdk_rdev_t *rdev, char *page) +state_show(struct md_rdev *rdev, char *page) { char *sep = ""; size_t len = 0; @@ -2562,7 +2562,7 @@ state_show(mdk_rdev_t *rdev, char *page) } static ssize_t -state_store(mdk_rdev_t *rdev, const char *buf, size_t len) +state_store(struct md_rdev *rdev, const char *buf, size_t len) { /* can write * faulty - simulates an error @@ -2635,13 +2635,13 @@ static struct rdev_sysfs_entry rdev_state = __ATTR(state, S_IRUGO|S_IWUSR, state_show, state_store); static ssize_t -errors_show(mdk_rdev_t *rdev, char *page) +errors_show(struct md_rdev *rdev, char *page) { return sprintf(page, "%d\n", atomic_read(&rdev->corrected_errors)); } static ssize_t -errors_store(mdk_rdev_t *rdev, const char *buf, size_t len) +errors_store(struct md_rdev *rdev, const char *buf, size_t len) { char *e; unsigned long n = simple_strtoul(buf, &e, 10); @@ -2655,7 +2655,7 @@ static struct rdev_sysfs_entry rdev_errors = __ATTR(errors, S_IRUGO|S_IWUSR, errors_show, errors_store); static ssize_t -slot_show(mdk_rdev_t *rdev, char *page) +slot_show(struct md_rdev *rdev, char *page) { if (rdev->raid_disk < 0) return sprintf(page, "none\n"); @@ -2664,7 +2664,7 @@ slot_show(mdk_rdev_t *rdev, char *page) } static ssize_t -slot_store(mdk_rdev_t *rdev, const char *buf, size_t len) +slot_store(struct md_rdev *rdev, const char *buf, size_t len) { char *e; int err; @@ -2695,7 +2695,7 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len) set_bit(MD_RECOVERY_NEEDED, &rdev->mddev->recovery); md_wakeup_thread(rdev->mddev->thread); } else if (rdev->mddev->pers) { - mdk_rdev_t *rdev2; + struct md_rdev *rdev2; /* Activating a spare .. or possibly reactivating * if we ever get bitmaps working here. */ @@ -2751,13 +2751,13 @@ static struct rdev_sysfs_entry rdev_slot = __ATTR(slot, S_IRUGO|S_IWUSR, slot_show, slot_store); static ssize_t -offset_show(mdk_rdev_t *rdev, char *page) +offset_show(struct md_rdev *rdev, char *page) { return sprintf(page, "%llu\n", (unsigned long long)rdev->data_offset); } static ssize_t -offset_store(mdk_rdev_t *rdev, const char *buf, size_t len) +offset_store(struct md_rdev *rdev, const char *buf, size_t len) { char *e; unsigned long long offset = simple_strtoull(buf, &e, 10); @@ -2777,7 +2777,7 @@ static struct rdev_sysfs_entry rdev_offset = __ATTR(offset, S_IRUGO|S_IWUSR, offset_show, offset_store); static ssize_t -rdev_size_show(mdk_rdev_t *rdev, char *page) +rdev_size_show(struct md_rdev *rdev, char *page) { return sprintf(page, "%llu\n", (unsigned long long)rdev->sectors / 2); } @@ -2812,7 +2812,7 @@ static int strict_blocks_to_sectors(const char *buf, sector_t *sectors) } static ssize_t -rdev_size_store(mdk_rdev_t *rdev, const char *buf, size_t len) +rdev_size_store(struct md_rdev *rdev, const char *buf, size_t len) { mddev_t *my_mddev = rdev->mddev; sector_t oldsectors = rdev->sectors; @@ -2846,7 +2846,7 @@ rdev_size_store(mdk_rdev_t *rdev, const char *buf, size_t len) mddev_unlock(my_mddev); for_each_mddev(mddev, tmp) { - mdk_rdev_t *rdev2; + struct md_rdev *rdev2; mddev_lock(mddev); list_for_each_entry(rdev2, &mddev->disks, same_set) @@ -2883,7 +2883,7 @@ static struct rdev_sysfs_entry rdev_size = __ATTR(size, S_IRUGO|S_IWUSR, rdev_size_show, rdev_size_store); -static ssize_t recovery_start_show(mdk_rdev_t *rdev, char *page) +static ssize_t recovery_start_show(struct md_rdev *rdev, char *page) { unsigned long long recovery_start = rdev->recovery_offset; @@ -2894,7 +2894,7 @@ static ssize_t recovery_start_show(mdk_rdev_t *rdev, char *page) return sprintf(page, "%llu\n", recovery_start); } -static ssize_t recovery_start_store(mdk_rdev_t *rdev, const char *buf, size_t len) +static ssize_t recovery_start_store(struct md_rdev *rdev, const char *buf, size_t len) { unsigned long long recovery_start; @@ -2924,11 +2924,11 @@ badblocks_show(struct badblocks *bb, char *page, int unack); static ssize_t badblocks_store(struct badblocks *bb, const char *page, size_t len, int unack); -static ssize_t bb_show(mdk_rdev_t *rdev, char *page) +static ssize_t bb_show(struct md_rdev *rdev, char *page) { return badblocks_show(&rdev->badblocks, page, 0); } -static ssize_t bb_store(mdk_rdev_t *rdev, const char *page, size_t len) +static ssize_t bb_store(struct md_rdev *rdev, const char *page, size_t len) { int rv = badblocks_store(&rdev->badblocks, page, len, 0); /* Maybe that ack was all we needed */ @@ -2940,11 +2940,11 @@ static struct rdev_sysfs_entry rdev_bad_blocks = __ATTR(bad_blocks, S_IRUGO|S_IWUSR, bb_show, bb_store); -static ssize_t ubb_show(mdk_rdev_t *rdev, char *page) +static ssize_t ubb_show(struct md_rdev *rdev, char *page) { return badblocks_show(&rdev->badblocks, page, 1); } -static ssize_t ubb_store(mdk_rdev_t *rdev, const char *page, size_t len) +static ssize_t ubb_store(struct md_rdev *rdev, const char *page, size_t len) { return badblocks_store(&rdev->badblocks, page, len, 1); } @@ -2966,7 +2966,7 @@ static ssize_t rdev_attr_show(struct kobject *kobj, struct attribute *attr, char *page) { struct rdev_sysfs_entry *entry = container_of(attr, struct rdev_sysfs_entry, attr); - mdk_rdev_t *rdev = container_of(kobj, mdk_rdev_t, kobj); + struct md_rdev *rdev = container_of(kobj, struct md_rdev, kobj); mddev_t *mddev = rdev->mddev; ssize_t rv; @@ -2989,7 +2989,7 @@ rdev_attr_store(struct kobject *kobj, struct attribute *attr, const char *page, size_t length) { struct rdev_sysfs_entry *entry = container_of(attr, struct rdev_sysfs_entry, attr); - mdk_rdev_t *rdev = container_of(kobj, mdk_rdev_t, kobj); + struct md_rdev *rdev = container_of(kobj, struct md_rdev, kobj); ssize_t rv; mddev_t *mddev = rdev->mddev; @@ -3010,7 +3010,7 @@ rdev_attr_store(struct kobject *kobj, struct attribute *attr, static void rdev_free(struct kobject *ko) { - mdk_rdev_t *rdev = container_of(ko, mdk_rdev_t, kobj); + struct md_rdev *rdev = container_of(ko, struct md_rdev, kobj); kfree(rdev); } static const struct sysfs_ops rdev_sysfs_ops = { @@ -3023,7 +3023,7 @@ static struct kobj_type rdev_ktype = { .default_attrs = rdev_default_attrs, }; -int md_rdev_init(mdk_rdev_t *rdev) +int md_rdev_init(struct md_rdev *rdev) { rdev->desc_nr = -1; rdev->saved_raid_disk = -1; @@ -3066,11 +3066,11 @@ EXPORT_SYMBOL_GPL(md_rdev_init); * * a faulty rdev _never_ has rdev->sb set. */ -static mdk_rdev_t *md_import_device(dev_t newdev, int super_format, int super_minor) +static struct md_rdev *md_import_device(dev_t newdev, int super_format, int super_minor) { char b[BDEVNAME_SIZE]; int err; - mdk_rdev_t *rdev; + struct md_rdev *rdev; sector_t size; rdev = kzalloc(sizeof(*rdev), GFP_KERNEL); @@ -3142,7 +3142,7 @@ abort_free: static void analyze_sbs(mddev_t * mddev) { int i; - mdk_rdev_t *rdev, *freshest, *tmp; + struct md_rdev *rdev, *freshest, *tmp; char b[BDEVNAME_SIZE]; freshest = NULL; @@ -3291,7 +3291,7 @@ level_store(mddev_t *mddev, const char *buf, size_t len) struct mdk_personality *pers; long level; void *priv; - mdk_rdev_t *rdev; + struct md_rdev *rdev; if (mddev->pers == NULL) { if (len == 0) @@ -3836,7 +3836,7 @@ new_dev_store(mddev_t *mddev, const char *buf, size_t len) int major = simple_strtoul(buf, &e, 10); int minor; dev_t dev; - mdk_rdev_t *rdev; + struct md_rdev *rdev; int err; if (!*buf || *e != ':' || !e[1] || e[1] == '\n') @@ -3854,8 +3854,9 @@ new_dev_store(mddev_t *mddev, const char *buf, size_t len) rdev = md_import_device(dev, mddev->major_version, mddev->minor_version); if (!IS_ERR(rdev) && !list_empty(&mddev->disks)) { - mdk_rdev_t *rdev0 = list_entry(mddev->disks.next, - mdk_rdev_t, same_set); + struct md_rdev *rdev0 + = list_entry(mddev->disks.next, + struct md_rdev, same_set); err = super_types[mddev->major_version] .load_super(rdev, rdev0, mddev->minor_version); if (err < 0) @@ -4698,7 +4699,7 @@ static int start_dirty_degraded; int md_run(mddev_t *mddev) { int err; - mdk_rdev_t *rdev; + struct md_rdev *rdev; struct mdk_personality *pers; if (list_empty(&mddev->disks)) @@ -4798,7 +4799,7 @@ int md_run(mddev_t *mddev) * configuration. */ char b[BDEVNAME_SIZE], b2[BDEVNAME_SIZE]; - mdk_rdev_t *rdev2; + struct md_rdev *rdev2; int warned = 0; list_for_each_entry(rdev, &mddev->disks, same_set) @@ -5087,7 +5088,7 @@ out: static int do_md_stop(mddev_t * mddev, int mode, int is_open) { struct gendisk *disk = mddev->gendisk; - mdk_rdev_t *rdev; + struct md_rdev *rdev; mutex_lock(&mddev->open_mutex); if (atomic_read(&mddev->openers) > is_open || @@ -5152,7 +5153,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) #ifndef MODULE static void autorun_array(mddev_t *mddev) { - mdk_rdev_t *rdev; + struct md_rdev *rdev; int err; if (list_empty(&mddev->disks)) @@ -5187,7 +5188,7 @@ static void autorun_array(mddev_t *mddev) */ static void autorun_devices(int part) { - mdk_rdev_t *rdev0, *rdev, *tmp; + struct md_rdev *rdev0, *rdev, *tmp; mddev_t *mddev; char b[BDEVNAME_SIZE]; @@ -5197,7 +5198,7 @@ static void autorun_devices(int part) dev_t dev; LIST_HEAD(candidates); rdev0 = list_entry(pending_raid_disks.next, - mdk_rdev_t, same_set); + struct md_rdev, same_set); printk(KERN_INFO "md: considering %s ...\n", bdevname(rdev0->bdev,b)); @@ -5287,7 +5288,7 @@ static int get_array_info(mddev_t * mddev, void __user * arg) { mdu_array_info_t info; int nr,working,insync,failed,spare; - mdk_rdev_t *rdev; + struct md_rdev *rdev; nr=working=insync=failed=spare=0; list_for_each_entry(rdev, &mddev->disks, same_set) { @@ -5379,7 +5380,7 @@ out: static int get_disk_info(mddev_t * mddev, void __user * arg) { mdu_disk_info_t info; - mdk_rdev_t *rdev; + struct md_rdev *rdev; if (copy_from_user(&info, arg, sizeof(info))) return -EFAULT; @@ -5413,7 +5414,7 @@ static int get_disk_info(mddev_t * mddev, void __user * arg) static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) { char b[BDEVNAME_SIZE], b2[BDEVNAME_SIZE]; - mdk_rdev_t *rdev; + struct md_rdev *rdev; dev_t dev = MKDEV(info->major,info->minor); if (info->major != MAJOR(dev) || info->minor != MINOR(dev)) @@ -5430,8 +5431,9 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) return PTR_ERR(rdev); } if (!list_empty(&mddev->disks)) { - mdk_rdev_t *rdev0 = list_entry(mddev->disks.next, - mdk_rdev_t, same_set); + struct md_rdev *rdev0 + = list_entry(mddev->disks.next, + struct md_rdev, same_set); err = super_types[mddev->major_version] .load_super(rdev, rdev0, mddev->minor_version); if (err < 0) { @@ -5584,7 +5586,7 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) static int hot_remove_disk(mddev_t * mddev, dev_t dev) { char b[BDEVNAME_SIZE]; - mdk_rdev_t *rdev; + struct md_rdev *rdev; rdev = find_rdev(mddev, dev); if (!rdev) @@ -5608,7 +5610,7 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev) { char b[BDEVNAME_SIZE]; int err; - mdk_rdev_t *rdev; + struct md_rdev *rdev; if (!mddev->pers) return -ENODEV; @@ -5834,7 +5836,7 @@ EXPORT_SYMBOL(md_set_array_sectors); static int update_size(mddev_t *mddev, sector_t num_sectors) { - mdk_rdev_t *rdev; + struct md_rdev *rdev; int rv; int fit = (num_sectors == 0); @@ -5993,7 +5995,7 @@ static int update_array_info(mddev_t *mddev, mdu_array_info_t *info) static int set_disk_faulty(mddev_t *mddev, dev_t dev) { - mdk_rdev_t *rdev; + struct md_rdev *rdev; if (mddev->pers == NULL) return -ENODEV; @@ -6450,7 +6452,7 @@ void md_unregister_thread(mdk_thread_t **threadp) kfree(thread); } -void md_error(mddev_t *mddev, mdk_rdev_t *rdev) +void md_error(mddev_t *mddev, struct md_rdev *rdev) { if (!mddev) { MD_BUG(); @@ -6479,7 +6481,7 @@ void md_error(mddev_t *mddev, mdk_rdev_t *rdev) static void status_unused(struct seq_file *seq) { int i = 0; - mdk_rdev_t *rdev; + struct md_rdev *rdev; seq_printf(seq, "unused devices: "); @@ -6649,7 +6651,7 @@ static int md_seq_show(struct seq_file *seq, void *v) { mddev_t *mddev = v; sector_t sectors; - mdk_rdev_t *rdev; + struct md_rdev *rdev; struct bitmap *bitmap; if (v == (void*)1) { @@ -6829,7 +6831,7 @@ int unregister_md_personality(struct mdk_personality *p) static int is_mddev_idle(mddev_t *mddev, int init) { - mdk_rdev_t * rdev; + struct md_rdev * rdev; int idle; int curr_events; @@ -6987,7 +6989,7 @@ void md_do_sync(mddev_t *mddev) struct list_head *tmp; sector_t last_check; int skipped = 0; - mdk_rdev_t *rdev; + struct md_rdev *rdev; char *desc; /* just incase thread restarts... */ @@ -7304,7 +7306,7 @@ EXPORT_SYMBOL_GPL(md_do_sync); static int remove_and_add_spares(mddev_t *mddev) { - mdk_rdev_t *rdev; + struct md_rdev *rdev; int spares = 0; mddev->curr_resync_completed = 0; @@ -7348,7 +7350,7 @@ static int remove_and_add_spares(mddev_t *mddev) static void reap_sync_thread(mddev_t *mddev) { - mdk_rdev_t *rdev; + struct md_rdev *rdev; /* resync has finished, collect result */ md_unregister_thread(&mddev->sync_thread); @@ -7443,7 +7445,7 @@ void md_check_recovery(mddev_t *mddev) /* Only thing we do on a ro array is remove * failed devices. */ - mdk_rdev_t *rdev; + struct md_rdev *rdev; list_for_each_entry(rdev, &mddev->disks, same_set) if (rdev->raid_disk >= 0 && !test_bit(Blocked, &rdev->flags) && @@ -7567,7 +7569,7 @@ void md_check_recovery(mddev_t *mddev) } } -void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev) +void md_wait_for_blocked_rdev(struct md_rdev *rdev, mddev_t *mddev) { sysfs_notify_dirent_safe(rdev->sysfs_state); wait_event_timeout(rdev->blocked_wait, @@ -7825,7 +7827,7 @@ static int md_set_badblocks(struct badblocks *bb, sector_t s, int sectors, return rv; } -int rdev_set_badblocks(mdk_rdev_t *rdev, sector_t s, int sectors, +int rdev_set_badblocks(struct md_rdev *rdev, sector_t s, int sectors, int acknowledged) { int rv = md_set_badblocks(&rdev->badblocks, @@ -7934,7 +7936,7 @@ out: return rv; } -int rdev_clear_badblocks(mdk_rdev_t *rdev, sector_t s, int sectors) +int rdev_clear_badblocks(struct md_rdev *rdev, sector_t s, int sectors) { return md_clear_badblocks(&rdev->badblocks, s + rdev->data_offset, @@ -8181,7 +8183,7 @@ void md_autodetect_dev(dev_t dev) static void autostart_arrays(int part) { - mdk_rdev_t *rdev; + struct md_rdev *rdev; struct detected_devices_node *node_detected_dev; dev_t dev; int i_scanned, i_passed; diff --git a/drivers/md/md.h b/drivers/md/md.h index f412b6e3aa73..b0e98c868c14 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -27,7 +27,6 @@ #define MaxSector (~(sector_t)0) typedef struct mddev_s mddev_t; -typedef struct mdk_rdev_s mdk_rdev_t; /* Bad block numbers are stored sorted in a single page. * 64bits is used for each block or extent. @@ -39,8 +38,7 @@ typedef struct mdk_rdev_s mdk_rdev_t; /* * MD's 'extended' device */ -struct mdk_rdev_s -{ +struct md_rdev { struct list_head same_set; /* RAID devices within the same set */ sector_t sectors; /* Device size (in 512bytes sectors) */ @@ -168,7 +166,7 @@ struct mdk_rdev_s extern int md_is_badblock(struct badblocks *bb, sector_t s, int sectors, sector_t *first_bad, int *bad_sectors); -static inline int is_badblock(mdk_rdev_t *rdev, sector_t s, int sectors, +static inline int is_badblock(struct md_rdev *rdev, sector_t s, int sectors, sector_t *first_bad, int *bad_sectors) { if (unlikely(rdev->badblocks.count)) { @@ -181,9 +179,9 @@ static inline int is_badblock(mdk_rdev_t *rdev, sector_t s, int sectors, } return 0; } -extern int rdev_set_badblocks(mdk_rdev_t *rdev, sector_t s, int sectors, +extern int rdev_set_badblocks(struct md_rdev *rdev, sector_t s, int sectors, int acknowledged); -extern int rdev_clear_badblocks(mdk_rdev_t *rdev, sector_t s, int sectors); +extern int rdev_clear_badblocks(struct md_rdev *rdev, sector_t s, int sectors); extern void md_ack_all_badblocks(struct badblocks *bb); struct mddev_s @@ -402,11 +400,11 @@ struct mddev_s atomic_t flush_pending; struct work_struct flush_work; struct work_struct event_work; /* used by dm to report failure event */ - void (*sync_super)(mddev_t *mddev, mdk_rdev_t *rdev); + void (*sync_super)(mddev_t *mddev, struct md_rdev *rdev); }; -static inline void rdev_dec_pending(mdk_rdev_t *rdev, mddev_t *mddev) +static inline void rdev_dec_pending(struct md_rdev *rdev, mddev_t *mddev) { int faulty = test_bit(Faulty, &rdev->flags); if (atomic_dec_and_test(&rdev->nr_pending) && faulty) @@ -431,8 +429,8 @@ struct mdk_personality /* error_handler must set ->faulty and clear ->in_sync * if appropriate, and should abort recovery if needed */ - void (*error_handler)(mddev_t *mddev, mdk_rdev_t *rdev); - int (*hot_add_disk) (mddev_t *mddev, mdk_rdev_t *rdev); + void (*error_handler)(mddev_t *mddev, struct md_rdev *rdev); + int (*hot_add_disk) (mddev_t *mddev, struct md_rdev *rdev); int (*hot_remove_disk) (mddev_t *mddev, int number); int (*spare_active) (mddev_t *mddev); sector_t (*sync_request)(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster); @@ -484,14 +482,14 @@ static inline char * mdname (mddev_t * mddev) return mddev->gendisk ? mddev->gendisk->disk_name : "mdX"; } -static inline int sysfs_link_rdev(mddev_t *mddev, mdk_rdev_t *rdev) +static inline int sysfs_link_rdev(mddev_t *mddev, struct md_rdev *rdev) { char nm[20]; sprintf(nm, "rd%d", rdev->raid_disk); return sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); } -static inline void sysfs_unlink_rdev(mddev_t *mddev, mdk_rdev_t *rdev) +static inline void sysfs_unlink_rdev(mddev_t *mddev, struct md_rdev *rdev) { char nm[20]; sprintf(nm, "rd%d", rdev->raid_disk); @@ -566,23 +564,23 @@ extern void md_check_recovery(mddev_t *mddev); extern void md_write_start(mddev_t *mddev, struct bio *bi); extern void md_write_end(mddev_t *mddev); extern void md_done_sync(mddev_t *mddev, int blocks, int ok); -extern void md_error(mddev_t *mddev, mdk_rdev_t *rdev); +extern void md_error(mddev_t *mddev, struct md_rdev *rdev); extern int mddev_congested(mddev_t *mddev, int bits); extern void md_flush_request(mddev_t *mddev, struct bio *bio); -extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, +extern void md_super_write(mddev_t *mddev, struct md_rdev *rdev, sector_t sector, int size, struct page *page); extern void md_super_wait(mddev_t *mddev); -extern int sync_page_io(mdk_rdev_t *rdev, sector_t sector, int size, +extern int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, struct page *page, int rw, bool metadata_op); extern void md_do_sync(mddev_t *mddev); extern void md_new_event(mddev_t *mddev); extern int md_allow_write(mddev_t *mddev); -extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev); +extern void md_wait_for_blocked_rdev(struct md_rdev *rdev, mddev_t *mddev); extern void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors); extern int md_check_no_bitmap(mddev_t *mddev); extern int md_integrity_register(mddev_t *mddev); -extern void md_integrity_add_rdev(mdk_rdev_t *rdev, mddev_t *mddev); +extern void md_integrity_add_rdev(struct md_rdev *rdev, mddev_t *mddev); extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale); extern void restore_bitmap_write_access(struct file *file); @@ -590,7 +588,7 @@ extern void mddev_init(mddev_t *mddev); extern int md_run(mddev_t *mddev); extern void md_stop(mddev_t *mddev); extern void md_stop_writes(mddev_t *mddev); -extern int md_rdev_init(mdk_rdev_t *rdev); +extern int md_rdev_init(struct md_rdev *rdev); extern void mddev_suspend(mddev_t *mddev); extern void mddev_resume(mddev_t *mddev); diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index d5b5fb300171..09e8aa3d59f9 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c @@ -42,7 +42,7 @@ static int multipath_map (multipath_conf_t *conf) rcu_read_lock(); for (i = 0; i < disks; i++) { - mdk_rdev_t *rdev = rcu_dereference(conf->multipaths[i].rdev); + struct md_rdev *rdev = rcu_dereference(conf->multipaths[i].rdev); if (rdev && test_bit(In_sync, &rdev->flags)) { atomic_inc(&rdev->nr_pending); rcu_read_unlock(); @@ -87,7 +87,7 @@ static void multipath_end_request(struct bio *bio, int error) int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); struct multipath_bh *mp_bh = bio->bi_private; multipath_conf_t *conf = mp_bh->mddev->private; - mdk_rdev_t *rdev = conf->multipaths[mp_bh->path].rdev; + struct md_rdev *rdev = conf->multipaths[mp_bh->path].rdev; if (uptodate) multipath_end_bh_io(mp_bh, 0); @@ -165,7 +165,7 @@ static int multipath_congested(void *data, int bits) rcu_read_lock(); for (i = 0; i < mddev->raid_disks ; i++) { - mdk_rdev_t *rdev = rcu_dereference(conf->multipaths[i].rdev); + struct md_rdev *rdev = rcu_dereference(conf->multipaths[i].rdev); if (rdev && !test_bit(Faulty, &rdev->flags)) { struct request_queue *q = bdev_get_queue(rdev->bdev); @@ -183,7 +183,7 @@ static int multipath_congested(void *data, int bits) /* * Careful, this can execute in IRQ contexts as well! */ -static void multipath_error (mddev_t *mddev, mdk_rdev_t *rdev) +static void multipath_error (mddev_t *mddev, struct md_rdev *rdev) { multipath_conf_t *conf = mddev->private; char b[BDEVNAME_SIZE]; @@ -242,7 +242,7 @@ static void print_multipath_conf (multipath_conf_t *conf) } -static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) +static int multipath_add_disk(mddev_t *mddev, struct md_rdev *rdev) { multipath_conf_t *conf = mddev->private; struct request_queue *q; @@ -295,7 +295,7 @@ static int multipath_remove_disk(mddev_t *mddev, int number) { multipath_conf_t *conf = mddev->private; int err = 0; - mdk_rdev_t *rdev; + struct md_rdev *rdev; struct multipath_info *p = conf->multipaths + number; print_multipath_conf(conf); @@ -392,7 +392,7 @@ static int multipath_run (mddev_t *mddev) multipath_conf_t *conf; int disk_idx; struct multipath_info *disk; - mdk_rdev_t *rdev; + struct md_rdev *rdev; int working_disks; if (md_check_no_bitmap(mddev)) diff --git a/drivers/md/multipath.h b/drivers/md/multipath.h index 3c5a45eb5f8a..034f8381e046 100644 --- a/drivers/md/multipath.h +++ b/drivers/md/multipath.h @@ -2,7 +2,7 @@ #define _MULTIPATH_H struct multipath_info { - mdk_rdev_t *rdev; + struct md_rdev *rdev; }; struct multipath_private_data { diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 138ecd7eef51..70fc3d949795 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -29,7 +29,7 @@ static int raid0_congested(void *data, int bits) { mddev_t *mddev = data; raid0_conf_t *conf = mddev->private; - mdk_rdev_t **devlist = conf->devlist; + struct md_rdev **devlist = conf->devlist; int raid_disks = conf->strip_zone[0].nb_dev; int i, ret = 0; @@ -81,7 +81,7 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) { int i, c, err; sector_t curr_zone_end, sectors; - mdk_rdev_t *smallest, *rdev1, *rdev2, *rdev, **dev; + struct md_rdev *smallest, *rdev1, *rdev2, *rdev, **dev; struct strip_zone *zone; int cnt; char b[BDEVNAME_SIZE]; @@ -142,7 +142,7 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) conf->nr_strip_zones, GFP_KERNEL); if (!conf->strip_zone) goto abort; - conf->devlist = kzalloc(sizeof(mdk_rdev_t*)* + conf->devlist = kzalloc(sizeof(struct md_rdev*)* conf->nr_strip_zones*mddev->raid_disks, GFP_KERNEL); if (!conf->devlist) @@ -323,7 +323,7 @@ static int raid0_mergeable_bvec(struct request_queue *q, static sector_t raid0_size(mddev_t *mddev, sector_t sectors, int raid_disks) { sector_t array_sectors = 0; - mdk_rdev_t *rdev; + struct md_rdev *rdev; WARN_ONCE(sectors || raid_disks, "%s does not support generic reshape\n", __func__); @@ -419,7 +419,7 @@ static struct strip_zone *find_zone(struct raid0_private_data *conf, * remaps the bio to the target device. we separate two flows. * power 2 flow and a general flow for the sake of perfromance */ -static mdk_rdev_t *map_sector(mddev_t *mddev, struct strip_zone *zone, +static struct md_rdev *map_sector(mddev_t *mddev, struct strip_zone *zone, sector_t sector, sector_t *sector_offset) { unsigned int sect_in_chunk; @@ -473,7 +473,7 @@ static int raid0_make_request(mddev_t *mddev, struct bio *bio) unsigned int chunk_sects; sector_t sector_offset; struct strip_zone *zone; - mdk_rdev_t *tmp_dev; + struct md_rdev *tmp_dev; if (unlikely(bio->bi_rw & REQ_FLUSH)) { md_flush_request(mddev, bio); @@ -536,7 +536,7 @@ static void raid0_status(struct seq_file *seq, mddev_t *mddev) static void *raid0_takeover_raid45(mddev_t *mddev) { - mdk_rdev_t *rdev; + struct md_rdev *rdev; raid0_conf_t *priv_conf; if (mddev->degraded != 1) { diff --git a/drivers/md/raid0.h b/drivers/md/raid0.h index 91f8e876ee64..9d877b8d382c 100644 --- a/drivers/md/raid0.h +++ b/drivers/md/raid0.h @@ -11,7 +11,7 @@ struct strip_zone struct raid0_private_data { struct strip_zone *strip_zone; - mdk_rdev_t **devlist; /* lists of rdevs, pointed to by strip_zone->dev */ + struct md_rdev **devlist; /* lists of rdevs, pointed to by strip_zone->dev */ int nr_strip_zones; }; diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index c8993fb8286c..de7d2b677066 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -475,7 +475,7 @@ static int read_balance(conf_t *conf, r1bio_t *r1_bio, int *max_sectors) int best_disk; int i; sector_t best_dist; - mdk_rdev_t *rdev; + struct md_rdev *rdev; int choose_first; rcu_read_lock(); @@ -600,7 +600,7 @@ int md_raid1_congested(mddev_t *mddev, int bits) rcu_read_lock(); for (i = 0; i < mddev->raid_disks; i++) { - mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); + struct md_rdev *rdev = rcu_dereference(conf->mirrors[i].rdev); if (rdev && !test_bit(Faulty, &rdev->flags)) { struct request_queue *q = bdev_get_queue(rdev->bdev); @@ -808,7 +808,7 @@ static int make_request(mddev_t *mddev, struct bio * bio) const int rw = bio_data_dir(bio); const unsigned long do_sync = (bio->bi_rw & REQ_SYNC); const unsigned long do_flush_fua = (bio->bi_rw & (REQ_FLUSH | REQ_FUA)); - mdk_rdev_t *blocked_rdev; + struct md_rdev *blocked_rdev; int plugged; int first_clone; int sectors_handled; @@ -963,7 +963,7 @@ read_again: rcu_read_lock(); max_sectors = r1_bio->sectors; for (i = 0; i < disks; i++) { - mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); + struct md_rdev *rdev = rcu_dereference(conf->mirrors[i].rdev); if (rdev && unlikely(test_bit(Blocked, &rdev->flags))) { atomic_inc(&rdev->nr_pending); blocked_rdev = rdev; @@ -1147,7 +1147,7 @@ static void status(struct seq_file *seq, mddev_t *mddev) conf->raid_disks - mddev->degraded); rcu_read_lock(); for (i = 0; i < conf->raid_disks; i++) { - mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); + struct md_rdev *rdev = rcu_dereference(conf->mirrors[i].rdev); seq_printf(seq, "%s", rdev && test_bit(In_sync, &rdev->flags) ? "U" : "_"); } @@ -1156,7 +1156,7 @@ static void status(struct seq_file *seq, mddev_t *mddev) } -static void error(mddev_t *mddev, mdk_rdev_t *rdev) +static void error(mddev_t *mddev, struct md_rdev *rdev) { char b[BDEVNAME_SIZE]; conf_t *conf = mddev->private; @@ -1214,7 +1214,7 @@ static void print_conf(conf_t *conf) rcu_read_lock(); for (i = 0; i < conf->raid_disks; i++) { char b[BDEVNAME_SIZE]; - mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); + struct md_rdev *rdev = rcu_dereference(conf->mirrors[i].rdev); if (rdev) printk(KERN_DEBUG " disk %d, wo:%d, o:%d, dev:%s\n", i, !test_bit(In_sync, &rdev->flags), @@ -1246,7 +1246,7 @@ static int raid1_spare_active(mddev_t *mddev) * Called under mddev lock, so rcu protection not needed. */ for (i = 0; i < conf->raid_disks; i++) { - mdk_rdev_t *rdev = conf->mirrors[i].rdev; + struct md_rdev *rdev = conf->mirrors[i].rdev; if (rdev && !test_bit(Faulty, &rdev->flags) && !test_and_set_bit(In_sync, &rdev->flags)) { @@ -1263,7 +1263,7 @@ static int raid1_spare_active(mddev_t *mddev) } -static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) +static int raid1_add_disk(mddev_t *mddev, struct md_rdev *rdev) { conf_t *conf = mddev->private; int err = -EEXIST; @@ -1315,7 +1315,7 @@ static int raid1_remove_disk(mddev_t *mddev, int number) { conf_t *conf = mddev->private; int err = 0; - mdk_rdev_t *rdev; + struct md_rdev *rdev; mirror_info_t *p = conf->mirrors+ number; print_conf(conf); @@ -1419,7 +1419,7 @@ static void end_sync_write(struct bio *bio, int error) } } -static int r1_sync_page_io(mdk_rdev_t *rdev, sector_t sector, +static int r1_sync_page_io(struct md_rdev *rdev, sector_t sector, int sectors, struct page *page, int rw) { if (sync_page_io(rdev, sector, sectors << 9, page, rw, false)) @@ -1457,7 +1457,7 @@ static int fix_sync_read_error(r1bio_t *r1_bio) int s = sectors; int d = r1_bio->read_disk; int success = 0; - mdk_rdev_t *rdev; + struct md_rdev *rdev; int start; if (s > (PAGE_SIZE>>9)) @@ -1696,7 +1696,7 @@ static void fix_read_error(conf_t *conf, int read_disk, int d = read_disk; int success = 0; int start; - mdk_rdev_t *rdev; + struct md_rdev *rdev; if (s > (PAGE_SIZE>>9)) s = PAGE_SIZE >> 9; @@ -1727,7 +1727,7 @@ static void fix_read_error(conf_t *conf, int read_disk, if (!success) { /* Cannot read from anywhere - mark it bad */ - mdk_rdev_t *rdev = conf->mirrors[read_disk].rdev; + struct md_rdev *rdev = conf->mirrors[read_disk].rdev; if (!rdev_set_badblocks(rdev, sect, s, 0)) md_error(mddev, rdev); break; @@ -1794,7 +1794,7 @@ static int narrow_write_error(r1bio_t *r1_bio, int i) { mddev_t *mddev = r1_bio->mddev; conf_t *conf = mddev->private; - mdk_rdev_t *rdev = conf->mirrors[i].rdev; + struct md_rdev *rdev = conf->mirrors[i].rdev; int vcnt, idx; struct bio_vec *vec; @@ -1871,7 +1871,7 @@ static void handle_sync_write_finished(conf_t *conf, r1bio_t *r1_bio) int m; int s = r1_bio->sectors; for (m = 0; m < conf->raid_disks ; m++) { - mdk_rdev_t *rdev = conf->mirrors[m].rdev; + struct md_rdev *rdev = conf->mirrors[m].rdev; struct bio *bio = r1_bio->bios[m]; if (bio->bi_end_io == NULL) continue; @@ -1894,7 +1894,7 @@ static void handle_write_finished(conf_t *conf, r1bio_t *r1_bio) int m; for (m = 0; m < conf->raid_disks ; m++) if (r1_bio->bios[m] == IO_MADE_GOOD) { - mdk_rdev_t *rdev = conf->mirrors[m].rdev; + struct md_rdev *rdev = conf->mirrors[m].rdev; rdev_clear_badblocks(rdev, r1_bio->sector, r1_bio->sectors); @@ -1925,7 +1925,7 @@ static void handle_read_error(conf_t *conf, r1bio_t *r1_bio) mddev_t *mddev = conf->mddev; struct bio *bio; char b[BDEVNAME_SIZE]; - mdk_rdev_t *rdev; + struct md_rdev *rdev; clear_bit(R1BIO_ReadError, &r1_bio->state); /* we got a read error. Maybe the drive is bad. Maybe just @@ -2168,7 +2168,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i set_bit(R1BIO_IsSync, &r1_bio->state); for (i=0; i < conf->raid_disks; i++) { - mdk_rdev_t *rdev; + struct md_rdev *rdev; bio = r1_bio->bios[i]; /* take from bio_init */ @@ -2240,7 +2240,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i int ok = 1; for (i = 0 ; i < conf->raid_disks ; i++) if (r1_bio->bios[i]->bi_end_io == end_sync_write) { - mdk_rdev_t *rdev = + struct md_rdev *rdev = rcu_dereference(conf->mirrors[i].rdev); ok = rdev_set_badblocks(rdev, sector_nr, min_bad, 0 @@ -2370,7 +2370,7 @@ static conf_t *setup_conf(mddev_t *mddev) conf_t *conf; int i; mirror_info_t *disk; - mdk_rdev_t *rdev; + struct md_rdev *rdev; int err = -ENOMEM; conf = kzalloc(sizeof(conf_t), GFP_KERNEL); @@ -2470,7 +2470,7 @@ static int run(mddev_t *mddev) { conf_t *conf; int i; - mdk_rdev_t *rdev; + struct md_rdev *rdev; if (mddev->level != 1) { printk(KERN_ERR "md/raid1:%s: raid level not set to mirroring (%d)\n", @@ -2669,7 +2669,7 @@ static int raid1_reshape(mddev_t *mddev) conf->r1bio_pool = newpool; for (d = d2 = 0; d < conf->raid_disks; d++) { - mdk_rdev_t *rdev = conf->mirrors[d].rdev; + struct md_rdev *rdev = conf->mirrors[d].rdev; if (rdev && rdev->raid_disk != d2) { sysfs_unlink_rdev(mddev, rdev); rdev->raid_disk = d2; diff --git a/drivers/md/raid1.h b/drivers/md/raid1.h index a3d5483873a2..2377a461f794 100644 --- a/drivers/md/raid1.h +++ b/drivers/md/raid1.h @@ -4,7 +4,7 @@ typedef struct mirror_info mirror_info_t; struct mirror_info { - mdk_rdev_t *rdev; + struct md_rdev *rdev; sector_t head_position; }; diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 0cd9672cf9cb..b3b7238c5416 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -562,7 +562,7 @@ static int read_balance(conf_t *conf, r10bio_t *r10_bio, int *max_sectors) int sectors = r10_bio->sectors; int best_good_sectors; sector_t new_distance, best_dist; - mdk_rdev_t *rdev; + struct md_rdev *rdev; int do_balance; int best_slot; @@ -685,7 +685,7 @@ static int raid10_congested(void *data, int bits) return 1; rcu_read_lock(); for (i = 0; i < conf->raid_disks && ret == 0; i++) { - mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); + struct md_rdev *rdev = rcu_dereference(conf->mirrors[i].rdev); if (rdev && !test_bit(Faulty, &rdev->flags)) { struct request_queue *q = bdev_get_queue(rdev->bdev); @@ -842,7 +842,7 @@ static int make_request(mddev_t *mddev, struct bio * bio) const unsigned long do_sync = (bio->bi_rw & REQ_SYNC); const unsigned long do_fua = (bio->bi_rw & REQ_FUA); unsigned long flags; - mdk_rdev_t *blocked_rdev; + struct md_rdev *blocked_rdev; int plugged; int sectors_handled; int max_sectors; @@ -1017,7 +1017,7 @@ retry_write: for (i = 0; i < conf->copies; i++) { int d = r10_bio->devs[i].devnum; - mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[d].rdev); + struct md_rdev *rdev = rcu_dereference(conf->mirrors[d].rdev); if (rdev && unlikely(test_bit(Blocked, &rdev->flags))) { atomic_inc(&rdev->nr_pending); blocked_rdev = rdev; @@ -1209,7 +1209,7 @@ static int enough(conf_t *conf, int ignore) return 1; } -static void error(mddev_t *mddev, mdk_rdev_t *rdev) +static void error(mddev_t *mddev, struct md_rdev *rdev) { char b[BDEVNAME_SIZE]; conf_t *conf = mddev->private; @@ -1309,7 +1309,7 @@ static int raid10_spare_active(mddev_t *mddev) } -static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) +static int raid10_add_disk(mddev_t *mddev, struct md_rdev *rdev) { conf_t *conf = mddev->private; int err = -EEXIST; @@ -1372,7 +1372,7 @@ static int raid10_remove_disk(mddev_t *mddev, int number) { conf_t *conf = mddev->private; int err = 0; - mdk_rdev_t *rdev; + struct md_rdev *rdev; mirror_info_t *p = conf->mirrors+ number; print_conf(conf); @@ -1629,7 +1629,7 @@ static void fix_recovery_read_error(r10bio_t *r10_bio) while (sectors) { int s = sectors; - mdk_rdev_t *rdev; + struct md_rdev *rdev; sector_t addr; int ok; @@ -1663,7 +1663,7 @@ static void fix_recovery_read_error(r10bio_t *r10_bio) if (rdev != conf->mirrors[dw].rdev) { /* need bad block on destination too */ - mdk_rdev_t *rdev2 = conf->mirrors[dw].rdev; + struct md_rdev *rdev2 = conf->mirrors[dw].rdev; addr = r10_bio->devs[1].addr + sect; ok = rdev_set_badblocks(rdev2, addr, s, 0); if (!ok) { @@ -1719,7 +1719,7 @@ static void recovery_request_write(mddev_t *mddev, r10bio_t *r10_bio) * since the last recorded read error. * */ -static void check_decay_read_errors(mddev_t *mddev, mdk_rdev_t *rdev) +static void check_decay_read_errors(mddev_t *mddev, struct md_rdev *rdev) { struct timespec cur_time_mon; unsigned long hours_since_last; @@ -1750,7 +1750,7 @@ static void check_decay_read_errors(mddev_t *mddev, mdk_rdev_t *rdev) atomic_set(&rdev->read_errors, read_errors >> hours_since_last); } -static int r10_sync_page_io(mdk_rdev_t *rdev, sector_t sector, +static int r10_sync_page_io(struct md_rdev *rdev, sector_t sector, int sectors, struct page *page, int rw) { sector_t first_bad; @@ -1782,7 +1782,7 @@ static void fix_read_error(conf_t *conf, mddev_t *mddev, r10bio_t *r10_bio) { int sect = 0; /* Offset from r10_bio->sector */ int sectors = r10_bio->sectors; - mdk_rdev_t*rdev; + struct md_rdev*rdev; int max_read_errors = atomic_read(&mddev->max_corr_read_errors); int d = r10_bio->devs[r10_bio->read_slot].devnum; @@ -1988,7 +1988,7 @@ static int narrow_write_error(r10bio_t *r10_bio, int i) struct bio *bio = r10_bio->master_bio; mddev_t *mddev = r10_bio->mddev; conf_t *conf = mddev->private; - mdk_rdev_t *rdev = conf->mirrors[r10_bio->devs[i].devnum].rdev; + struct md_rdev *rdev = conf->mirrors[r10_bio->devs[i].devnum].rdev; /* bio has the data to be written to slot 'i' where * we just recently had a write error. * We repeatedly clone the bio and trim down to one block, @@ -2046,7 +2046,7 @@ static void handle_read_error(mddev_t *mddev, r10bio_t *r10_bio) int mirror = r10_bio->devs[slot].devnum; struct bio *bio; conf_t *conf = mddev->private; - mdk_rdev_t *rdev; + struct md_rdev *rdev; char b[BDEVNAME_SIZE]; unsigned long do_sync; int max_sectors; @@ -2148,7 +2148,7 @@ static void handle_write_completed(conf_t *conf, r10bio_t *r10_bio) * a bad block. */ int m; - mdk_rdev_t *rdev; + struct md_rdev *rdev; if (test_bit(R10BIO_IsSync, &r10_bio->state) || test_bit(R10BIO_IsRecover, &r10_bio->state)) { @@ -2453,7 +2453,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int k; int d = r10_bio->devs[j].devnum; sector_t from_addr, to_addr; - mdk_rdev_t *rdev; + struct md_rdev *rdev; sector_t sector, first_bad; int bad_sectors; if (!conf->mirrors[d].rdev || @@ -2841,7 +2841,7 @@ static int run(mddev_t *mddev) conf_t *conf; int i, disk_idx, chunk_size; mirror_info_t *disk; - mdk_rdev_t *rdev; + struct md_rdev *rdev; sector_t size; /* @@ -2999,7 +2999,7 @@ static void raid10_quiesce(mddev_t *mddev, int state) static void *raid10_takeover_raid0(mddev_t *mddev) { - mdk_rdev_t *rdev; + struct md_rdev *rdev; conf_t *conf; if (mddev->degraded > 0) { diff --git a/drivers/md/raid10.h b/drivers/md/raid10.h index 79cb52a0d4a2..d37260fe9c3f 100644 --- a/drivers/md/raid10.h +++ b/drivers/md/raid10.h @@ -4,7 +4,7 @@ typedef struct mirror_info mirror_info_t; struct mirror_info { - mdk_rdev_t *rdev; + struct md_rdev *rdev; sector_t head_position; int recovery_disabled; /* matches * mddev->recovery_disabled diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 245946e9e4c9..d0e2a345e4d7 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -379,7 +379,7 @@ static int has_failed(raid5_conf_t *conf) rcu_read_lock(); degraded = 0; for (i = 0; i < conf->previous_raid_disks; i++) { - mdk_rdev_t *rdev = rcu_dereference(conf->disks[i].rdev); + struct md_rdev *rdev = rcu_dereference(conf->disks[i].rdev); if (!rdev || test_bit(Faulty, &rdev->flags)) degraded++; else if (test_bit(In_sync, &rdev->flags)) @@ -403,7 +403,7 @@ static int has_failed(raid5_conf_t *conf) rcu_read_lock(); degraded = 0; for (i = 0; i < conf->raid_disks; i++) { - mdk_rdev_t *rdev = rcu_dereference(conf->disks[i].rdev); + struct md_rdev *rdev = rcu_dereference(conf->disks[i].rdev); if (!rdev || test_bit(Faulty, &rdev->flags)) degraded++; else if (test_bit(In_sync, &rdev->flags)) @@ -492,7 +492,7 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) for (i = disks; i--; ) { int rw; struct bio *bi; - mdk_rdev_t *rdev; + struct md_rdev *rdev; if (test_and_clear_bit(R5_Wantwrite, &sh->dev[i].flags)) { if (test_and_clear_bit(R5_WantFUA, &sh->dev[i].flags)) rw = WRITE_FUA; @@ -1582,7 +1582,7 @@ static void raid5_end_read_request(struct bio * bi, int error) int disks = sh->disks, i; int uptodate = test_bit(BIO_UPTODATE, &bi->bi_flags); char b[BDEVNAME_SIZE]; - mdk_rdev_t *rdev; + struct md_rdev *rdev; for (i=0 ; isector = compute_blocknr(sh, i, previous); } -static void error(mddev_t *mddev, mdk_rdev_t *rdev) +static void error(mddev_t *mddev, struct md_rdev *rdev) { char b[BDEVNAME_SIZE]; raid5_conf_t *conf = mddev->private; @@ -2257,7 +2257,7 @@ handle_failed_stripe(raid5_conf_t *conf, struct stripe_head *sh, int bitmap_end = 0; if (test_bit(R5_ReadError, &sh->dev[i].flags)) { - mdk_rdev_t *rdev; + struct md_rdev *rdev; rcu_read_lock(); rdev = rcu_dereference(conf->disks[i].rdev); if (rdev && test_bit(In_sync, &rdev->flags)) @@ -2371,7 +2371,7 @@ handle_failed_sync(raid5_conf_t *conf, struct stripe_head *sh, * refcounting of rdevs is not needed */ for (i = 0; i < conf->raid_disks; i++) { - mdk_rdev_t *rdev = conf->disks[i].rdev; + struct md_rdev *rdev = conf->disks[i].rdev; if (!rdev || test_bit(Faulty, &rdev->flags) || test_bit(In_sync, &rdev->flags)) @@ -2995,7 +2995,7 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) rcu_read_lock(); spin_lock_irq(&conf->device_lock); for (i=disks; i--; ) { - mdk_rdev_t *rdev; + struct md_rdev *rdev; sector_t first_bad; int bad_sectors; int is_bad = 0; @@ -3334,7 +3334,7 @@ finish: if (s.handle_bad_blocks) for (i = disks; i--; ) { - mdk_rdev_t *rdev; + struct md_rdev *rdev; struct r5dev *dev = &sh->dev[i]; if (test_and_clear_bit(R5_WriteError, &dev->flags)) { /* We own a safe reference to the rdev */ @@ -3523,7 +3523,7 @@ static void raid5_align_endio(struct bio *bi, int error) mddev_t *mddev; raid5_conf_t *conf; int uptodate = test_bit(BIO_UPTODATE, &bi->bi_flags); - mdk_rdev_t *rdev; + struct md_rdev *rdev; bio_put(bi); @@ -3572,7 +3572,7 @@ static int chunk_aligned_read(mddev_t *mddev, struct bio * raid_bio) raid5_conf_t *conf = mddev->private; int dd_idx; struct bio* align_bi; - mdk_rdev_t *rdev; + struct md_rdev *rdev; if (!in_chunk_boundary(mddev, raid_bio)) { pr_debug("chunk_aligned_read : non aligned\n"); @@ -4544,7 +4544,7 @@ static raid5_conf_t *setup_conf(mddev_t *mddev) { raid5_conf_t *conf; int raid_disk, memory, max_disks; - mdk_rdev_t *rdev; + struct md_rdev *rdev; struct disk_info *disk; if (mddev->new_level != 5 @@ -4710,7 +4710,7 @@ static int run(mddev_t *mddev) raid5_conf_t *conf; int working_disks = 0; int dirty_parity_disks = 0; - mdk_rdev_t *rdev; + struct md_rdev *rdev; sector_t reshape_offset = 0; if (mddev->recovery_cp != MaxSector) @@ -5023,7 +5023,7 @@ static int raid5_remove_disk(mddev_t *mddev, int number) { raid5_conf_t *conf = mddev->private; int err = 0; - mdk_rdev_t *rdev; + struct md_rdev *rdev; struct disk_info *p = conf->disks + number; print_raid5_conf(conf); @@ -5062,7 +5062,7 @@ abort: return err; } -static int raid5_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) +static int raid5_add_disk(mddev_t *mddev, struct md_rdev *rdev) { raid5_conf_t *conf = mddev->private; int err = -EEXIST; @@ -5191,7 +5191,7 @@ static int check_reshape(mddev_t *mddev) static int raid5_start_reshape(mddev_t *mddev) { raid5_conf_t *conf = mddev->private; - mdk_rdev_t *rdev; + struct md_rdev *rdev; int spares = 0; unsigned long flags; @@ -5353,7 +5353,7 @@ static void raid5_finish_reshape(mddev_t *mddev) for (d = conf->raid_disks ; d < conf->raid_disks - mddev->delta_disks; d++) { - mdk_rdev_t *rdev = conf->disks[d].rdev; + struct md_rdev *rdev = conf->disks[d].rdev; if (rdev && raid5_remove_disk(mddev, d) == 0) { sysfs_unlink_rdev(mddev, rdev); rdev->raid_disk = -1; diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index 11b9566184b2..6b234af7bf17 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h @@ -248,7 +248,7 @@ struct stripe_head_state { unsigned long ops_request; struct bio *return_bi; - mdk_rdev_t *blocked_rdev; + struct md_rdev *blocked_rdev; int handle_bad_blocks; }; @@ -344,7 +344,7 @@ enum { struct disk_info { - mdk_rdev_t *rdev; + struct md_rdev *rdev; }; struct raid5_private_data { -- cgit v1.2.2 From fd01b88c75a718020ff77e7f560d33835e9b58de Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 11 Oct 2011 16:47:53 +1100 Subject: md: remove typedefs: mddev_t -> struct mddev Having mddev_t and 'struct mddev_s' is ugly and not preferred Signed-off-by: NeilBrown --- drivers/md/bitmap.c | 44 +++--- drivers/md/bitmap.h | 12 +- drivers/md/dm-raid.c | 12 +- drivers/md/faulty.c | 12 +- drivers/md/linear.c | 20 +-- drivers/md/md.c | 360 ++++++++++++++++++++++++------------------------- drivers/md/md.h | 115 ++++++++-------- drivers/md/multipath.c | 22 +-- drivers/md/multipath.h | 4 +- drivers/md/raid0.c | 32 ++--- drivers/md/raid1.c | 52 +++---- drivers/md/raid1.h | 8 +- drivers/md/raid10.c | 54 ++++---- drivers/md/raid10.h | 4 +- drivers/md/raid5.c | 80 +++++------ drivers/md/raid5.h | 6 +- 16 files changed, 417 insertions(+), 420 deletions(-) diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 70e8736e3009..2d5158c8d6be 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c @@ -179,7 +179,7 @@ static void bitmap_checkfree(struct bitmap *bitmap, unsigned long page) */ /* IO operations when bitmap is stored near all superblocks */ -static struct page *read_sb_page(mddev_t *mddev, loff_t offset, +static struct page *read_sb_page(struct mddev *mddev, loff_t offset, struct page *page, unsigned long index, int size) { @@ -218,7 +218,7 @@ static struct page *read_sb_page(mddev_t *mddev, loff_t offset, } -static struct md_rdev *next_active_rdev(struct md_rdev *rdev, mddev_t *mddev) +static struct md_rdev *next_active_rdev(struct md_rdev *rdev, struct mddev *mddev) { /* Iterate the disks of an mddev, using rcu to protect access to the * linked list, and raising the refcount of devices we return to ensure @@ -256,7 +256,7 @@ static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait) { struct md_rdev *rdev = NULL; struct block_device *bdev; - mddev_t *mddev = bitmap->mddev; + struct mddev *mddev = bitmap->mddev; while ((rdev = next_active_rdev(rdev, mddev)) != NULL) { int size = PAGE_SIZE; @@ -1157,7 +1157,7 @@ static bitmap_counter_t *bitmap_get_counter(struct bitmap *bitmap, * out to disk */ -void bitmap_daemon_work(mddev_t *mddev) +void bitmap_daemon_work(struct mddev *mddev) { struct bitmap *bitmap; unsigned long j; @@ -1647,7 +1647,7 @@ void bitmap_dirty_bits(struct bitmap *bitmap, unsigned long s, unsigned long e) /* * flush out any pending updates */ -void bitmap_flush(mddev_t *mddev) +void bitmap_flush(struct mddev *mddev) { struct bitmap *bitmap = mddev->bitmap; long sleep; @@ -1695,7 +1695,7 @@ static void bitmap_free(struct bitmap *bitmap) kfree(bitmap); } -void bitmap_destroy(mddev_t *mddev) +void bitmap_destroy(struct mddev *mddev) { struct bitmap *bitmap = mddev->bitmap; @@ -1718,7 +1718,7 @@ void bitmap_destroy(mddev_t *mddev) * initialize the bitmap structure * if this returns an error, bitmap_destroy must be called to do clean up */ -int bitmap_create(mddev_t *mddev) +int bitmap_create(struct mddev *mddev) { struct bitmap *bitmap; sector_t blocks = mddev->resync_max_sectors; @@ -1822,7 +1822,7 @@ int bitmap_create(mddev_t *mddev) return err; } -int bitmap_load(mddev_t *mddev) +int bitmap_load(struct mddev *mddev) { int err = 0; sector_t start = 0; @@ -1868,7 +1868,7 @@ out: EXPORT_SYMBOL_GPL(bitmap_load); static ssize_t -location_show(mddev_t *mddev, char *page) +location_show(struct mddev *mddev, char *page) { ssize_t len; if (mddev->bitmap_info.file) @@ -1882,7 +1882,7 @@ location_show(mddev_t *mddev, char *page) } static ssize_t -location_store(mddev_t *mddev, const char *buf, size_t len) +location_store(struct mddev *mddev, const char *buf, size_t len) { if (mddev->pers) { @@ -1959,7 +1959,7 @@ static struct md_sysfs_entry bitmap_location = __ATTR(location, S_IRUGO|S_IWUSR, location_show, location_store); static ssize_t -timeout_show(mddev_t *mddev, char *page) +timeout_show(struct mddev *mddev, char *page) { ssize_t len; unsigned long secs = mddev->bitmap_info.daemon_sleep / HZ; @@ -1973,7 +1973,7 @@ timeout_show(mddev_t *mddev, char *page) } static ssize_t -timeout_store(mddev_t *mddev, const char *buf, size_t len) +timeout_store(struct mddev *mddev, const char *buf, size_t len) { /* timeout can be set at any time */ unsigned long timeout; @@ -2009,13 +2009,13 @@ static struct md_sysfs_entry bitmap_timeout = __ATTR(time_base, S_IRUGO|S_IWUSR, timeout_show, timeout_store); static ssize_t -backlog_show(mddev_t *mddev, char *page) +backlog_show(struct mddev *mddev, char *page) { return sprintf(page, "%lu\n", mddev->bitmap_info.max_write_behind); } static ssize_t -backlog_store(mddev_t *mddev, const char *buf, size_t len) +backlog_store(struct mddev *mddev, const char *buf, size_t len) { unsigned long backlog; int rv = strict_strtoul(buf, 10, &backlog); @@ -2031,13 +2031,13 @@ static struct md_sysfs_entry bitmap_backlog = __ATTR(backlog, S_IRUGO|S_IWUSR, backlog_show, backlog_store); static ssize_t -chunksize_show(mddev_t *mddev, char *page) +chunksize_show(struct mddev *mddev, char *page) { return sprintf(page, "%lu\n", mddev->bitmap_info.chunksize); } static ssize_t -chunksize_store(mddev_t *mddev, const char *buf, size_t len) +chunksize_store(struct mddev *mddev, const char *buf, size_t len) { /* Can only be changed when no bitmap is active */ int rv; @@ -2057,13 +2057,13 @@ chunksize_store(mddev_t *mddev, const char *buf, size_t len) static struct md_sysfs_entry bitmap_chunksize = __ATTR(chunksize, S_IRUGO|S_IWUSR, chunksize_show, chunksize_store); -static ssize_t metadata_show(mddev_t *mddev, char *page) +static ssize_t metadata_show(struct mddev *mddev, char *page) { return sprintf(page, "%s\n", (mddev->bitmap_info.external ? "external" : "internal")); } -static ssize_t metadata_store(mddev_t *mddev, const char *buf, size_t len) +static ssize_t metadata_store(struct mddev *mddev, const char *buf, size_t len) { if (mddev->bitmap || mddev->bitmap_info.file || @@ -2081,7 +2081,7 @@ static ssize_t metadata_store(mddev_t *mddev, const char *buf, size_t len) static struct md_sysfs_entry bitmap_metadata = __ATTR(metadata, S_IRUGO|S_IWUSR, metadata_show, metadata_store); -static ssize_t can_clear_show(mddev_t *mddev, char *page) +static ssize_t can_clear_show(struct mddev *mddev, char *page) { int len; if (mddev->bitmap) @@ -2092,7 +2092,7 @@ static ssize_t can_clear_show(mddev_t *mddev, char *page) return len; } -static ssize_t can_clear_store(mddev_t *mddev, const char *buf, size_t len) +static ssize_t can_clear_store(struct mddev *mddev, const char *buf, size_t len) { if (mddev->bitmap == NULL) return -ENOENT; @@ -2111,7 +2111,7 @@ static struct md_sysfs_entry bitmap_can_clear = __ATTR(can_clear, S_IRUGO|S_IWUSR, can_clear_show, can_clear_store); static ssize_t -behind_writes_used_show(mddev_t *mddev, char *page) +behind_writes_used_show(struct mddev *mddev, char *page) { if (mddev->bitmap == NULL) return sprintf(page, "0\n"); @@ -2120,7 +2120,7 @@ behind_writes_used_show(mddev_t *mddev, char *page) } static ssize_t -behind_writes_used_reset(mddev_t *mddev, const char *buf, size_t len) +behind_writes_used_reset(struct mddev *mddev, const char *buf, size_t len) { if (mddev->bitmap) mddev->bitmap->behind_writes_used = 0; diff --git a/drivers/md/bitmap.h b/drivers/md/bitmap.h index a28f2e5588c6..a15436dd9b3e 100644 --- a/drivers/md/bitmap.h +++ b/drivers/md/bitmap.h @@ -193,7 +193,7 @@ struct bitmap { unsigned long pages; /* total number of pages in the bitmap */ unsigned long missing_pages; /* number of pages not yet allocated */ - mddev_t *mddev; /* the md device that the bitmap is for */ + struct mddev *mddev; /* the md device that the bitmap is for */ /* bitmap chunksize -- how much data does each bit represent? */ unsigned long chunkshift; /* chunksize = 2^chunkshift (for bitops) */ @@ -238,10 +238,10 @@ struct bitmap { /* the bitmap API */ /* these are used only by md/bitmap */ -int bitmap_create(mddev_t *mddev); -int bitmap_load(mddev_t *mddev); -void bitmap_flush(mddev_t *mddev); -void bitmap_destroy(mddev_t *mddev); +int bitmap_create(struct mddev *mddev); +int bitmap_load(struct mddev *mddev); +void bitmap_flush(struct mddev *mddev); +void bitmap_destroy(struct mddev *mddev); void bitmap_print_sb(struct bitmap *bitmap); void bitmap_update_sb(struct bitmap *bitmap); @@ -262,7 +262,7 @@ void bitmap_close_sync(struct bitmap *bitmap); void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector); void bitmap_unplug(struct bitmap *bitmap); -void bitmap_daemon_work(mddev_t *mddev); +void bitmap_daemon_work(struct mddev *mddev); #endif #endif diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index a2213d5808f4..c0c30d880447 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -57,7 +57,7 @@ struct raid_set { uint64_t print_flags; - struct mddev_s md; + struct mddev md; struct raid_type *raid_type; struct dm_target_callbacks callbacks; @@ -611,7 +611,7 @@ static int read_disk_sb(struct md_rdev *rdev, int size) return 0; } -static void super_sync(mddev_t *mddev, struct md_rdev *rdev) +static void super_sync(struct mddev *mddev, struct md_rdev *rdev) { struct md_rdev *r, *t; uint64_t failed_devices; @@ -689,7 +689,7 @@ static int super_load(struct md_rdev *rdev, struct md_rdev *refdev) return (events_sb > events_refsb) ? 1 : 0; } -static int super_init_validation(mddev_t *mddev, struct md_rdev *rdev) +static int super_init_validation(struct mddev *mddev, struct md_rdev *rdev) { int role; struct raid_set *rs = container_of(mddev, struct raid_set, md); @@ -809,7 +809,7 @@ static int super_init_validation(mddev_t *mddev, struct md_rdev *rdev) return 0; } -static int super_validate(mddev_t *mddev, struct md_rdev *rdev) +static int super_validate(struct mddev *mddev, struct md_rdev *rdev) { struct dm_raid_superblock *sb = page_address(rdev->sb_page); @@ -850,7 +850,7 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs) { int ret; struct md_rdev *rdev, *freshest, *tmp; - mddev_t *mddev = &rs->md; + struct mddev *mddev = &rs->md; freshest = NULL; rdev_for_each(rdev, tmp, mddev) { @@ -1004,7 +1004,7 @@ static void raid_dtr(struct dm_target *ti) static int raid_map(struct dm_target *ti, struct bio *bio, union map_info *map_context) { struct raid_set *rs = ti->private; - mddev_t *mddev = &rs->md; + struct mddev *mddev = &rs->md; mddev->pers->make_request(mddev, bio); diff --git a/drivers/md/faulty.c b/drivers/md/faulty.c index a0fa5a01ee2f..a2d4c46ff2a1 100644 --- a/drivers/md/faulty.c +++ b/drivers/md/faulty.c @@ -169,7 +169,7 @@ static void add_sector(conf_t *conf, sector_t start, int mode) conf->nfaults = n+1; } -static int make_request(mddev_t *mddev, struct bio *bio) +static int make_request(struct mddev *mddev, struct bio *bio) { conf_t *conf = mddev->private; int failit = 0; @@ -222,7 +222,7 @@ static int make_request(mddev_t *mddev, struct bio *bio) } } -static void status(struct seq_file *seq, mddev_t *mddev) +static void status(struct seq_file *seq, struct mddev *mddev) { conf_t *conf = mddev->private; int n; @@ -255,7 +255,7 @@ static void status(struct seq_file *seq, mddev_t *mddev) } -static int reshape(mddev_t *mddev) +static int reshape(struct mddev *mddev) { int mode = mddev->new_layout & ModeMask; int count = mddev->new_layout >> ModeShift; @@ -284,7 +284,7 @@ static int reshape(mddev_t *mddev) return 0; } -static sector_t faulty_size(mddev_t *mddev, sector_t sectors, int raid_disks) +static sector_t faulty_size(struct mddev *mddev, sector_t sectors, int raid_disks) { WARN_ONCE(raid_disks, "%s does not support generic reshape\n", __func__); @@ -295,7 +295,7 @@ static sector_t faulty_size(mddev_t *mddev, sector_t sectors, int raid_disks) return sectors; } -static int run(mddev_t *mddev) +static int run(struct mddev *mddev) { struct md_rdev *rdev; int i; @@ -325,7 +325,7 @@ static int run(mddev_t *mddev) return 0; } -static int stop(mddev_t *mddev) +static int stop(struct mddev *mddev) { conf_t *conf = mddev->private; diff --git a/drivers/md/linear.c b/drivers/md/linear.c index 0b5cac0fda1a..2e176e020ab5 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c @@ -26,7 +26,7 @@ /* * find which device holds a particular offset */ -static inline dev_info_t *which_dev(mddev_t *mddev, sector_t sector) +static inline dev_info_t *which_dev(struct mddev *mddev, sector_t sector) { int lo, mid, hi; linear_conf_t *conf; @@ -63,7 +63,7 @@ static int linear_mergeable_bvec(struct request_queue *q, struct bvec_merge_data *bvm, struct bio_vec *biovec) { - mddev_t *mddev = q->queuedata; + struct mddev *mddev = q->queuedata; dev_info_t *dev0; unsigned long maxsectors, bio_sectors = bvm->bi_size >> 9; sector_t sector = bvm->bi_sector + get_start_sect(bvm->bi_bdev); @@ -89,7 +89,7 @@ static int linear_mergeable_bvec(struct request_queue *q, static int linear_congested(void *data, int bits) { - mddev_t *mddev = data; + struct mddev *mddev = data; linear_conf_t *conf; int i, ret = 0; @@ -108,7 +108,7 @@ static int linear_congested(void *data, int bits) return ret; } -static sector_t linear_size(mddev_t *mddev, sector_t sectors, int raid_disks) +static sector_t linear_size(struct mddev *mddev, sector_t sectors, int raid_disks) { linear_conf_t *conf; sector_t array_sectors; @@ -123,7 +123,7 @@ static sector_t linear_size(mddev_t *mddev, sector_t sectors, int raid_disks) return array_sectors; } -static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) +static linear_conf_t *linear_conf(struct mddev *mddev, int raid_disks) { linear_conf_t *conf; struct md_rdev *rdev; @@ -194,7 +194,7 @@ out: return NULL; } -static int linear_run (mddev_t *mddev) +static int linear_run (struct mddev *mddev) { linear_conf_t *conf; @@ -213,7 +213,7 @@ static int linear_run (mddev_t *mddev) return md_integrity_register(mddev); } -static int linear_add(mddev_t *mddev, struct md_rdev *rdev) +static int linear_add(struct mddev *mddev, struct md_rdev *rdev) { /* Adding a drive to a linear array allows the array to grow. * It is permitted if the new drive has a matching superblock @@ -245,7 +245,7 @@ static int linear_add(mddev_t *mddev, struct md_rdev *rdev) return 0; } -static int linear_stop (mddev_t *mddev) +static int linear_stop (struct mddev *mddev) { linear_conf_t *conf = mddev->private; @@ -264,7 +264,7 @@ static int linear_stop (mddev_t *mddev) return 0; } -static int linear_make_request (mddev_t *mddev, struct bio *bio) +static int linear_make_request (struct mddev *mddev, struct bio *bio) { dev_info_t *tmp_dev; sector_t start_sector; @@ -323,7 +323,7 @@ static int linear_make_request (mddev_t *mddev, struct bio *bio) return 1; } -static void linear_status (struct seq_file *seq, mddev_t *mddev) +static void linear_status (struct seq_file *seq, struct mddev *mddev) { seq_printf(seq, " %dk rounding", mddev->chunk_sectors / 2); diff --git a/drivers/md/md.c b/drivers/md/md.c index e015f403d69e..f378b8a39eb2 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -95,13 +95,13 @@ static struct workqueue_struct *md_misc_wq; static int sysctl_speed_limit_min = 1000; static int sysctl_speed_limit_max = 200000; -static inline int speed_min(mddev_t *mddev) +static inline int speed_min(struct mddev *mddev) { return mddev->sync_speed_min ? mddev->sync_speed_min : sysctl_speed_limit_min; } -static inline int speed_max(mddev_t *mddev) +static inline int speed_max(struct mddev *mddev) { return mddev->sync_speed_max ? mddev->sync_speed_max : sysctl_speed_limit_max; @@ -157,7 +157,7 @@ static int start_readonly; static void mddev_bio_destructor(struct bio *bio) { - mddev_t *mddev, **mddevp; + struct mddev *mddev, **mddevp; mddevp = (void*)bio; mddev = mddevp[-1]; @@ -166,10 +166,10 @@ static void mddev_bio_destructor(struct bio *bio) } struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, - mddev_t *mddev) + struct mddev *mddev) { struct bio *b; - mddev_t **mddevp; + struct mddev **mddevp; if (!mddev || !mddev->bio_set) return bio_alloc(gfp_mask, nr_iovecs); @@ -186,10 +186,10 @@ struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, EXPORT_SYMBOL_GPL(bio_alloc_mddev); struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask, - mddev_t *mddev) + struct mddev *mddev) { struct bio *b; - mddev_t **mddevp; + struct mddev **mddevp; if (!mddev || !mddev->bio_set) return bio_clone(bio, gfp_mask); @@ -278,7 +278,7 @@ EXPORT_SYMBOL_GPL(md_trim_bio); */ static DECLARE_WAIT_QUEUE_HEAD(md_event_waiters); static atomic_t md_event_count; -void md_new_event(mddev_t *mddev) +void md_new_event(struct mddev *mddev) { atomic_inc(&md_event_count); wake_up(&md_event_waiters); @@ -288,7 +288,7 @@ EXPORT_SYMBOL_GPL(md_new_event); /* Alternate version that can be called from interrupts * when calling sysfs_notify isn't needed. */ -static void md_new_event_inintr(mddev_t *mddev) +static void md_new_event_inintr(struct mddev *mddev) { atomic_inc(&md_event_count); wake_up(&md_event_waiters); @@ -309,19 +309,19 @@ static DEFINE_SPINLOCK(all_mddevs_lock); * Any code which breaks out of this loop while own * a reference to the current mddev and must mddev_put it. */ -#define for_each_mddev(mddev,tmp) \ +#define for_each_mddev(_mddev,_tmp) \ \ for (({ spin_lock(&all_mddevs_lock); \ - tmp = all_mddevs.next; \ - mddev = NULL;}); \ - ({ if (tmp != &all_mddevs) \ - mddev_get(list_entry(tmp, mddev_t, all_mddevs));\ + _tmp = all_mddevs.next; \ + _mddev = NULL;}); \ + ({ if (_tmp != &all_mddevs) \ + mddev_get(list_entry(_tmp, struct mddev, all_mddevs));\ spin_unlock(&all_mddevs_lock); \ - if (mddev) mddev_put(mddev); \ - mddev = list_entry(tmp, mddev_t, all_mddevs); \ - tmp != &all_mddevs;}); \ + if (_mddev) mddev_put(_mddev); \ + _mddev = list_entry(_tmp, struct mddev, all_mddevs); \ + _tmp != &all_mddevs;}); \ ({ spin_lock(&all_mddevs_lock); \ - tmp = tmp->next;}) \ + _tmp = _tmp->next;}) \ ) @@ -335,7 +335,7 @@ static DEFINE_SPINLOCK(all_mddevs_lock); static int md_make_request(struct request_queue *q, struct bio *bio) { const int rw = bio_data_dir(bio); - mddev_t *mddev = q->queuedata; + struct mddev *mddev = q->queuedata; int rv; int cpu; unsigned int sectors; @@ -387,7 +387,7 @@ static int md_make_request(struct request_queue *q, struct bio *bio) * Once ->stop is called and completes, the module will be completely * unused. */ -void mddev_suspend(mddev_t *mddev) +void mddev_suspend(struct mddev *mddev) { BUG_ON(mddev->suspended); mddev->suspended = 1; @@ -397,7 +397,7 @@ void mddev_suspend(mddev_t *mddev) } EXPORT_SYMBOL_GPL(mddev_suspend); -void mddev_resume(mddev_t *mddev) +void mddev_resume(struct mddev *mddev) { mddev->suspended = 0; wake_up(&mddev->sb_wait); @@ -408,7 +408,7 @@ void mddev_resume(mddev_t *mddev) } EXPORT_SYMBOL_GPL(mddev_resume); -int mddev_congested(mddev_t *mddev, int bits) +int mddev_congested(struct mddev *mddev, int bits) { return mddev->suspended; } @@ -421,7 +421,7 @@ EXPORT_SYMBOL(mddev_congested); static void md_end_flush(struct bio *bio, int err) { struct md_rdev *rdev = bio->bi_private; - mddev_t *mddev = rdev->mddev; + struct mddev *mddev = rdev->mddev; rdev_dec_pending(rdev, mddev); @@ -436,7 +436,7 @@ static void md_submit_flush_data(struct work_struct *ws); static void submit_flushes(struct work_struct *ws) { - mddev_t *mddev = container_of(ws, mddev_t, flush_work); + struct mddev *mddev = container_of(ws, struct mddev, flush_work); struct md_rdev *rdev; INIT_WORK(&mddev->flush_work, md_submit_flush_data); @@ -469,7 +469,7 @@ static void submit_flushes(struct work_struct *ws) static void md_submit_flush_data(struct work_struct *ws) { - mddev_t *mddev = container_of(ws, mddev_t, flush_work); + struct mddev *mddev = container_of(ws, struct mddev, flush_work); struct bio *bio = mddev->flush_bio; if (bio->bi_size == 0) @@ -485,7 +485,7 @@ static void md_submit_flush_data(struct work_struct *ws) wake_up(&mddev->sb_wait); } -void md_flush_request(mddev_t *mddev, struct bio *bio) +void md_flush_request(struct mddev *mddev, struct bio *bio) { spin_lock_irq(&mddev->write_lock); wait_event_lock_irq(mddev->sb_wait, @@ -509,7 +509,7 @@ EXPORT_SYMBOL(md_flush_request); */ struct md_plug_cb { struct blk_plug_cb cb; - mddev_t *mddev; + struct mddev *mddev; }; static void plugger_unplug(struct blk_plug_cb *cb) @@ -523,7 +523,7 @@ static void plugger_unplug(struct blk_plug_cb *cb) /* Check that an unplug wakeup will come shortly. * If not, wakeup the md thread immediately */ -int mddev_check_plugged(mddev_t *mddev) +int mddev_check_plugged(struct mddev *mddev) { struct blk_plug *plug = current->plug; struct md_plug_cb *mdcb; @@ -555,7 +555,7 @@ int mddev_check_plugged(mddev_t *mddev) } EXPORT_SYMBOL_GPL(mddev_check_plugged); -static inline mddev_t *mddev_get(mddev_t *mddev) +static inline struct mddev *mddev_get(struct mddev *mddev) { atomic_inc(&mddev->active); return mddev; @@ -563,7 +563,7 @@ static inline mddev_t *mddev_get(mddev_t *mddev) static void mddev_delayed_delete(struct work_struct *ws); -static void mddev_put(mddev_t *mddev) +static void mddev_put(struct mddev *mddev) { struct bio_set *bs = NULL; @@ -592,7 +592,7 @@ static void mddev_put(mddev_t *mddev) bioset_free(bs); } -void mddev_init(mddev_t *mddev) +void mddev_init(struct mddev *mddev) { mutex_init(&mddev->open_mutex); mutex_init(&mddev->reconfig_mutex); @@ -615,9 +615,9 @@ void mddev_init(mddev_t *mddev) } EXPORT_SYMBOL_GPL(mddev_init); -static mddev_t * mddev_find(dev_t unit) +static struct mddev * mddev_find(dev_t unit) { - mddev_t *mddev, *new = NULL; + struct mddev *mddev, *new = NULL; if (unit && MAJOR(unit) != MD_MAJOR) unit &= ~((1<reconfig_mutex); } -static inline int mddev_is_locked(mddev_t *mddev) +static inline int mddev_is_locked(struct mddev *mddev) { return mutex_is_locked(&mddev->reconfig_mutex); } -static inline int mddev_trylock(mddev_t * mddev) +static inline int mddev_trylock(struct mddev * mddev) { return mutex_trylock(&mddev->reconfig_mutex); } static struct attribute_group md_redundancy_group; -static void mddev_unlock(mddev_t * mddev) +static void mddev_unlock(struct mddev * mddev) { if (mddev->to_remove) { /* These cannot be removed under reconfig_mutex as @@ -749,7 +749,7 @@ static void mddev_unlock(mddev_t * mddev) spin_unlock(&pers_lock); } -static struct md_rdev * find_rdev_nr(mddev_t *mddev, int nr) +static struct md_rdev * find_rdev_nr(struct mddev *mddev, int nr) { struct md_rdev *rdev; @@ -760,7 +760,7 @@ static struct md_rdev * find_rdev_nr(mddev_t *mddev, int nr) return NULL; } -static struct md_rdev * find_rdev(mddev_t * mddev, dev_t dev) +static struct md_rdev * find_rdev(struct mddev * mddev, dev_t dev) { struct md_rdev *rdev; @@ -823,7 +823,7 @@ static void free_disk_sb(struct md_rdev * rdev) static void super_written(struct bio *bio, int error) { struct md_rdev *rdev = bio->bi_private; - mddev_t *mddev = rdev->mddev; + struct mddev *mddev = rdev->mddev; if (error || !test_bit(BIO_UPTODATE, &bio->bi_flags)) { printk("md: super_written gets error=%d, uptodate=%d\n", @@ -837,7 +837,7 @@ static void super_written(struct bio *bio, int error) bio_put(bio); } -void md_super_write(mddev_t *mddev, struct md_rdev *rdev, +void md_super_write(struct mddev *mddev, struct md_rdev *rdev, sector_t sector, int size, struct page *page) { /* write first size bytes of page to sector of rdev @@ -858,7 +858,7 @@ void md_super_write(mddev_t *mddev, struct md_rdev *rdev, submit_bio(WRITE_FLUSH_FUA, bio); } -void md_super_wait(mddev_t *mddev) +void md_super_wait(struct mddev *mddev) { /* wait for all superblock writes that were scheduled to complete */ DEFINE_WAIT(wq); @@ -1021,13 +1021,13 @@ static unsigned int calc_sb_csum(mdp_super_t * sb) * -EINVAL superblock incompatible or invalid * -othererror e.g. -EIO * - * int validate_super(mddev_t *mddev, struct md_rdev *dev) + * int validate_super(struct mddev *mddev, struct md_rdev *dev) * Verify that dev is acceptable into mddev. * The first time, mddev->raid_disks will be 0, and data from * dev should be merged in. Subsequent calls check that dev * is new enough. Return 0 or -EINVAL * - * void sync_super(mddev_t *mddev, struct md_rdev *dev) + * void sync_super(struct mddev *mddev, struct md_rdev *dev) * Update the superblock for rdev with data in mddev * This does not write to disc. * @@ -1038,8 +1038,8 @@ struct super_type { struct module *owner; int (*load_super)(struct md_rdev *rdev, struct md_rdev *refdev, int minor_version); - int (*validate_super)(mddev_t *mddev, struct md_rdev *rdev); - void (*sync_super)(mddev_t *mddev, struct md_rdev *rdev); + int (*validate_super)(struct mddev *mddev, struct md_rdev *rdev); + void (*sync_super)(struct mddev *mddev, struct md_rdev *rdev); unsigned long long (*rdev_size_change)(struct md_rdev *rdev, sector_t num_sectors); }; @@ -1052,7 +1052,7 @@ struct super_type { * has a bitmap. Otherwise, it returns 0. * */ -int md_check_no_bitmap(mddev_t *mddev) +int md_check_no_bitmap(struct mddev *mddev) { if (!mddev->bitmap_info.file && !mddev->bitmap_info.offset) return 0; @@ -1160,7 +1160,7 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor /* * validate_super for 0.90.0 */ -static int super_90_validate(mddev_t *mddev, struct md_rdev *rdev) +static int super_90_validate(struct mddev *mddev, struct md_rdev *rdev) { mdp_disk_t *desc; mdp_super_t *sb = page_address(rdev->sb_page); @@ -1272,7 +1272,7 @@ static int super_90_validate(mddev_t *mddev, struct md_rdev *rdev) /* * sync_super for 0.90.0 */ -static void super_90_sync(mddev_t *mddev, struct md_rdev *rdev) +static void super_90_sync(struct mddev *mddev, struct md_rdev *rdev) { mdp_super_t *sb; struct md_rdev *rdev2; @@ -1622,7 +1622,7 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_ return ret; } -static int super_1_validate(mddev_t *mddev, struct md_rdev *rdev) +static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev) { struct mdp_superblock_1 *sb = page_address(rdev->sb_page); __u64 ev1 = le64_to_cpu(sb->events); @@ -1723,7 +1723,7 @@ static int super_1_validate(mddev_t *mddev, struct md_rdev *rdev) return 0; } -static void super_1_sync(mddev_t *mddev, struct md_rdev *rdev) +static void super_1_sync(struct mddev *mddev, struct md_rdev *rdev) { struct mdp_superblock_1 *sb; struct md_rdev *rdev2; @@ -1902,7 +1902,7 @@ static struct super_type super_types[] = { }, }; -static void sync_super(mddev_t *mddev, struct md_rdev *rdev) +static void sync_super(struct mddev *mddev, struct md_rdev *rdev) { if (mddev->sync_super) { mddev->sync_super(mddev, rdev); @@ -1914,7 +1914,7 @@ static void sync_super(mddev_t *mddev, struct md_rdev *rdev) super_types[mddev->major_version].sync_super(mddev, rdev); } -static int match_mddev_units(mddev_t *mddev1, mddev_t *mddev2) +static int match_mddev_units(struct mddev *mddev1, struct mddev *mddev2) { struct md_rdev *rdev, *rdev2; @@ -1939,7 +1939,7 @@ static LIST_HEAD(pending_raid_disks); * from the array. It only succeeds if all working and active component devices * are integrity capable with matching profiles. */ -int md_integrity_register(mddev_t *mddev) +int md_integrity_register(struct mddev *mddev) { struct md_rdev *rdev, *reference = NULL; @@ -1986,7 +1986,7 @@ int md_integrity_register(mddev_t *mddev) EXPORT_SYMBOL(md_integrity_register); /* Disable data integrity if non-capable/non-matching disk is being added */ -void md_integrity_add_rdev(struct md_rdev *rdev, mddev_t *mddev) +void md_integrity_add_rdev(struct md_rdev *rdev, struct mddev *mddev) { struct blk_integrity *bi_rdev = bdev_get_integrity(rdev->bdev); struct blk_integrity *bi_mddev = blk_get_integrity(mddev->gendisk); @@ -2003,7 +2003,7 @@ void md_integrity_add_rdev(struct md_rdev *rdev, mddev_t *mddev) } EXPORT_SYMBOL(md_integrity_add_rdev); -static int bind_rdev_to_array(struct md_rdev * rdev, mddev_t * mddev) +static int bind_rdev_to_array(struct md_rdev * rdev, struct mddev * mddev) { char b[BDEVNAME_SIZE]; struct kobject *ko; @@ -2170,7 +2170,7 @@ static void kick_rdev_from_array(struct md_rdev * rdev) export_rdev(rdev); } -static void export_array(mddev_t *mddev) +static void export_array(struct mddev *mddev) { struct md_rdev *rdev, *tmp; @@ -2293,7 +2293,7 @@ static void md_print_devices(void) { struct list_head *tmp; struct md_rdev *rdev; - mddev_t *mddev; + struct mddev *mddev; char b[BDEVNAME_SIZE]; printk("\n"); @@ -2318,7 +2318,7 @@ static void md_print_devices(void) } -static void sync_sbs(mddev_t * mddev, int nospares) +static void sync_sbs(struct mddev * mddev, int nospares) { /* Update each superblock (in-memory image), but * if we are allowed to, skip spares which already @@ -2341,7 +2341,7 @@ static void sync_sbs(mddev_t * mddev, int nospares) } } -static void md_update_sb(mddev_t * mddev, int force_change) +static void md_update_sb(struct mddev * mddev, int force_change) { struct md_rdev *rdev; int sync_req; @@ -2586,7 +2586,7 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len) if (rdev->raid_disk >= 0) err = -EBUSY; else { - mddev_t *mddev = rdev->mddev; + struct mddev *mddev = rdev->mddev; kick_rdev_from_array(rdev); if (mddev->pers) md_update_sb(mddev, 1); @@ -2814,7 +2814,7 @@ static int strict_blocks_to_sectors(const char *buf, sector_t *sectors) static ssize_t rdev_size_store(struct md_rdev *rdev, const char *buf, size_t len) { - mddev_t *my_mddev = rdev->mddev; + struct mddev *my_mddev = rdev->mddev; sector_t oldsectors = rdev->sectors; sector_t sectors; @@ -2840,7 +2840,7 @@ rdev_size_store(struct md_rdev *rdev, const char *buf, size_t len) * a deadlock. We have already changed rdev->sectors, and if * we have to change it back, we will have the lock again. */ - mddev_t *mddev; + struct mddev *mddev; int overlap = 0; struct list_head *tmp; @@ -2967,7 +2967,7 @@ rdev_attr_show(struct kobject *kobj, struct attribute *attr, char *page) { struct rdev_sysfs_entry *entry = container_of(attr, struct rdev_sysfs_entry, attr); struct md_rdev *rdev = container_of(kobj, struct md_rdev, kobj); - mddev_t *mddev = rdev->mddev; + struct mddev *mddev = rdev->mddev; ssize_t rv; if (!entry->show) @@ -2991,7 +2991,7 @@ rdev_attr_store(struct kobject *kobj, struct attribute *attr, struct rdev_sysfs_entry *entry = container_of(attr, struct rdev_sysfs_entry, attr); struct md_rdev *rdev = container_of(kobj, struct md_rdev, kobj); ssize_t rv; - mddev_t *mddev = rdev->mddev; + struct mddev *mddev = rdev->mddev; if (!entry->store) return -EIO; @@ -3139,7 +3139,7 @@ abort_free: */ -static void analyze_sbs(mddev_t * mddev) +static void analyze_sbs(struct mddev * mddev) { int i; struct md_rdev *rdev, *freshest, *tmp; @@ -3242,13 +3242,13 @@ int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale) static void md_safemode_timeout(unsigned long data); static ssize_t -safe_delay_show(mddev_t *mddev, char *page) +safe_delay_show(struct mddev *mddev, char *page) { int msec = (mddev->safemode_delay*1000)/HZ; return sprintf(page, "%d.%03d\n", msec/1000, msec%1000); } static ssize_t -safe_delay_store(mddev_t *mddev, const char *cbuf, size_t len) +safe_delay_store(struct mddev *mddev, const char *cbuf, size_t len) { unsigned long msec; @@ -3270,7 +3270,7 @@ static struct md_sysfs_entry md_safe_delay = __ATTR(safe_mode_delay, S_IRUGO|S_IWUSR,safe_delay_show, safe_delay_store); static ssize_t -level_show(mddev_t *mddev, char *page) +level_show(struct mddev *mddev, char *page) { struct mdk_personality *p = mddev->pers; if (p) @@ -3284,7 +3284,7 @@ level_show(mddev_t *mddev, char *page) } static ssize_t -level_store(mddev_t *mddev, const char *buf, size_t len) +level_store(struct mddev *mddev, const char *buf, size_t len) { char clevel[16]; ssize_t rv = len; @@ -3465,7 +3465,7 @@ __ATTR(level, S_IRUGO|S_IWUSR, level_show, level_store); static ssize_t -layout_show(mddev_t *mddev, char *page) +layout_show(struct mddev *mddev, char *page) { /* just a number, not meaningful for all levels */ if (mddev->reshape_position != MaxSector && @@ -3476,7 +3476,7 @@ layout_show(mddev_t *mddev, char *page) } static ssize_t -layout_store(mddev_t *mddev, const char *buf, size_t len) +layout_store(struct mddev *mddev, const char *buf, size_t len) { char *e; unsigned long n = simple_strtoul(buf, &e, 10); @@ -3506,7 +3506,7 @@ __ATTR(layout, S_IRUGO|S_IWUSR, layout_show, layout_store); static ssize_t -raid_disks_show(mddev_t *mddev, char *page) +raid_disks_show(struct mddev *mddev, char *page) { if (mddev->raid_disks == 0) return 0; @@ -3517,10 +3517,10 @@ raid_disks_show(mddev_t *mddev, char *page) return sprintf(page, "%d\n", mddev->raid_disks); } -static int update_raid_disks(mddev_t *mddev, int raid_disks); +static int update_raid_disks(struct mddev *mddev, int raid_disks); static ssize_t -raid_disks_store(mddev_t *mddev, const char *buf, size_t len) +raid_disks_store(struct mddev *mddev, const char *buf, size_t len) { char *e; int rv = 0; @@ -3543,7 +3543,7 @@ static struct md_sysfs_entry md_raid_disks = __ATTR(raid_disks, S_IRUGO|S_IWUSR, raid_disks_show, raid_disks_store); static ssize_t -chunk_size_show(mddev_t *mddev, char *page) +chunk_size_show(struct mddev *mddev, char *page) { if (mddev->reshape_position != MaxSector && mddev->chunk_sectors != mddev->new_chunk_sectors) @@ -3554,7 +3554,7 @@ chunk_size_show(mddev_t *mddev, char *page) } static ssize_t -chunk_size_store(mddev_t *mddev, const char *buf, size_t len) +chunk_size_store(struct mddev *mddev, const char *buf, size_t len) { char *e; unsigned long n = simple_strtoul(buf, &e, 10); @@ -3583,7 +3583,7 @@ static struct md_sysfs_entry md_chunk_size = __ATTR(chunk_size, S_IRUGO|S_IWUSR, chunk_size_show, chunk_size_store); static ssize_t -resync_start_show(mddev_t *mddev, char *page) +resync_start_show(struct mddev *mddev, char *page) { if (mddev->recovery_cp == MaxSector) return sprintf(page, "none\n"); @@ -3591,7 +3591,7 @@ resync_start_show(mddev_t *mddev, char *page) } static ssize_t -resync_start_store(mddev_t *mddev, const char *buf, size_t len) +resync_start_store(struct mddev *mddev, const char *buf, size_t len) { char *e; unsigned long long n = simple_strtoull(buf, &e, 10); @@ -3661,7 +3661,7 @@ static int match_word(const char *word, char **list) } static ssize_t -array_state_show(mddev_t *mddev, char *page) +array_state_show(struct mddev *mddev, char *page) { enum array_state st = inactive; @@ -3694,13 +3694,13 @@ array_state_show(mddev_t *mddev, char *page) return sprintf(page, "%s\n", array_states[st]); } -static int do_md_stop(mddev_t * mddev, int ro, int is_open); -static int md_set_readonly(mddev_t * mddev, int is_open); -static int do_md_run(mddev_t * mddev); -static int restart_array(mddev_t *mddev); +static int do_md_stop(struct mddev * mddev, int ro, int is_open); +static int md_set_readonly(struct mddev * mddev, int is_open); +static int do_md_run(struct mddev * mddev); +static int restart_array(struct mddev *mddev); static ssize_t -array_state_store(mddev_t *mddev, const char *buf, size_t len) +array_state_store(struct mddev *mddev, const char *buf, size_t len) { int err = -EINVAL; enum array_state st = match_word(buf, array_states); @@ -3794,13 +3794,13 @@ static struct md_sysfs_entry md_array_state = __ATTR(array_state, S_IRUGO|S_IWUSR, array_state_show, array_state_store); static ssize_t -max_corrected_read_errors_show(mddev_t *mddev, char *page) { +max_corrected_read_errors_show(struct mddev *mddev, char *page) { return sprintf(page, "%d\n", atomic_read(&mddev->max_corr_read_errors)); } static ssize_t -max_corrected_read_errors_store(mddev_t *mddev, const char *buf, size_t len) +max_corrected_read_errors_store(struct mddev *mddev, const char *buf, size_t len) { char *e; unsigned long n = simple_strtoul(buf, &e, 10); @@ -3817,13 +3817,13 @@ __ATTR(max_read_errors, S_IRUGO|S_IWUSR, max_corrected_read_errors_show, max_corrected_read_errors_store); static ssize_t -null_show(mddev_t *mddev, char *page) +null_show(struct mddev *mddev, char *page) { return -EINVAL; } static ssize_t -new_dev_store(mddev_t *mddev, const char *buf, size_t len) +new_dev_store(struct mddev *mddev, const char *buf, size_t len) { /* buf must be %d:%d\n? giving major and minor numbers */ /* The new device is added to the array. @@ -3880,7 +3880,7 @@ static struct md_sysfs_entry md_new_device = __ATTR(new_dev, S_IWUSR, null_show, new_dev_store); static ssize_t -bitmap_store(mddev_t *mddev, const char *buf, size_t len) +bitmap_store(struct mddev *mddev, const char *buf, size_t len) { char *end; unsigned long chunk, end_chunk; @@ -3909,16 +3909,16 @@ static struct md_sysfs_entry md_bitmap = __ATTR(bitmap_set_bits, S_IWUSR, null_show, bitmap_store); static ssize_t -size_show(mddev_t *mddev, char *page) +size_show(struct mddev *mddev, char *page) { return sprintf(page, "%llu\n", (unsigned long long)mddev->dev_sectors / 2); } -static int update_size(mddev_t *mddev, sector_t num_sectors); +static int update_size(struct mddev *mddev, sector_t num_sectors); static ssize_t -size_store(mddev_t *mddev, const char *buf, size_t len) +size_store(struct mddev *mddev, const char *buf, size_t len) { /* If array is inactive, we can reduce the component size, but * not increase it (except from 0). @@ -3953,7 +3953,7 @@ __ATTR(component_size, S_IRUGO|S_IWUSR, size_show, size_store); * or N.M for internally known formats */ static ssize_t -metadata_show(mddev_t *mddev, char *page) +metadata_show(struct mddev *mddev, char *page) { if (mddev->persistent) return sprintf(page, "%d.%d\n", @@ -3965,7 +3965,7 @@ metadata_show(mddev_t *mddev, char *page) } static ssize_t -metadata_store(mddev_t *mddev, const char *buf, size_t len) +metadata_store(struct mddev *mddev, const char *buf, size_t len) { int major, minor; char *e; @@ -4019,7 +4019,7 @@ static struct md_sysfs_entry md_metadata = __ATTR(metadata_version, S_IRUGO|S_IWUSR, metadata_show, metadata_store); static ssize_t -action_show(mddev_t *mddev, char *page) +action_show(struct mddev *mddev, char *page) { char *type = "idle"; if (test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) @@ -4041,10 +4041,10 @@ action_show(mddev_t *mddev, char *page) return sprintf(page, "%s\n", type); } -static void reap_sync_thread(mddev_t *mddev); +static void reap_sync_thread(struct mddev *mddev); static ssize_t -action_store(mddev_t *mddev, const char *page, size_t len) +action_store(struct mddev *mddev, const char *page, size_t len) { if (!mddev->pers || !mddev->pers->sync_request) return -EINVAL; @@ -4090,7 +4090,7 @@ action_store(mddev_t *mddev, const char *page, size_t len) } static ssize_t -mismatch_cnt_show(mddev_t *mddev, char *page) +mismatch_cnt_show(struct mddev *mddev, char *page) { return sprintf(page, "%llu\n", (unsigned long long) mddev->resync_mismatches); @@ -4103,14 +4103,14 @@ __ATTR(sync_action, S_IRUGO|S_IWUSR, action_show, action_store); static struct md_sysfs_entry md_mismatches = __ATTR_RO(mismatch_cnt); static ssize_t -sync_min_show(mddev_t *mddev, char *page) +sync_min_show(struct mddev *mddev, char *page) { return sprintf(page, "%d (%s)\n", speed_min(mddev), mddev->sync_speed_min ? "local": "system"); } static ssize_t -sync_min_store(mddev_t *mddev, const char *buf, size_t len) +sync_min_store(struct mddev *mddev, const char *buf, size_t len) { int min; char *e; @@ -4129,14 +4129,14 @@ static struct md_sysfs_entry md_sync_min = __ATTR(sync_speed_min, S_IRUGO|S_IWUSR, sync_min_show, sync_min_store); static ssize_t -sync_max_show(mddev_t *mddev, char *page) +sync_max_show(struct mddev *mddev, char *page) { return sprintf(page, "%d (%s)\n", speed_max(mddev), mddev->sync_speed_max ? "local": "system"); } static ssize_t -sync_max_store(mddev_t *mddev, const char *buf, size_t len) +sync_max_store(struct mddev *mddev, const char *buf, size_t len) { int max; char *e; @@ -4155,20 +4155,20 @@ static struct md_sysfs_entry md_sync_max = __ATTR(sync_speed_max, S_IRUGO|S_IWUSR, sync_max_show, sync_max_store); static ssize_t -degraded_show(mddev_t *mddev, char *page) +degraded_show(struct mddev *mddev, char *page) { return sprintf(page, "%d\n", mddev->degraded); } static struct md_sysfs_entry md_degraded = __ATTR_RO(degraded); static ssize_t -sync_force_parallel_show(mddev_t *mddev, char *page) +sync_force_parallel_show(struct mddev *mddev, char *page) { return sprintf(page, "%d\n", mddev->parallel_resync); } static ssize_t -sync_force_parallel_store(mddev_t *mddev, const char *buf, size_t len) +sync_force_parallel_store(struct mddev *mddev, const char *buf, size_t len) { long n; @@ -4192,7 +4192,7 @@ __ATTR(sync_force_parallel, S_IRUGO|S_IWUSR, sync_force_parallel_show, sync_force_parallel_store); static ssize_t -sync_speed_show(mddev_t *mddev, char *page) +sync_speed_show(struct mddev *mddev, char *page) { unsigned long resync, dt, db; if (mddev->curr_resync == 0) @@ -4207,7 +4207,7 @@ sync_speed_show(mddev_t *mddev, char *page) static struct md_sysfs_entry md_sync_speed = __ATTR_RO(sync_speed); static ssize_t -sync_completed_show(mddev_t *mddev, char *page) +sync_completed_show(struct mddev *mddev, char *page) { unsigned long long max_sectors, resync; @@ -4226,13 +4226,13 @@ sync_completed_show(mddev_t *mddev, char *page) static struct md_sysfs_entry md_sync_completed = __ATTR_RO(sync_completed); static ssize_t -min_sync_show(mddev_t *mddev, char *page) +min_sync_show(struct mddev *mddev, char *page) { return sprintf(page, "%llu\n", (unsigned long long)mddev->resync_min); } static ssize_t -min_sync_store(mddev_t *mddev, const char *buf, size_t len) +min_sync_store(struct mddev *mddev, const char *buf, size_t len) { unsigned long long min; if (strict_strtoull(buf, 10, &min)) @@ -4257,7 +4257,7 @@ static struct md_sysfs_entry md_min_sync = __ATTR(sync_min, S_IRUGO|S_IWUSR, min_sync_show, min_sync_store); static ssize_t -max_sync_show(mddev_t *mddev, char *page) +max_sync_show(struct mddev *mddev, char *page) { if (mddev->resync_max == MaxSector) return sprintf(page, "max\n"); @@ -4266,7 +4266,7 @@ max_sync_show(mddev_t *mddev, char *page) (unsigned long long)mddev->resync_max); } static ssize_t -max_sync_store(mddev_t *mddev, const char *buf, size_t len) +max_sync_store(struct mddev *mddev, const char *buf, size_t len) { if (strncmp(buf, "max", 3) == 0) mddev->resync_max = MaxSector; @@ -4297,13 +4297,13 @@ static struct md_sysfs_entry md_max_sync = __ATTR(sync_max, S_IRUGO|S_IWUSR, max_sync_show, max_sync_store); static ssize_t -suspend_lo_show(mddev_t *mddev, char *page) +suspend_lo_show(struct mddev *mddev, char *page) { return sprintf(page, "%llu\n", (unsigned long long)mddev->suspend_lo); } static ssize_t -suspend_lo_store(mddev_t *mddev, const char *buf, size_t len) +suspend_lo_store(struct mddev *mddev, const char *buf, size_t len) { char *e; unsigned long long new = simple_strtoull(buf, &e, 10); @@ -4331,13 +4331,13 @@ __ATTR(suspend_lo, S_IRUGO|S_IWUSR, suspend_lo_show, suspend_lo_store); static ssize_t -suspend_hi_show(mddev_t *mddev, char *page) +suspend_hi_show(struct mddev *mddev, char *page) { return sprintf(page, "%llu\n", (unsigned long long)mddev->suspend_hi); } static ssize_t -suspend_hi_store(mddev_t *mddev, const char *buf, size_t len) +suspend_hi_store(struct mddev *mddev, const char *buf, size_t len) { char *e; unsigned long long new = simple_strtoull(buf, &e, 10); @@ -4364,7 +4364,7 @@ static struct md_sysfs_entry md_suspend_hi = __ATTR(suspend_hi, S_IRUGO|S_IWUSR, suspend_hi_show, suspend_hi_store); static ssize_t -reshape_position_show(mddev_t *mddev, char *page) +reshape_position_show(struct mddev *mddev, char *page) { if (mddev->reshape_position != MaxSector) return sprintf(page, "%llu\n", @@ -4374,7 +4374,7 @@ reshape_position_show(mddev_t *mddev, char *page) } static ssize_t -reshape_position_store(mddev_t *mddev, const char *buf, size_t len) +reshape_position_store(struct mddev *mddev, const char *buf, size_t len) { char *e; unsigned long long new = simple_strtoull(buf, &e, 10); @@ -4395,7 +4395,7 @@ __ATTR(reshape_position, S_IRUGO|S_IWUSR, reshape_position_show, reshape_position_store); static ssize_t -array_size_show(mddev_t *mddev, char *page) +array_size_show(struct mddev *mddev, char *page) { if (mddev->external_size) return sprintf(page, "%llu\n", @@ -4405,7 +4405,7 @@ array_size_show(mddev_t *mddev, char *page) } static ssize_t -array_size_store(mddev_t *mddev, const char *buf, size_t len) +array_size_store(struct mddev *mddev, const char *buf, size_t len) { sector_t sectors; @@ -4480,7 +4480,7 @@ static ssize_t md_attr_show(struct kobject *kobj, struct attribute *attr, char *page) { struct md_sysfs_entry *entry = container_of(attr, struct md_sysfs_entry, attr); - mddev_t *mddev = container_of(kobj, struct mddev_s, kobj); + struct mddev *mddev = container_of(kobj, struct mddev, kobj); ssize_t rv; if (!entry->show) @@ -4498,7 +4498,7 @@ md_attr_store(struct kobject *kobj, struct attribute *attr, const char *page, size_t length) { struct md_sysfs_entry *entry = container_of(attr, struct md_sysfs_entry, attr); - mddev_t *mddev = container_of(kobj, struct mddev_s, kobj); + struct mddev *mddev = container_of(kobj, struct mddev, kobj); ssize_t rv; if (!entry->store) @@ -4517,7 +4517,7 @@ md_attr_store(struct kobject *kobj, struct attribute *attr, static void md_free(struct kobject *ko) { - mddev_t *mddev = container_of(ko, mddev_t, kobj); + struct mddev *mddev = container_of(ko, struct mddev, kobj); if (mddev->sysfs_state) sysfs_put(mddev->sysfs_state); @@ -4546,7 +4546,7 @@ int mdp_major = 0; static void mddev_delayed_delete(struct work_struct *ws) { - mddev_t *mddev = container_of(ws, mddev_t, del_work); + struct mddev *mddev = container_of(ws, struct mddev, del_work); sysfs_remove_group(&mddev->kobj, &md_bitmap_group); kobject_del(&mddev->kobj); @@ -4556,7 +4556,7 @@ static void mddev_delayed_delete(struct work_struct *ws) static int md_alloc(dev_t dev, char *name) { static DEFINE_MUTEX(disks_mutex); - mddev_t *mddev = mddev_find(dev); + struct mddev *mddev = mddev_find(dev); struct gendisk *disk; int partitioned; int shift; @@ -4583,7 +4583,7 @@ static int md_alloc(dev_t dev, char *name) if (name) { /* Need to ensure that 'name' is not a duplicate. */ - mddev_t *mddev2; + struct mddev *mddev2; spin_lock(&all_mddevs_lock); list_for_each_entry(mddev2, &all_mddevs, all_mddevs) @@ -4684,7 +4684,7 @@ static int add_named_array(const char *val, struct kernel_param *kp) static void md_safemode_timeout(unsigned long data) { - mddev_t *mddev = (mddev_t *) data; + struct mddev *mddev = (struct mddev *) data; if (!atomic_read(&mddev->writes_pending)) { mddev->safemode = 1; @@ -4696,7 +4696,7 @@ static void md_safemode_timeout(unsigned long data) static int start_dirty_degraded; -int md_run(mddev_t *mddev) +int md_run(struct mddev *mddev) { int err; struct md_rdev *rdev; @@ -4764,7 +4764,7 @@ int md_run(mddev_t *mddev) if (mddev->bio_set == NULL) mddev->bio_set = bioset_create(BIO_POOL_SIZE, - sizeof(mddev_t *)); + sizeof(struct mddev *)); spin_lock(&pers_lock); pers = find_pers(mddev->level, mddev->clevel); @@ -4898,7 +4898,7 @@ int md_run(mddev_t *mddev) } EXPORT_SYMBOL_GPL(md_run); -static int do_md_run(mddev_t *mddev) +static int do_md_run(struct mddev *mddev) { int err; @@ -4922,7 +4922,7 @@ out: return err; } -static int restart_array(mddev_t *mddev) +static int restart_array(struct mddev *mddev) { struct gendisk *disk = mddev->gendisk; @@ -4972,7 +4972,7 @@ void restore_bitmap_write_access(struct file *file) spin_unlock(&inode->i_lock); } -static void md_clean(mddev_t *mddev) +static void md_clean(struct mddev *mddev) { mddev->array_sectors = 0; mddev->external_size = 0; @@ -5015,7 +5015,7 @@ static void md_clean(mddev_t *mddev) mddev->bitmap_info.max_write_behind = 0; } -static void __md_stop_writes(mddev_t *mddev) +static void __md_stop_writes(struct mddev *mddev) { if (mddev->sync_thread) { set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); @@ -5035,7 +5035,7 @@ static void __md_stop_writes(mddev_t *mddev) } } -void md_stop_writes(mddev_t *mddev) +void md_stop_writes(struct mddev *mddev) { mddev_lock(mddev); __md_stop_writes(mddev); @@ -5043,7 +5043,7 @@ void md_stop_writes(mddev_t *mddev) } EXPORT_SYMBOL_GPL(md_stop_writes); -void md_stop(mddev_t *mddev) +void md_stop(struct mddev *mddev) { mddev->ready = 0; mddev->pers->stop(mddev); @@ -5055,7 +5055,7 @@ void md_stop(mddev_t *mddev) } EXPORT_SYMBOL_GPL(md_stop); -static int md_set_readonly(mddev_t *mddev, int is_open) +static int md_set_readonly(struct mddev *mddev, int is_open) { int err = 0; mutex_lock(&mddev->open_mutex); @@ -5085,7 +5085,7 @@ out: * 0 - completely stop and dis-assemble array * 2 - stop but do not disassemble array */ -static int do_md_stop(mddev_t * mddev, int mode, int is_open) +static int do_md_stop(struct mddev * mddev, int mode, int is_open) { struct gendisk *disk = mddev->gendisk; struct md_rdev *rdev; @@ -5151,7 +5151,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) } #ifndef MODULE -static void autorun_array(mddev_t *mddev) +static void autorun_array(struct mddev *mddev) { struct md_rdev *rdev; int err; @@ -5189,7 +5189,7 @@ static void autorun_array(mddev_t *mddev) static void autorun_devices(int part) { struct md_rdev *rdev0, *rdev, *tmp; - mddev_t *mddev; + struct mddev *mddev; char b[BDEVNAME_SIZE]; printk(KERN_INFO "md: autorun ...\n"); @@ -5284,7 +5284,7 @@ static int get_version(void __user * arg) return 0; } -static int get_array_info(mddev_t * mddev, void __user * arg) +static int get_array_info(struct mddev * mddev, void __user * arg) { mdu_array_info_t info; int nr,working,insync,failed,spare; @@ -5337,7 +5337,7 @@ static int get_array_info(mddev_t * mddev, void __user * arg) return 0; } -static int get_bitmap_file(mddev_t * mddev, void __user * arg) +static int get_bitmap_file(struct mddev * mddev, void __user * arg) { mdu_bitmap_file_t *file = NULL; /* too big for stack allocation */ char *ptr, *buf = NULL; @@ -5377,7 +5377,7 @@ out: return err; } -static int get_disk_info(mddev_t * mddev, void __user * arg) +static int get_disk_info(struct mddev * mddev, void __user * arg) { mdu_disk_info_t info; struct md_rdev *rdev; @@ -5411,7 +5411,7 @@ static int get_disk_info(mddev_t * mddev, void __user * arg) return 0; } -static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) +static int add_new_disk(struct mddev * mddev, mdu_disk_info_t *info) { char b[BDEVNAME_SIZE], b2[BDEVNAME_SIZE]; struct md_rdev *rdev; @@ -5583,7 +5583,7 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) return 0; } -static int hot_remove_disk(mddev_t * mddev, dev_t dev) +static int hot_remove_disk(struct mddev * mddev, dev_t dev) { char b[BDEVNAME_SIZE]; struct md_rdev *rdev; @@ -5606,7 +5606,7 @@ busy: return -EBUSY; } -static int hot_add_disk(mddev_t * mddev, dev_t dev) +static int hot_add_disk(struct mddev * mddev, dev_t dev) { char b[BDEVNAME_SIZE]; int err; @@ -5680,7 +5680,7 @@ abort_export: return err; } -static int set_bitmap_file(mddev_t *mddev, int fd) +static int set_bitmap_file(struct mddev *mddev, int fd) { int err; @@ -5753,7 +5753,7 @@ static int set_bitmap_file(mddev_t *mddev, int fd) * The minor and patch _version numbers are also kept incase the * super_block handler wishes to interpret them. */ -static int set_array_info(mddev_t * mddev, mdu_array_info_t *info) +static int set_array_info(struct mddev * mddev, mdu_array_info_t *info) { if (info->raid_disks == 0) { @@ -5823,7 +5823,7 @@ static int set_array_info(mddev_t * mddev, mdu_array_info_t *info) return 0; } -void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors) +void md_set_array_sectors(struct mddev *mddev, sector_t array_sectors) { WARN(!mddev_is_locked(mddev), "%s: unlocked mddev!\n", __func__); @@ -5834,7 +5834,7 @@ void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors) } EXPORT_SYMBOL(md_set_array_sectors); -static int update_size(mddev_t *mddev, sector_t num_sectors) +static int update_size(struct mddev *mddev, sector_t num_sectors) { struct md_rdev *rdev; int rv; @@ -5872,7 +5872,7 @@ static int update_size(mddev_t *mddev, sector_t num_sectors) return rv; } -static int update_raid_disks(mddev_t *mddev, int raid_disks) +static int update_raid_disks(struct mddev *mddev, int raid_disks) { int rv; /* change the number of raid disks */ @@ -5900,7 +5900,7 @@ static int update_raid_disks(mddev_t *mddev, int raid_disks) * Any differences that cannot be handled will cause an error. * Normally, only one change can be managed at a time. */ -static int update_array_info(mddev_t *mddev, mdu_array_info_t *info) +static int update_array_info(struct mddev *mddev, mdu_array_info_t *info) { int rv = 0; int cnt = 0; @@ -5993,7 +5993,7 @@ static int update_array_info(mddev_t *mddev, mdu_array_info_t *info) return rv; } -static int set_disk_faulty(mddev_t *mddev, dev_t dev) +static int set_disk_faulty(struct mddev *mddev, dev_t dev) { struct md_rdev *rdev; @@ -6018,7 +6018,7 @@ static int set_disk_faulty(mddev_t *mddev, dev_t dev) */ static int md_getgeo(struct block_device *bdev, struct hd_geometry *geo) { - mddev_t *mddev = bdev->bd_disk->private_data; + struct mddev *mddev = bdev->bd_disk->private_data; geo->heads = 2; geo->sectors = 4; @@ -6031,7 +6031,7 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode, { int err = 0; void __user *argp = (void __user *)arg; - mddev_t *mddev = NULL; + struct mddev *mddev = NULL; int ro; if (!capable(CAP_SYS_ADMIN)) @@ -6294,7 +6294,7 @@ static int md_open(struct block_device *bdev, fmode_t mode) * Succeed if we can lock the mddev, which confirms that * it isn't being stopped right now. */ - mddev_t *mddev = mddev_find(bdev->bd_dev); + struct mddev *mddev = mddev_find(bdev->bd_dev); int err; if (mddev->gendisk != bdev->bd_disk) { @@ -6323,7 +6323,7 @@ static int md_open(struct block_device *bdev, fmode_t mode) static int md_release(struct gendisk *disk, fmode_t mode) { - mddev_t *mddev = disk->private_data; + struct mddev *mddev = disk->private_data; BUG_ON(!mddev); atomic_dec(&mddev->openers); @@ -6334,14 +6334,14 @@ static int md_release(struct gendisk *disk, fmode_t mode) static int md_media_changed(struct gendisk *disk) { - mddev_t *mddev = disk->private_data; + struct mddev *mddev = disk->private_data; return mddev->changed; } static int md_revalidate(struct gendisk *disk) { - mddev_t *mddev = disk->private_data; + struct mddev *mddev = disk->private_data; mddev->changed = 0; return 0; @@ -6410,7 +6410,7 @@ void md_wakeup_thread(mdk_thread_t *thread) } } -mdk_thread_t *md_register_thread(void (*run) (mddev_t *), mddev_t *mddev, +mdk_thread_t *md_register_thread(void (*run) (struct mddev *), struct mddev *mddev, const char *name) { mdk_thread_t *thread; @@ -6452,7 +6452,7 @@ void md_unregister_thread(mdk_thread_t **threadp) kfree(thread); } -void md_error(mddev_t *mddev, struct md_rdev *rdev) +void md_error(struct mddev *mddev, struct md_rdev *rdev) { if (!mddev) { MD_BUG(); @@ -6498,7 +6498,7 @@ static void status_unused(struct seq_file *seq) } -static void status_resync(struct seq_file *seq, mddev_t * mddev) +static void status_resync(struct seq_file *seq, struct mddev * mddev) { sector_t max_sectors, resync, res; unsigned long dt, db; @@ -6589,7 +6589,7 @@ static void *md_seq_start(struct seq_file *seq, loff_t *pos) { struct list_head *tmp; loff_t l = *pos; - mddev_t *mddev; + struct mddev *mddev; if (l >= 0x10000) return NULL; @@ -6600,7 +6600,7 @@ static void *md_seq_start(struct seq_file *seq, loff_t *pos) spin_lock(&all_mddevs_lock); list_for_each(tmp,&all_mddevs) if (!l--) { - mddev = list_entry(tmp, mddev_t, all_mddevs); + mddev = list_entry(tmp, struct mddev, all_mddevs); mddev_get(mddev); spin_unlock(&all_mddevs_lock); return mddev; @@ -6614,7 +6614,7 @@ static void *md_seq_start(struct seq_file *seq, loff_t *pos) static void *md_seq_next(struct seq_file *seq, void *v, loff_t *pos) { struct list_head *tmp; - mddev_t *next_mddev, *mddev = v; + struct mddev *next_mddev, *mddev = v; ++*pos; if (v == (void*)2) @@ -6626,7 +6626,7 @@ static void *md_seq_next(struct seq_file *seq, void *v, loff_t *pos) else tmp = mddev->all_mddevs.next; if (tmp != &all_mddevs) - next_mddev = mddev_get(list_entry(tmp,mddev_t,all_mddevs)); + next_mddev = mddev_get(list_entry(tmp,struct mddev,all_mddevs)); else { next_mddev = (void*)2; *pos = 0x10000; @@ -6641,7 +6641,7 @@ static void *md_seq_next(struct seq_file *seq, void *v, loff_t *pos) static void md_seq_stop(struct seq_file *seq, void *v) { - mddev_t *mddev = v; + struct mddev *mddev = v; if (mddev && v != (void*)1 && v != (void*)2) mddev_put(mddev); @@ -6649,7 +6649,7 @@ static void md_seq_stop(struct seq_file *seq, void *v) static int md_seq_show(struct seq_file *seq, void *v) { - mddev_t *mddev = v; + struct mddev *mddev = v; sector_t sectors; struct md_rdev *rdev; struct bitmap *bitmap; @@ -6829,7 +6829,7 @@ int unregister_md_personality(struct mdk_personality *p) return 0; } -static int is_mddev_idle(mddev_t *mddev, int init) +static int is_mddev_idle(struct mddev *mddev, int init) { struct md_rdev * rdev; int idle; @@ -6873,7 +6873,7 @@ static int is_mddev_idle(mddev_t *mddev, int init) return idle; } -void md_done_sync(mddev_t *mddev, int blocks, int ok) +void md_done_sync(struct mddev *mddev, int blocks, int ok) { /* another "blocks" (512byte) blocks have been synced */ atomic_sub(blocks, &mddev->recovery_active); @@ -6891,7 +6891,7 @@ void md_done_sync(mddev_t *mddev, int blocks, int ok) * in superblock) before writing, schedule a superblock update * and wait for it to complete. */ -void md_write_start(mddev_t *mddev, struct bio *bi) +void md_write_start(struct mddev *mddev, struct bio *bi) { int did_change = 0; if (bio_data_dir(bi) != WRITE) @@ -6926,7 +6926,7 @@ void md_write_start(mddev_t *mddev, struct bio *bi) !test_bit(MD_CHANGE_PENDING, &mddev->flags)); } -void md_write_end(mddev_t *mddev) +void md_write_end(struct mddev *mddev) { if (atomic_dec_and_test(&mddev->writes_pending)) { if (mddev->safemode == 2) @@ -6945,7 +6945,7 @@ void md_write_end(mddev_t *mddev) * In the ->external case MD_CHANGE_CLEAN can not be cleared until mddev->lock * is dropped, so return -EAGAIN after notifying userspace. */ -int md_allow_write(mddev_t *mddev) +int md_allow_write(struct mddev *mddev) { if (!mddev->pers) return 0; @@ -6977,9 +6977,9 @@ EXPORT_SYMBOL_GPL(md_allow_write); #define SYNC_MARKS 10 #define SYNC_MARK_STEP (3*HZ) -void md_do_sync(mddev_t *mddev) +void md_do_sync(struct mddev *mddev) { - mddev_t *mddev2; + struct mddev *mddev2; unsigned int currspeed = 0, window; sector_t max_sectors,j, io_sectors; @@ -7304,7 +7304,7 @@ void md_do_sync(mddev_t *mddev) } EXPORT_SYMBOL_GPL(md_do_sync); -static int remove_and_add_spares(mddev_t *mddev) +static int remove_and_add_spares(struct mddev *mddev) { struct md_rdev *rdev; int spares = 0; @@ -7348,7 +7348,7 @@ static int remove_and_add_spares(mddev_t *mddev) return spares; } -static void reap_sync_thread(mddev_t *mddev) +static void reap_sync_thread(struct mddev *mddev) { struct md_rdev *rdev; @@ -7409,7 +7409,7 @@ static void reap_sync_thread(mddev_t *mddev) * 5/ If array is degraded, try to add spares devices * 6/ If array has spares or is not in-sync, start a resync thread. */ -void md_check_recovery(mddev_t *mddev) +void md_check_recovery(struct mddev *mddev) { if (mddev->suspended) return; @@ -7569,7 +7569,7 @@ void md_check_recovery(mddev_t *mddev) } } -void md_wait_for_blocked_rdev(struct md_rdev *rdev, mddev_t *mddev) +void md_wait_for_blocked_rdev(struct md_rdev *rdev, struct mddev *mddev) { sysfs_notify_dirent_safe(rdev->sysfs_state); wait_event_timeout(rdev->blocked_wait, @@ -8070,7 +8070,7 @@ static int md_notify_reboot(struct notifier_block *this, unsigned long code, void *x) { struct list_head *tmp; - mddev_t *mddev; + struct mddev *mddev; int need_delay = 0; if ((code == SYS_DOWN) || (code == SYS_HALT) || (code == SYS_POWER_OFF)) { @@ -8223,7 +8223,7 @@ static void autostart_arrays(int part) static __exit void md_exit(void) { - mddev_t *mddev; + struct mddev *mddev; struct list_head *tmp; blk_unregister_region(MKDEV(MD_MAJOR,0), 1U << MINORBITS); diff --git a/drivers/md/md.h b/drivers/md/md.h index b0e98c868c14..84a2c03c49c5 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -26,8 +26,6 @@ #define MaxSector (~(sector_t)0) -typedef struct mddev_s mddev_t; - /* Bad block numbers are stored sorted in a single page. * 64bits is used for each block or extent. * 54 bits are sector number, 9 bits are extent size, @@ -42,7 +40,7 @@ struct md_rdev { struct list_head same_set; /* RAID devices within the same set */ sector_t sectors; /* Device size (in 512bytes sectors) */ - mddev_t *mddev; /* RAID array if running */ + struct mddev *mddev; /* RAID array if running */ int last_events; /* IO event timestamp */ /* @@ -184,8 +182,7 @@ extern int rdev_set_badblocks(struct md_rdev *rdev, sector_t s, int sectors, extern int rdev_clear_badblocks(struct md_rdev *rdev, sector_t s, int sectors); extern void md_ack_all_badblocks(struct badblocks *bb); -struct mddev_s -{ +struct mddev { void *private; struct mdk_personality *pers; dev_t unit; @@ -400,11 +397,11 @@ struct mddev_s atomic_t flush_pending; struct work_struct flush_work; struct work_struct event_work; /* used by dm to report failure event */ - void (*sync_super)(mddev_t *mddev, struct md_rdev *rdev); + void (*sync_super)(struct mddev *mddev, struct md_rdev *rdev); }; -static inline void rdev_dec_pending(struct md_rdev *rdev, mddev_t *mddev) +static inline void rdev_dec_pending(struct md_rdev *rdev, struct mddev *mddev) { int faulty = test_bit(Faulty, &rdev->flags); if (atomic_dec_and_test(&rdev->nr_pending) && faulty) @@ -422,29 +419,29 @@ struct mdk_personality int level; struct list_head list; struct module *owner; - int (*make_request)(mddev_t *mddev, struct bio *bio); - int (*run)(mddev_t *mddev); - int (*stop)(mddev_t *mddev); - void (*status)(struct seq_file *seq, mddev_t *mddev); + int (*make_request)(struct mddev *mddev, struct bio *bio); + int (*run)(struct mddev *mddev); + int (*stop)(struct mddev *mddev); + void (*status)(struct seq_file *seq, struct mddev *mddev); /* error_handler must set ->faulty and clear ->in_sync * if appropriate, and should abort recovery if needed */ - void (*error_handler)(mddev_t *mddev, struct md_rdev *rdev); - int (*hot_add_disk) (mddev_t *mddev, struct md_rdev *rdev); - int (*hot_remove_disk) (mddev_t *mddev, int number); - int (*spare_active) (mddev_t *mddev); - sector_t (*sync_request)(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster); - int (*resize) (mddev_t *mddev, sector_t sectors); - sector_t (*size) (mddev_t *mddev, sector_t sectors, int raid_disks); - int (*check_reshape) (mddev_t *mddev); - int (*start_reshape) (mddev_t *mddev); - void (*finish_reshape) (mddev_t *mddev); + void (*error_handler)(struct mddev *mddev, struct md_rdev *rdev); + int (*hot_add_disk) (struct mddev *mddev, struct md_rdev *rdev); + int (*hot_remove_disk) (struct mddev *mddev, int number); + int (*spare_active) (struct mddev *mddev); + sector_t (*sync_request)(struct mddev *mddev, sector_t sector_nr, int *skipped, int go_faster); + int (*resize) (struct mddev *mddev, sector_t sectors); + sector_t (*size) (struct mddev *mddev, sector_t sectors, int raid_disks); + int (*check_reshape) (struct mddev *mddev); + int (*start_reshape) (struct mddev *mddev); + void (*finish_reshape) (struct mddev *mddev); /* quiesce moves between quiescence states * 0 - fully active * 1 - no new requests allowed * others - reserved */ - void (*quiesce) (mddev_t *mddev, int state); + void (*quiesce) (struct mddev *mddev, int state); /* takeover is used to transition an array from one * personality to another. The new personality must be able * to handle the data in the current layout. @@ -454,14 +451,14 @@ struct mdk_personality * This needs to be installed and then ->run used to activate the * array. */ - void *(*takeover) (mddev_t *mddev); + void *(*takeover) (struct mddev *mddev); }; struct md_sysfs_entry { struct attribute attr; - ssize_t (*show)(mddev_t *, char *); - ssize_t (*store)(mddev_t *, const char *, size_t); + ssize_t (*show)(struct mddev *, char *); + ssize_t (*store)(struct mddev *, const char *, size_t); }; extern struct attribute_group md_bitmap_group; @@ -477,19 +474,19 @@ static inline void sysfs_notify_dirent_safe(struct sysfs_dirent *sd) sysfs_notify_dirent(sd); } -static inline char * mdname (mddev_t * mddev) +static inline char * mdname (struct mddev * mddev) { return mddev->gendisk ? mddev->gendisk->disk_name : "mdX"; } -static inline int sysfs_link_rdev(mddev_t *mddev, struct md_rdev *rdev) +static inline int sysfs_link_rdev(struct mddev *mddev, struct md_rdev *rdev) { char nm[20]; sprintf(nm, "rd%d", rdev->raid_disk); return sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); } -static inline void sysfs_unlink_rdev(mddev_t *mddev, struct md_rdev *rdev) +static inline void sysfs_unlink_rdev(struct mddev *mddev, struct md_rdev *rdev) { char nm[20]; sprintf(nm, "rd%d", rdev->raid_disk); @@ -513,8 +510,8 @@ static inline void sysfs_unlink_rdev(mddev_t *mddev, struct md_rdev *rdev) list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set) typedef struct mdk_thread_s { - void (*run) (mddev_t *mddev); - mddev_t *mddev; + void (*run) (struct mddev *mddev); + struct mddev *mddev; wait_queue_head_t wqueue; unsigned long flags; struct task_struct *tsk; @@ -556,46 +553,46 @@ static inline void safe_put_page(struct page *p) extern int register_md_personality(struct mdk_personality *p); extern int unregister_md_personality(struct mdk_personality *p); -extern mdk_thread_t * md_register_thread(void (*run) (mddev_t *mddev), - mddev_t *mddev, const char *name); +extern mdk_thread_t * md_register_thread(void (*run) (struct mddev *mddev), + struct mddev *mddev, const char *name); extern void md_unregister_thread(mdk_thread_t **threadp); extern void md_wakeup_thread(mdk_thread_t *thread); -extern void md_check_recovery(mddev_t *mddev); -extern void md_write_start(mddev_t *mddev, struct bio *bi); -extern void md_write_end(mddev_t *mddev); -extern void md_done_sync(mddev_t *mddev, int blocks, int ok); -extern void md_error(mddev_t *mddev, struct md_rdev *rdev); - -extern int mddev_congested(mddev_t *mddev, int bits); -extern void md_flush_request(mddev_t *mddev, struct bio *bio); -extern void md_super_write(mddev_t *mddev, struct md_rdev *rdev, +extern void md_check_recovery(struct mddev *mddev); +extern void md_write_start(struct mddev *mddev, struct bio *bi); +extern void md_write_end(struct mddev *mddev); +extern void md_done_sync(struct mddev *mddev, int blocks, int ok); +extern void md_error(struct mddev *mddev, struct md_rdev *rdev); + +extern int mddev_congested(struct mddev *mddev, int bits); +extern void md_flush_request(struct mddev *mddev, struct bio *bio); +extern void md_super_write(struct mddev *mddev, struct md_rdev *rdev, sector_t sector, int size, struct page *page); -extern void md_super_wait(mddev_t *mddev); +extern void md_super_wait(struct mddev *mddev); extern int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, struct page *page, int rw, bool metadata_op); -extern void md_do_sync(mddev_t *mddev); -extern void md_new_event(mddev_t *mddev); -extern int md_allow_write(mddev_t *mddev); -extern void md_wait_for_blocked_rdev(struct md_rdev *rdev, mddev_t *mddev); -extern void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors); -extern int md_check_no_bitmap(mddev_t *mddev); -extern int md_integrity_register(mddev_t *mddev); -extern void md_integrity_add_rdev(struct md_rdev *rdev, mddev_t *mddev); +extern void md_do_sync(struct mddev *mddev); +extern void md_new_event(struct mddev *mddev); +extern int md_allow_write(struct mddev *mddev); +extern void md_wait_for_blocked_rdev(struct md_rdev *rdev, struct mddev *mddev); +extern void md_set_array_sectors(struct mddev *mddev, sector_t array_sectors); +extern int md_check_no_bitmap(struct mddev *mddev); +extern int md_integrity_register(struct mddev *mddev); +extern void md_integrity_add_rdev(struct md_rdev *rdev, struct mddev *mddev); extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale); extern void restore_bitmap_write_access(struct file *file); -extern void mddev_init(mddev_t *mddev); -extern int md_run(mddev_t *mddev); -extern void md_stop(mddev_t *mddev); -extern void md_stop_writes(mddev_t *mddev); +extern void mddev_init(struct mddev *mddev); +extern int md_run(struct mddev *mddev); +extern void md_stop(struct mddev *mddev); +extern void md_stop_writes(struct mddev *mddev); extern int md_rdev_init(struct md_rdev *rdev); -extern void mddev_suspend(mddev_t *mddev); -extern void mddev_resume(mddev_t *mddev); +extern void mddev_suspend(struct mddev *mddev); +extern void mddev_resume(struct mddev *mddev); extern struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask, - mddev_t *mddev); + struct mddev *mddev); extern struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, - mddev_t *mddev); -extern int mddev_check_plugged(mddev_t *mddev); + struct mddev *mddev); +extern int mddev_check_plugged(struct mddev *mddev); extern void md_trim_bio(struct bio *bio, int offset, int size); #endif /* _MD_MD_H */ diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 09e8aa3d59f9..9c8d4b664312 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c @@ -58,7 +58,7 @@ static int multipath_map (multipath_conf_t *conf) static void multipath_reschedule_retry (struct multipath_bh *mp_bh) { unsigned long flags; - mddev_t *mddev = mp_bh->mddev; + struct mddev *mddev = mp_bh->mddev; multipath_conf_t *conf = mddev->private; spin_lock_irqsave(&conf->device_lock, flags); @@ -106,7 +106,7 @@ static void multipath_end_request(struct bio *bio, int error) rdev_dec_pending(rdev, conf->mddev); } -static int multipath_make_request(mddev_t *mddev, struct bio * bio) +static int multipath_make_request(struct mddev *mddev, struct bio * bio) { multipath_conf_t *conf = mddev->private; struct multipath_bh * mp_bh; @@ -140,7 +140,7 @@ static int multipath_make_request(mddev_t *mddev, struct bio * bio) return 0; } -static void multipath_status (struct seq_file *seq, mddev_t *mddev) +static void multipath_status (struct seq_file *seq, struct mddev *mddev) { multipath_conf_t *conf = mddev->private; int i; @@ -156,7 +156,7 @@ static void multipath_status (struct seq_file *seq, mddev_t *mddev) static int multipath_congested(void *data, int bits) { - mddev_t *mddev = data; + struct mddev *mddev = data; multipath_conf_t *conf = mddev->private; int i, ret = 0; @@ -183,7 +183,7 @@ static int multipath_congested(void *data, int bits) /* * Careful, this can execute in IRQ contexts as well! */ -static void multipath_error (mddev_t *mddev, struct md_rdev *rdev) +static void multipath_error (struct mddev *mddev, struct md_rdev *rdev) { multipath_conf_t *conf = mddev->private; char b[BDEVNAME_SIZE]; @@ -242,7 +242,7 @@ static void print_multipath_conf (multipath_conf_t *conf) } -static int multipath_add_disk(mddev_t *mddev, struct md_rdev *rdev) +static int multipath_add_disk(struct mddev *mddev, struct md_rdev *rdev) { multipath_conf_t *conf = mddev->private; struct request_queue *q; @@ -291,7 +291,7 @@ static int multipath_add_disk(mddev_t *mddev, struct md_rdev *rdev) return err; } -static int multipath_remove_disk(mddev_t *mddev, int number) +static int multipath_remove_disk(struct mddev *mddev, int number) { multipath_conf_t *conf = mddev->private; int err = 0; @@ -335,7 +335,7 @@ abort: * 3. Performs writes following reads for array syncronising. */ -static void multipathd (mddev_t *mddev) +static void multipathd (struct mddev *mddev) { struct multipath_bh *mp_bh; struct bio *bio; @@ -379,7 +379,7 @@ static void multipathd (mddev_t *mddev) spin_unlock_irqrestore(&conf->device_lock, flags); } -static sector_t multipath_size(mddev_t *mddev, sector_t sectors, int raid_disks) +static sector_t multipath_size(struct mddev *mddev, sector_t sectors, int raid_disks) { WARN_ONCE(sectors || raid_disks, "%s does not support generic reshape\n", __func__); @@ -387,7 +387,7 @@ static sector_t multipath_size(mddev_t *mddev, sector_t sectors, int raid_disks) return mddev->dev_sectors; } -static int multipath_run (mddev_t *mddev) +static int multipath_run (struct mddev *mddev) { multipath_conf_t *conf; int disk_idx; @@ -510,7 +510,7 @@ out: } -static int multipath_stop (mddev_t *mddev) +static int multipath_stop (struct mddev *mddev) { multipath_conf_t *conf = mddev->private; diff --git a/drivers/md/multipath.h b/drivers/md/multipath.h index 034f8381e046..350a631b6c93 100644 --- a/drivers/md/multipath.h +++ b/drivers/md/multipath.h @@ -6,7 +6,7 @@ struct multipath_info { }; struct multipath_private_data { - mddev_t *mddev; + struct mddev *mddev; struct multipath_info *multipaths; int raid_disks; spinlock_t device_lock; @@ -24,7 +24,7 @@ typedef struct multipath_private_data multipath_conf_t; */ struct multipath_bh { - mddev_t *mddev; + struct mddev *mddev; struct bio *master_bio; struct bio bio; int path; diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 70fc3d949795..db51e6f68191 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -27,7 +27,7 @@ static int raid0_congested(void *data, int bits) { - mddev_t *mddev = data; + struct mddev *mddev = data; raid0_conf_t *conf = mddev->private; struct md_rdev **devlist = conf->devlist; int raid_disks = conf->strip_zone[0].nb_dev; @@ -47,7 +47,7 @@ static int raid0_congested(void *data, int bits) /* * inform the user of the raid configuration */ -static void dump_zones(mddev_t *mddev) +static void dump_zones(struct mddev *mddev) { int j, k; sector_t zone_size = 0; @@ -77,7 +77,7 @@ static void dump_zones(mddev_t *mddev) printk(KERN_INFO "\n"); } -static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) +static int create_strip_zones(struct mddev *mddev, raid0_conf_t **private_conf) { int i, c, err; sector_t curr_zone_end, sectors; @@ -301,7 +301,7 @@ static int raid0_mergeable_bvec(struct request_queue *q, struct bvec_merge_data *bvm, struct bio_vec *biovec) { - mddev_t *mddev = q->queuedata; + struct mddev *mddev = q->queuedata; sector_t sector = bvm->bi_sector + get_start_sect(bvm->bi_bdev); int max; unsigned int chunk_sectors = mddev->chunk_sectors; @@ -320,7 +320,7 @@ static int raid0_mergeable_bvec(struct request_queue *q, return max; } -static sector_t raid0_size(mddev_t *mddev, sector_t sectors, int raid_disks) +static sector_t raid0_size(struct mddev *mddev, sector_t sectors, int raid_disks) { sector_t array_sectors = 0; struct md_rdev *rdev; @@ -334,7 +334,7 @@ static sector_t raid0_size(mddev_t *mddev, sector_t sectors, int raid_disks) return array_sectors; } -static int raid0_run(mddev_t *mddev) +static int raid0_run(struct mddev *mddev) { raid0_conf_t *conf; int ret; @@ -384,7 +384,7 @@ static int raid0_run(mddev_t *mddev) return md_integrity_register(mddev); } -static int raid0_stop(mddev_t *mddev) +static int raid0_stop(struct mddev *mddev) { raid0_conf_t *conf = mddev->private; @@ -419,7 +419,7 @@ static struct strip_zone *find_zone(struct raid0_private_data *conf, * remaps the bio to the target device. we separate two flows. * power 2 flow and a general flow for the sake of perfromance */ -static struct md_rdev *map_sector(mddev_t *mddev, struct strip_zone *zone, +static struct md_rdev *map_sector(struct mddev *mddev, struct strip_zone *zone, sector_t sector, sector_t *sector_offset) { unsigned int sect_in_chunk; @@ -455,7 +455,7 @@ static struct md_rdev *map_sector(mddev_t *mddev, struct strip_zone *zone, /* * Is io distribute over 1 or more chunks ? */ -static inline int is_io_in_chunk_boundary(mddev_t *mddev, +static inline int is_io_in_chunk_boundary(struct mddev *mddev, unsigned int chunk_sects, struct bio *bio) { if (likely(is_power_of_2(chunk_sects))) { @@ -468,7 +468,7 @@ static inline int is_io_in_chunk_boundary(mddev_t *mddev, } } -static int raid0_make_request(mddev_t *mddev, struct bio *bio) +static int raid0_make_request(struct mddev *mddev, struct bio *bio) { unsigned int chunk_sects; sector_t sector_offset; @@ -528,13 +528,13 @@ bad_map: return 0; } -static void raid0_status(struct seq_file *seq, mddev_t *mddev) +static void raid0_status(struct seq_file *seq, struct mddev *mddev) { seq_printf(seq, " %dk chunks", mddev->chunk_sectors / 2); return; } -static void *raid0_takeover_raid45(mddev_t *mddev) +static void *raid0_takeover_raid45(struct mddev *mddev) { struct md_rdev *rdev; raid0_conf_t *priv_conf; @@ -568,7 +568,7 @@ static void *raid0_takeover_raid45(mddev_t *mddev) return priv_conf; } -static void *raid0_takeover_raid10(mddev_t *mddev) +static void *raid0_takeover_raid10(struct mddev *mddev) { raid0_conf_t *priv_conf; @@ -609,7 +609,7 @@ static void *raid0_takeover_raid10(mddev_t *mddev) return priv_conf; } -static void *raid0_takeover_raid1(mddev_t *mddev) +static void *raid0_takeover_raid1(struct mddev *mddev) { raid0_conf_t *priv_conf; @@ -635,7 +635,7 @@ static void *raid0_takeover_raid1(mddev_t *mddev) return priv_conf; } -static void *raid0_takeover(mddev_t *mddev) +static void *raid0_takeover(struct mddev *mddev) { /* raid0 can take over: * raid4 - if all data disks are active. @@ -666,7 +666,7 @@ static void *raid0_takeover(mddev_t *mddev) return ERR_PTR(-EINVAL); } -static void raid0_quiesce(mddev_t *mddev, int state) +static void raid0_quiesce(struct mddev *mddev, int state) { } diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index de7d2b677066..50bd7c9411b9 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -193,7 +193,7 @@ static void put_buf(r1bio_t *r1_bio) static void reschedule_retry(r1bio_t *r1_bio) { unsigned long flags; - mddev_t *mddev = r1_bio->mddev; + struct mddev *mddev = r1_bio->mddev; conf_t *conf = mddev->private; spin_lock_irqsave(&conf->device_lock, flags); @@ -593,7 +593,7 @@ static int read_balance(conf_t *conf, r1bio_t *r1_bio, int *max_sectors) return best_disk; } -int md_raid1_congested(mddev_t *mddev, int bits) +int md_raid1_congested(struct mddev *mddev, int bits) { conf_t *conf = mddev->private; int i, ret = 0; @@ -622,7 +622,7 @@ EXPORT_SYMBOL_GPL(md_raid1_congested); static int raid1_congested(void *data, int bits) { - mddev_t *mddev = data; + struct mddev *mddev = data; return mddev_congested(mddev, bits) || md_raid1_congested(mddev, bits); @@ -796,7 +796,7 @@ do_sync_io: pr_debug("%dB behind alloc failed, doing sync I/O\n", bio->bi_size); } -static int make_request(mddev_t *mddev, struct bio * bio) +static int make_request(struct mddev *mddev, struct bio * bio) { conf_t *conf = mddev->private; mirror_info_t *mirror; @@ -1138,7 +1138,7 @@ read_again: return 0; } -static void status(struct seq_file *seq, mddev_t *mddev) +static void status(struct seq_file *seq, struct mddev *mddev) { conf_t *conf = mddev->private; int i; @@ -1156,7 +1156,7 @@ static void status(struct seq_file *seq, mddev_t *mddev) } -static void error(mddev_t *mddev, struct md_rdev *rdev) +static void error(struct mddev *mddev, struct md_rdev *rdev) { char b[BDEVNAME_SIZE]; conf_t *conf = mddev->private; @@ -1233,7 +1233,7 @@ static void close_sync(conf_t *conf) conf->r1buf_pool = NULL; } -static int raid1_spare_active(mddev_t *mddev) +static int raid1_spare_active(struct mddev *mddev) { int i; conf_t *conf = mddev->private; @@ -1263,7 +1263,7 @@ static int raid1_spare_active(mddev_t *mddev) } -static int raid1_add_disk(mddev_t *mddev, struct md_rdev *rdev) +static int raid1_add_disk(struct mddev *mddev, struct md_rdev *rdev) { conf_t *conf = mddev->private; int err = -EEXIST; @@ -1311,7 +1311,7 @@ static int raid1_add_disk(mddev_t *mddev, struct md_rdev *rdev) return err; } -static int raid1_remove_disk(mddev_t *mddev, int number) +static int raid1_remove_disk(struct mddev *mddev, int number) { conf_t *conf = mddev->private; int err = 0; @@ -1374,7 +1374,7 @@ static void end_sync_write(struct bio *bio, int error) { int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); r1bio_t *r1_bio = bio->bi_private; - mddev_t *mddev = r1_bio->mddev; + struct mddev *mddev = r1_bio->mddev; conf_t *conf = mddev->private; int mirror=0; sector_t first_bad; @@ -1446,7 +1446,7 @@ static int fix_sync_read_error(r1bio_t *r1_bio) * made sure that anything with a bad block in range * will have bi_end_io clear. */ - mddev_t *mddev = r1_bio->mddev; + struct mddev *mddev = r1_bio->mddev; conf_t *conf = mddev->private; struct bio *bio = r1_bio->bios[r1_bio->read_disk]; sector_t sect = r1_bio->sector; @@ -1562,7 +1562,7 @@ static int process_checks(r1bio_t *r1_bio) * If any blocks failed to read, then we need to * attempt an over-write */ - mddev_t *mddev = r1_bio->mddev; + struct mddev *mddev = r1_bio->mddev; conf_t *conf = mddev->private; int primary; int i; @@ -1635,7 +1635,7 @@ static int process_checks(r1bio_t *r1_bio) return 0; } -static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio) +static void sync_request_write(struct mddev *mddev, r1bio_t *r1_bio) { conf_t *conf = mddev->private; int i; @@ -1690,7 +1690,7 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio) static void fix_read_error(conf_t *conf, int read_disk, sector_t sect, int sectors) { - mddev_t *mddev = conf->mddev; + struct mddev *mddev = conf->mddev; while(sectors) { int s = sectors; int d = read_disk; @@ -1792,7 +1792,7 @@ static int submit_bio_wait(int rw, struct bio *bio) static int narrow_write_error(r1bio_t *r1_bio, int i) { - mddev_t *mddev = r1_bio->mddev; + struct mddev *mddev = r1_bio->mddev; conf_t *conf = mddev->private; struct md_rdev *rdev = conf->mirrors[i].rdev; int vcnt, idx; @@ -1922,7 +1922,7 @@ static void handle_read_error(conf_t *conf, r1bio_t *r1_bio) { int disk; int max_sectors; - mddev_t *mddev = conf->mddev; + struct mddev *mddev = conf->mddev; struct bio *bio; char b[BDEVNAME_SIZE]; struct md_rdev *rdev; @@ -2008,7 +2008,7 @@ read_more: } } -static void raid1d(mddev_t *mddev) +static void raid1d(struct mddev *mddev) { r1bio_t *r1_bio; unsigned long flags; @@ -2085,7 +2085,7 @@ static int init_resync(conf_t *conf) * that can be installed to exclude normal IO requests. */ -static sector_t sync_request(mddev_t *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; r1bio_t *r1_bio; @@ -2357,7 +2357,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i return nr_sectors; } -static sector_t raid1_size(mddev_t *mddev, sector_t sectors, int raid_disks) +static sector_t raid1_size(struct mddev *mddev, sector_t sectors, int raid_disks) { if (sectors) return sectors; @@ -2365,7 +2365,7 @@ static sector_t raid1_size(mddev_t *mddev, sector_t sectors, int raid_disks) return mddev->dev_sectors; } -static conf_t *setup_conf(mddev_t *mddev) +static conf_t *setup_conf(struct mddev *mddev) { conf_t *conf; int i; @@ -2466,7 +2466,7 @@ static conf_t *setup_conf(mddev_t *mddev) return ERR_PTR(err); } -static int run(mddev_t *mddev) +static int run(struct mddev *mddev) { conf_t *conf; int i; @@ -2546,7 +2546,7 @@ static int run(mddev_t *mddev) return md_integrity_register(mddev); } -static int stop(mddev_t *mddev) +static int stop(struct mddev *mddev) { conf_t *conf = mddev->private; struct bitmap *bitmap = mddev->bitmap; @@ -2573,7 +2573,7 @@ static int stop(mddev_t *mddev) return 0; } -static int raid1_resize(mddev_t *mddev, sector_t sectors) +static int raid1_resize(struct mddev *mddev, sector_t sectors) { /* no resync is happening, and there is enough space * on all devices, so we can resize. @@ -2597,7 +2597,7 @@ static int raid1_resize(mddev_t *mddev, sector_t sectors) return 0; } -static int raid1_reshape(mddev_t *mddev) +static int raid1_reshape(struct mddev *mddev) { /* We need to: * 1/ resize the r1bio_pool @@ -2703,7 +2703,7 @@ static int raid1_reshape(mddev_t *mddev) return 0; } -static void raid1_quiesce(mddev_t *mddev, int state) +static void raid1_quiesce(struct mddev *mddev, int state) { conf_t *conf = mddev->private; @@ -2720,7 +2720,7 @@ static void raid1_quiesce(mddev_t *mddev, int state) } } -static void *raid1_takeover(mddev_t *mddev) +static void *raid1_takeover(struct mddev *mddev) { /* raid1 can take over: * raid5 with 2 devices, any layout or chunk size diff --git a/drivers/md/raid1.h b/drivers/md/raid1.h index 2377a461f794..b6bc7b1c589d 100644 --- a/drivers/md/raid1.h +++ b/drivers/md/raid1.h @@ -17,7 +17,7 @@ struct mirror_info { */ struct pool_info { - mddev_t *mddev; + struct mddev *mddev; int raid_disks; }; @@ -25,7 +25,7 @@ struct pool_info { typedef struct r1bio_s r1bio_t; struct r1_private_data_s { - mddev_t *mddev; + struct mddev *mddev; mirror_info_t *mirrors; int raid_disks; @@ -114,7 +114,7 @@ struct r1bio_s { sector_t sector; int sectors; unsigned long state; - mddev_t *mddev; + struct mddev *mddev; /* * original bio going to /dev/mdx */ @@ -173,6 +173,6 @@ struct r1bio_s { #define R1BIO_MadeGood 7 #define R1BIO_WriteError 8 -extern int md_raid1_congested(mddev_t *mddev, int bits); +extern int md_raid1_congested(struct mddev *mddev, int bits); #endif diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index b3b7238c5416..8c3bd6061f96 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -207,7 +207,7 @@ static void put_buf(r10bio_t *r10_bio) static void reschedule_retry(r10bio_t *r10_bio) { unsigned long flags; - mddev_t *mddev = r10_bio->mddev; + struct mddev *mddev = r10_bio->mddev; conf_t *conf = mddev->private; spin_lock_irqsave(&conf->device_lock, flags); @@ -522,7 +522,7 @@ static int raid10_mergeable_bvec(struct request_queue *q, struct bvec_merge_data *bvm, struct bio_vec *biovec) { - mddev_t *mddev = q->queuedata; + struct mddev *mddev = q->queuedata; sector_t sector = bvm->bi_sector + get_start_sect(bvm->bi_bdev); int max; unsigned int chunk_sectors = mddev->chunk_sectors; @@ -677,7 +677,7 @@ retry: static int raid10_congested(void *data, int bits) { - mddev_t *mddev = data; + struct mddev *mddev = data; conf_t *conf = mddev->private; int i, ret = 0; @@ -830,7 +830,7 @@ static void unfreeze_array(conf_t *conf) spin_unlock_irq(&conf->resync_lock); } -static int make_request(mddev_t *mddev, struct bio * bio) +static int make_request(struct mddev *mddev, struct bio * bio) { conf_t *conf = mddev->private; mirror_info_t *mirror; @@ -1161,7 +1161,7 @@ retry_write: return 0; } -static void status(struct seq_file *seq, mddev_t *mddev) +static void status(struct seq_file *seq, struct mddev *mddev) { conf_t *conf = mddev->private; int i; @@ -1209,7 +1209,7 @@ static int enough(conf_t *conf, int ignore) return 1; } -static void error(mddev_t *mddev, struct md_rdev *rdev) +static void error(struct mddev *mddev, struct md_rdev *rdev) { char b[BDEVNAME_SIZE]; conf_t *conf = mddev->private; @@ -1279,7 +1279,7 @@ static void close_sync(conf_t *conf) conf->r10buf_pool = NULL; } -static int raid10_spare_active(mddev_t *mddev) +static int raid10_spare_active(struct mddev *mddev) { int i; conf_t *conf = mddev->private; @@ -1309,7 +1309,7 @@ static int raid10_spare_active(mddev_t *mddev) } -static int raid10_add_disk(mddev_t *mddev, struct md_rdev *rdev) +static int raid10_add_disk(struct mddev *mddev, struct md_rdev *rdev) { conf_t *conf = mddev->private; int err = -EEXIST; @@ -1368,7 +1368,7 @@ static int raid10_add_disk(mddev_t *mddev, struct md_rdev *rdev) return err; } -static int raid10_remove_disk(mddev_t *mddev, int number) +static int raid10_remove_disk(struct mddev *mddev, int number) { conf_t *conf = mddev->private; int err = 0; @@ -1441,7 +1441,7 @@ static void end_sync_read(struct bio *bio, int error) static void end_sync_request(r10bio_t *r10_bio) { - mddev_t *mddev = r10_bio->mddev; + struct mddev *mddev = r10_bio->mddev; while (atomic_dec_and_test(&r10_bio->remaining)) { if (r10_bio->master_bio == NULL) { @@ -1470,7 +1470,7 @@ static void end_sync_write(struct bio *bio, int error) { int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); r10bio_t *r10_bio = bio->bi_private; - mddev_t *mddev = r10_bio->mddev; + struct mddev *mddev = r10_bio->mddev; conf_t *conf = mddev->private; int d; sector_t first_bad; @@ -1509,7 +1509,7 @@ static void end_sync_write(struct bio *bio, int error) * We check if all blocks are in-sync and only write to blocks that * aren't in sync */ -static void sync_request_write(mddev_t *mddev, r10bio_t *r10_bio) +static void sync_request_write(struct mddev *mddev, r10bio_t *r10_bio) { conf_t *conf = mddev->private; int i, first; @@ -1618,7 +1618,7 @@ static void fix_recovery_read_error(r10bio_t *r10_bio) * If a read fails, record a bad block on both old and * new devices. */ - mddev_t *mddev = r10_bio->mddev; + struct mddev *mddev = r10_bio->mddev; conf_t *conf = mddev->private; struct bio *bio = r10_bio->devs[0].bio; sector_t sect = 0; @@ -1688,7 +1688,7 @@ static void fix_recovery_read_error(r10bio_t *r10_bio) } } -static void recovery_request_write(mddev_t *mddev, r10bio_t *r10_bio) +static void recovery_request_write(struct mddev *mddev, r10bio_t *r10_bio) { conf_t *conf = mddev->private; int d; @@ -1719,7 +1719,7 @@ static void recovery_request_write(mddev_t *mddev, r10bio_t *r10_bio) * since the last recorded read error. * */ -static void check_decay_read_errors(mddev_t *mddev, struct md_rdev *rdev) +static void check_decay_read_errors(struct mddev *mddev, struct md_rdev *rdev) { struct timespec cur_time_mon; unsigned long hours_since_last; @@ -1778,7 +1778,7 @@ static int r10_sync_page_io(struct md_rdev *rdev, sector_t sector, * 3. Performs writes following reads for array synchronising. */ -static void fix_read_error(conf_t *conf, mddev_t *mddev, r10bio_t *r10_bio) +static void fix_read_error(conf_t *conf, struct mddev *mddev, r10bio_t *r10_bio) { int sect = 0; /* Offset from r10_bio->sector */ int sectors = r10_bio->sectors; @@ -1986,7 +1986,7 @@ static int submit_bio_wait(int rw, struct bio *bio) static int narrow_write_error(r10bio_t *r10_bio, int i) { struct bio *bio = r10_bio->master_bio; - mddev_t *mddev = r10_bio->mddev; + struct mddev *mddev = r10_bio->mddev; conf_t *conf = mddev->private; struct md_rdev *rdev = conf->mirrors[r10_bio->devs[i].devnum].rdev; /* bio has the data to be written to slot 'i' where @@ -2040,7 +2040,7 @@ static int narrow_write_error(r10bio_t *r10_bio, int i) return ok; } -static void handle_read_error(mddev_t *mddev, r10bio_t *r10_bio) +static void handle_read_error(struct mddev *mddev, r10bio_t *r10_bio) { int slot = r10_bio->read_slot; int mirror = r10_bio->devs[slot].devnum; @@ -2200,7 +2200,7 @@ static void handle_write_completed(conf_t *conf, r10bio_t *r10_bio) } } -static void raid10d(mddev_t *mddev) +static void raid10d(struct mddev *mddev) { r10bio_t *r10_bio; unsigned long flags; @@ -2297,7 +2297,7 @@ static int init_resync(conf_t *conf) * */ -static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, +static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipped, int go_faster) { conf_t *conf = mddev->private; @@ -2714,7 +2714,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, } static sector_t -raid10_size(mddev_t *mddev, sector_t sectors, int raid_disks) +raid10_size(struct mddev *mddev, sector_t sectors, int raid_disks) { sector_t size; conf_t *conf = mddev->private; @@ -2733,7 +2733,7 @@ raid10_size(mddev_t *mddev, sector_t sectors, int raid_disks) } -static conf_t *setup_conf(mddev_t *mddev) +static conf_t *setup_conf(struct mddev *mddev) { conf_t *conf = NULL; int nc, fc, fo; @@ -2836,7 +2836,7 @@ static conf_t *setup_conf(mddev_t *mddev) return ERR_PTR(err); } -static int run(mddev_t *mddev) +static int run(struct mddev *mddev) { conf_t *conf; int i, disk_idx, chunk_size; @@ -2966,7 +2966,7 @@ out: return -EIO; } -static int stop(mddev_t *mddev) +static int stop(struct mddev *mddev) { conf_t *conf = mddev->private; @@ -2983,7 +2983,7 @@ static int stop(mddev_t *mddev) return 0; } -static void raid10_quiesce(mddev_t *mddev, int state) +static void raid10_quiesce(struct mddev *mddev, int state) { conf_t *conf = mddev->private; @@ -2997,7 +2997,7 @@ static void raid10_quiesce(mddev_t *mddev, int state) } } -static void *raid10_takeover_raid0(mddev_t *mddev) +static void *raid10_takeover_raid0(struct mddev *mddev) { struct md_rdev *rdev; conf_t *conf; @@ -3029,7 +3029,7 @@ static void *raid10_takeover_raid0(mddev_t *mddev) return conf; } -static void *raid10_takeover(mddev_t *mddev) +static void *raid10_takeover(struct mddev *mddev) { struct raid0_private_data *raid0_priv; diff --git a/drivers/md/raid10.h b/drivers/md/raid10.h index d37260fe9c3f..ad2da69becbe 100644 --- a/drivers/md/raid10.h +++ b/drivers/md/raid10.h @@ -16,7 +16,7 @@ struct mirror_info { typedef struct r10bio_s r10bio_t; struct r10_private_data_s { - mddev_t *mddev; + struct mddev *mddev; mirror_info_t *mirrors; int raid_disks; spinlock_t device_lock; @@ -87,7 +87,7 @@ struct r10bio_s { sector_t sector; /* virtual sector number */ int sectors; unsigned long state; - mddev_t *mddev; + struct mddev *mddev; /* * original bio going to /dev/mdx */ diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index d0e2a345e4d7..17725c59eb0b 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -1719,7 +1719,7 @@ static void raid5_build_block(struct stripe_head *sh, int i, int previous) dev->sector = compute_blocknr(sh, i, previous); } -static void error(mddev_t *mddev, struct md_rdev *rdev) +static void error(struct mddev *mddev, struct md_rdev *rdev) { char b[BDEVNAME_SIZE]; raid5_conf_t *conf = mddev->private; @@ -3403,7 +3403,7 @@ static void activate_bit_delay(raid5_conf_t *conf) } } -int md_raid5_congested(mddev_t *mddev, int bits) +int md_raid5_congested(struct mddev *mddev, int bits) { raid5_conf_t *conf = mddev->private; @@ -3424,7 +3424,7 @@ EXPORT_SYMBOL_GPL(md_raid5_congested); static int raid5_congested(void *data, int bits) { - mddev_t *mddev = data; + struct mddev *mddev = data; return mddev_congested(mddev, bits) || md_raid5_congested(mddev, bits); @@ -3437,7 +3437,7 @@ static int raid5_mergeable_bvec(struct request_queue *q, struct bvec_merge_data *bvm, struct bio_vec *biovec) { - mddev_t *mddev = q->queuedata; + struct mddev *mddev = q->queuedata; sector_t sector = bvm->bi_sector + get_start_sect(bvm->bi_bdev); int max; unsigned int chunk_sectors = mddev->chunk_sectors; @@ -3457,7 +3457,7 @@ static int raid5_mergeable_bvec(struct request_queue *q, } -static int in_chunk_boundary(mddev_t *mddev, struct bio *bio) +static int in_chunk_boundary(struct mddev *mddev, struct bio *bio) { sector_t sector = bio->bi_sector + get_start_sect(bio->bi_bdev); unsigned int chunk_sectors = mddev->chunk_sectors; @@ -3520,7 +3520,7 @@ static struct bio *remove_bio_from_retry(raid5_conf_t *conf) static void raid5_align_endio(struct bio *bi, int error) { struct bio* raid_bi = bi->bi_private; - mddev_t *mddev; + struct mddev *mddev; raid5_conf_t *conf; int uptodate = test_bit(BIO_UPTODATE, &bi->bi_flags); struct md_rdev *rdev; @@ -3567,7 +3567,7 @@ static int bio_fits_rdev(struct bio *bi) } -static int chunk_aligned_read(mddev_t *mddev, struct bio * raid_bio) +static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio) { raid5_conf_t *conf = mddev->private; int dd_idx; @@ -3688,7 +3688,7 @@ static struct stripe_head *__get_priority_stripe(raid5_conf_t *conf) return sh; } -static int make_request(mddev_t *mddev, struct bio * bi) +static int make_request(struct mddev *mddev, struct bio * bi) { raid5_conf_t *conf = mddev->private; int dd_idx; @@ -3848,9 +3848,9 @@ static int make_request(mddev_t *mddev, struct bio * bi) return 0; } -static sector_t raid5_size(mddev_t *mddev, sector_t sectors, int raid_disks); +static sector_t raid5_size(struct mddev *mddev, sector_t sectors, int raid_disks); -static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped) +static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr, int *skipped) { /* reshaping is quite different to recovery/resync so it is * handled quite separately ... here. @@ -4068,7 +4068,7 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped } /* FIXME go_faster isn't used */ -static inline sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster) +static inline sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipped, int go_faster) { raid5_conf_t *conf = mddev->private; struct stripe_head *sh; @@ -4227,7 +4227,7 @@ static int retry_aligned_read(raid5_conf_t *conf, struct bio *raid_bio) * During the scan, completed stripes are saved for us by the interrupt * handler, so that they will not have to wait for our next wakeup. */ -static void raid5d(mddev_t *mddev) +static void raid5d(struct mddev *mddev) { struct stripe_head *sh; raid5_conf_t *conf = mddev->private; @@ -4294,7 +4294,7 @@ static void raid5d(mddev_t *mddev) } static ssize_t -raid5_show_stripe_cache_size(mddev_t *mddev, char *page) +raid5_show_stripe_cache_size(struct mddev *mddev, char *page) { raid5_conf_t *conf = mddev->private; if (conf) @@ -4304,7 +4304,7 @@ raid5_show_stripe_cache_size(mddev_t *mddev, char *page) } int -raid5_set_cache_size(mddev_t *mddev, int size) +raid5_set_cache_size(struct mddev *mddev, int size) { raid5_conf_t *conf = mddev->private; int err; @@ -4330,7 +4330,7 @@ raid5_set_cache_size(mddev_t *mddev, int size) EXPORT_SYMBOL(raid5_set_cache_size); static ssize_t -raid5_store_stripe_cache_size(mddev_t *mddev, const char *page, size_t len) +raid5_store_stripe_cache_size(struct mddev *mddev, const char *page, size_t len) { raid5_conf_t *conf = mddev->private; unsigned long new; @@ -4355,7 +4355,7 @@ raid5_stripecache_size = __ATTR(stripe_cache_size, S_IRUGO | S_IWUSR, raid5_store_stripe_cache_size); static ssize_t -raid5_show_preread_threshold(mddev_t *mddev, char *page) +raid5_show_preread_threshold(struct mddev *mddev, char *page) { raid5_conf_t *conf = mddev->private; if (conf) @@ -4365,7 +4365,7 @@ raid5_show_preread_threshold(mddev_t *mddev, char *page) } static ssize_t -raid5_store_preread_threshold(mddev_t *mddev, const char *page, size_t len) +raid5_store_preread_threshold(struct mddev *mddev, const char *page, size_t len) { raid5_conf_t *conf = mddev->private; unsigned long new; @@ -4389,7 +4389,7 @@ raid5_preread_bypass_threshold = __ATTR(preread_bypass_threshold, raid5_store_preread_threshold); static ssize_t -stripe_cache_active_show(mddev_t *mddev, char *page) +stripe_cache_active_show(struct mddev *mddev, char *page) { raid5_conf_t *conf = mddev->private; if (conf) @@ -4413,7 +4413,7 @@ static struct attribute_group raid5_attrs_group = { }; static sector_t -raid5_size(mddev_t *mddev, sector_t sectors, int raid_disks) +raid5_size(struct mddev *mddev, sector_t sectors, int raid_disks) { raid5_conf_t *conf = mddev->private; @@ -4540,7 +4540,7 @@ static int raid5_alloc_percpu(raid5_conf_t *conf) return err; } -static raid5_conf_t *setup_conf(mddev_t *mddev) +static raid5_conf_t *setup_conf(struct mddev *mddev) { raid5_conf_t *conf; int raid_disk, memory, max_disks; @@ -4705,7 +4705,7 @@ static int only_parity(int raid_disk, int algo, int raid_disks, int max_degraded return 0; } -static int run(mddev_t *mddev) +static int run(struct mddev *mddev) { raid5_conf_t *conf; int working_disks = 0; @@ -4942,7 +4942,7 @@ abort: return -EIO; } -static int stop(mddev_t *mddev) +static int stop(struct mddev *mddev) { raid5_conf_t *conf = mddev->private; @@ -4955,7 +4955,7 @@ static int stop(mddev_t *mddev) return 0; } -static void status(struct seq_file *seq, mddev_t *mddev) +static void status(struct seq_file *seq, struct mddev *mddev) { raid5_conf_t *conf = mddev->private; int i; @@ -4994,7 +4994,7 @@ static void print_raid5_conf (raid5_conf_t *conf) } } -static int raid5_spare_active(mddev_t *mddev) +static int raid5_spare_active(struct mddev *mddev) { int i; raid5_conf_t *conf = mddev->private; @@ -5019,7 +5019,7 @@ static int raid5_spare_active(mddev_t *mddev) return count; } -static int raid5_remove_disk(mddev_t *mddev, int number) +static int raid5_remove_disk(struct mddev *mddev, int number) { raid5_conf_t *conf = mddev->private; int err = 0; @@ -5062,7 +5062,7 @@ abort: return err; } -static int raid5_add_disk(mddev_t *mddev, struct md_rdev *rdev) +static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev) { raid5_conf_t *conf = mddev->private; int err = -EEXIST; @@ -5105,7 +5105,7 @@ static int raid5_add_disk(mddev_t *mddev, struct md_rdev *rdev) return err; } -static int raid5_resize(mddev_t *mddev, sector_t sectors) +static int raid5_resize(struct mddev *mddev, sector_t sectors) { /* no resync is happening, and there is enough space * on all devices, so we can resize. @@ -5132,7 +5132,7 @@ static int raid5_resize(mddev_t *mddev, sector_t sectors) return 0; } -static int check_stripe_cache(mddev_t *mddev) +static int check_stripe_cache(struct mddev *mddev) { /* Can only proceed if there are plenty of stripe_heads. * We need a minimum of one full stripe,, and for sensible progress @@ -5156,7 +5156,7 @@ static int check_stripe_cache(mddev_t *mddev) return 1; } -static int check_reshape(mddev_t *mddev) +static int check_reshape(struct mddev *mddev) { raid5_conf_t *conf = mddev->private; @@ -5188,7 +5188,7 @@ static int check_reshape(mddev_t *mddev) return resize_stripes(conf, conf->raid_disks + mddev->delta_disks); } -static int raid5_start_reshape(mddev_t *mddev) +static int raid5_start_reshape(struct mddev *mddev) { raid5_conf_t *conf = mddev->private; struct md_rdev *rdev; @@ -5332,7 +5332,7 @@ static void end_reshape(raid5_conf_t *conf) /* This is called from the raid5d thread with mddev_lock held. * It makes config changes to the device. */ -static void raid5_finish_reshape(mddev_t *mddev) +static void raid5_finish_reshape(struct mddev *mddev) { raid5_conf_t *conf = mddev->private; @@ -5367,7 +5367,7 @@ static void raid5_finish_reshape(mddev_t *mddev) } } -static void raid5_quiesce(mddev_t *mddev, int state) +static void raid5_quiesce(struct mddev *mddev, int state) { raid5_conf_t *conf = mddev->private; @@ -5403,7 +5403,7 @@ static void raid5_quiesce(mddev_t *mddev, int state) } -static void *raid45_takeover_raid0(mddev_t *mddev, int level) +static void *raid45_takeover_raid0(struct mddev *mddev, int level) { struct raid0_private_data *raid0_priv = mddev->private; sector_t sectors; @@ -5430,7 +5430,7 @@ static void *raid45_takeover_raid0(mddev_t *mddev, int level) } -static void *raid5_takeover_raid1(mddev_t *mddev) +static void *raid5_takeover_raid1(struct mddev *mddev) { int chunksect; @@ -5457,7 +5457,7 @@ static void *raid5_takeover_raid1(mddev_t *mddev) return setup_conf(mddev); } -static void *raid5_takeover_raid6(mddev_t *mddev) +static void *raid5_takeover_raid6(struct mddev *mddev) { int new_layout; @@ -5491,7 +5491,7 @@ static void *raid5_takeover_raid6(mddev_t *mddev) } -static int raid5_check_reshape(mddev_t *mddev) +static int raid5_check_reshape(struct mddev *mddev) { /* For a 2-drive array, the layout and chunk size can be changed * immediately as not restriping is needed. @@ -5531,7 +5531,7 @@ static int raid5_check_reshape(mddev_t *mddev) return check_reshape(mddev); } -static int raid6_check_reshape(mddev_t *mddev) +static int raid6_check_reshape(struct mddev *mddev) { int new_chunk = mddev->new_chunk_sectors; @@ -5551,7 +5551,7 @@ static int raid6_check_reshape(mddev_t *mddev) return check_reshape(mddev); } -static void *raid5_takeover(mddev_t *mddev) +static void *raid5_takeover(struct mddev *mddev) { /* raid5 can take over: * raid0 - if there is only one strip zone - make it a raid4 layout @@ -5574,7 +5574,7 @@ static void *raid5_takeover(mddev_t *mddev) return ERR_PTR(-EINVAL); } -static void *raid4_takeover(mddev_t *mddev) +static void *raid4_takeover(struct mddev *mddev) { /* raid4 can take over: * raid0 - if there is only one strip zone @@ -5593,7 +5593,7 @@ static void *raid4_takeover(mddev_t *mddev) static struct mdk_personality raid5_personality; -static void *raid6_takeover(mddev_t *mddev) +static void *raid6_takeover(struct mddev *mddev) { /* Currently can only take over a raid5. We map the * personality to an equivalent raid6 personality diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index 6b234af7bf17..0d222de5e5be 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h @@ -349,7 +349,7 @@ struct disk_info { struct raid5_private_data { struct hlist_head *stripe_hashtbl; - mddev_t *mddev; + struct mddev *mddev; struct disk_info *spare; int chunk_sectors; int level, algorithm; @@ -503,7 +503,7 @@ static inline int algorithm_is_DDF(int layout) return layout >= 8 && layout <= 10; } -extern int md_raid5_congested(mddev_t *mddev, int bits); +extern int md_raid5_congested(struct mddev *mddev, int bits); extern void md_raid5_kick_device(raid5_conf_t *conf); -extern int raid5_set_cache_size(mddev_t *mddev, int size); +extern int raid5_set_cache_size(struct mddev *mddev, int size); #endif -- cgit v1.2.2 From 2b8bf3451d1e3133ebc3998721d14013a6c27114 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 11 Oct 2011 16:48:23 +1100 Subject: md: remove typedefs: mdk_thread_t -> struct md_thread Signed-off-by: NeilBrown --- drivers/md/md.c | 14 +++++++------- drivers/md/md.h | 18 ++++++++++-------- drivers/md/raid1.h | 2 +- drivers/md/raid10.h | 2 +- drivers/md/raid5.h | 2 +- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index f378b8a39eb2..1f661bbcaefe 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -6362,7 +6362,7 @@ static const struct block_device_operations md_fops = static int md_thread(void * arg) { - mdk_thread_t *thread = arg; + struct md_thread *thread = arg; /* * md_thread is a 'system-thread', it's priority should be very @@ -6401,7 +6401,7 @@ static int md_thread(void * arg) return 0; } -void md_wakeup_thread(mdk_thread_t *thread) +void md_wakeup_thread(struct md_thread *thread) { if (thread) { pr_debug("md: waking up MD thread %s.\n", thread->tsk->comm); @@ -6410,12 +6410,12 @@ void md_wakeup_thread(mdk_thread_t *thread) } } -mdk_thread_t *md_register_thread(void (*run) (struct mddev *), struct mddev *mddev, +struct md_thread *md_register_thread(void (*run) (struct mddev *), struct mddev *mddev, const char *name) { - mdk_thread_t *thread; + struct md_thread *thread; - thread = kzalloc(sizeof(mdk_thread_t), GFP_KERNEL); + thread = kzalloc(sizeof(struct md_thread), GFP_KERNEL); if (!thread) return NULL; @@ -6435,9 +6435,9 @@ mdk_thread_t *md_register_thread(void (*run) (struct mddev *), struct mddev *mdd return thread; } -void md_unregister_thread(mdk_thread_t **threadp) +void md_unregister_thread(struct md_thread **threadp) { - mdk_thread_t *thread = *threadp; + struct md_thread *thread = *threadp; if (!thread) return; pr_debug("interrupting MD-thread pid %d\n", task_pid_nr(thread->tsk)); diff --git a/drivers/md/md.h b/drivers/md/md.h index 84a2c03c49c5..b618da59ca1c 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -251,8 +251,8 @@ struct mddev { atomic_t plug_cnt; /* If device is expecting * more bios soon. */ - struct mdk_thread_s *thread; /* management thread */ - struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */ + struct md_thread *thread; /* management thread */ + struct md_thread *sync_thread; /* doing resync or reconstruct */ sector_t curr_resync; /* last block scheduled */ /* As resync requests can complete out of order, we cannot easily track * how much resync has been completed. So we occasionally pause until @@ -509,14 +509,14 @@ static inline void sysfs_unlink_rdev(struct mddev *mddev, struct md_rdev *rdev) #define rdev_for_each_rcu(rdev, mddev) \ list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set) -typedef struct mdk_thread_s { +struct md_thread { void (*run) (struct mddev *mddev); struct mddev *mddev; wait_queue_head_t wqueue; unsigned long flags; struct task_struct *tsk; unsigned long timeout; -} mdk_thread_t; +}; #define THREAD_WAKEUP 0 @@ -553,10 +553,12 @@ static inline void safe_put_page(struct page *p) extern int register_md_personality(struct mdk_personality *p); extern int unregister_md_personality(struct mdk_personality *p); -extern mdk_thread_t * md_register_thread(void (*run) (struct mddev *mddev), - struct mddev *mddev, const char *name); -extern void md_unregister_thread(mdk_thread_t **threadp); -extern void md_wakeup_thread(mdk_thread_t *thread); +extern struct md_thread *md_register_thread( + void (*run)(struct mddev *mddev), + struct mddev *mddev, + const char *name); +extern void md_unregister_thread(struct md_thread **threadp); +extern void md_wakeup_thread(struct md_thread *thread); extern void md_check_recovery(struct mddev *mddev); extern void md_write_start(struct mddev *mddev, struct bio *bi); extern void md_write_end(struct mddev *mddev); diff --git a/drivers/md/raid1.h b/drivers/md/raid1.h index b6bc7b1c589d..07e9cb91186b 100644 --- a/drivers/md/raid1.h +++ b/drivers/md/raid1.h @@ -92,7 +92,7 @@ struct r1_private_data_s { /* When taking over an array from a different personality, we store * the new thread here until we fully activate the array. */ - struct mdk_thread_s *thread; + struct md_thread *thread; }; typedef struct r1_private_data_s conf_t; diff --git a/drivers/md/raid10.h b/drivers/md/raid10.h index ad2da69becbe..c7721365f7bd 100644 --- a/drivers/md/raid10.h +++ b/drivers/md/raid10.h @@ -68,7 +68,7 @@ struct r10_private_data_s { /* When taking over an array from a different personality, we store * the new thread here until we fully activate the array. */ - struct mdk_thread_s *thread; + struct md_thread *thread; }; typedef struct r10_private_data_s conf_t; diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index 0d222de5e5be..cf4702ccf73a 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h @@ -436,7 +436,7 @@ struct raid5_private_data { /* When taking over an array from a different personality, we store * the new thread here until we fully activate the array. */ - struct mdk_thread_s *thread; + struct md_thread *thread; }; typedef struct raid5_private_data raid5_conf_t; -- cgit v1.2.2 From 9f2c9d12bcc53fcb3b787023723754e84d1aef8b Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 11 Oct 2011 16:48:43 +1100 Subject: md: remove typedefs: r10bio_t -> struct r10bio and r1bio_t -> struct r1bio Signed-off-by: NeilBrown --- drivers/md/raid1.c | 60 +++++++++++++++++++++++----------------------- drivers/md/raid1.h | 15 +++++------- drivers/md/raid10.c | 68 ++++++++++++++++++++++++++--------------------------- drivers/md/raid10.h | 4 +--- 4 files changed, 71 insertions(+), 76 deletions(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 50bd7c9411b9..6022111a4b28 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -52,7 +52,7 @@ static void lower_barrier(conf_t *conf); static void * r1bio_pool_alloc(gfp_t gfp_flags, void *data) { struct pool_info *pi = data; - int size = offsetof(r1bio_t, bios[pi->raid_disks]); + int size = offsetof(struct r1bio, bios[pi->raid_disks]); /* allocate a r1bio with room for raid_disks entries in the bios array */ return kzalloc(size, gfp_flags); @@ -73,7 +73,7 @@ static void * r1buf_pool_alloc(gfp_t gfp_flags, void *data) { struct pool_info *pi = data; struct page *page; - r1bio_t *r1_bio; + struct r1bio *r1_bio; struct bio *bio; int i, j; @@ -139,7 +139,7 @@ static void r1buf_pool_free(void *__r1_bio, void *data) { struct pool_info *pi = data; int i,j; - r1bio_t *r1bio = __r1_bio; + struct r1bio *r1bio = __r1_bio; for (i = 0; i < RESYNC_PAGES; i++) for (j = pi->raid_disks; j-- ;) { @@ -154,7 +154,7 @@ static void r1buf_pool_free(void *__r1_bio, void *data) r1bio_pool_free(r1bio, data); } -static void put_all_bios(conf_t *conf, r1bio_t *r1_bio) +static void put_all_bios(conf_t *conf, struct r1bio *r1_bio) { int i; @@ -166,7 +166,7 @@ static void put_all_bios(conf_t *conf, r1bio_t *r1_bio) } } -static void free_r1bio(r1bio_t *r1_bio) +static void free_r1bio(struct r1bio *r1_bio) { conf_t *conf = r1_bio->mddev->private; @@ -174,7 +174,7 @@ static void free_r1bio(r1bio_t *r1_bio) mempool_free(r1_bio, conf->r1bio_pool); } -static void put_buf(r1bio_t *r1_bio) +static void put_buf(struct r1bio *r1_bio) { conf_t *conf = r1_bio->mddev->private; int i; @@ -190,7 +190,7 @@ static void put_buf(r1bio_t *r1_bio) lower_barrier(conf); } -static void reschedule_retry(r1bio_t *r1_bio) +static void reschedule_retry(struct r1bio *r1_bio) { unsigned long flags; struct mddev *mddev = r1_bio->mddev; @@ -210,7 +210,7 @@ static void reschedule_retry(r1bio_t *r1_bio) * operation and are ready to return a success/failure code to the buffer * cache layer. */ -static void call_bio_endio(r1bio_t *r1_bio) +static void call_bio_endio(struct r1bio *r1_bio) { struct bio *bio = r1_bio->master_bio; int done; @@ -237,7 +237,7 @@ static void call_bio_endio(r1bio_t *r1_bio) } } -static void raid_end_bio_io(r1bio_t *r1_bio) +static void raid_end_bio_io(struct r1bio *r1_bio) { struct bio *bio = r1_bio->master_bio; @@ -257,7 +257,7 @@ static void raid_end_bio_io(r1bio_t *r1_bio) /* * Update disk head position estimator based on IRQ completion info. */ -static inline void update_head_pos(int disk, r1bio_t *r1_bio) +static inline void update_head_pos(int disk, struct r1bio *r1_bio) { conf_t *conf = r1_bio->mddev->private; @@ -268,7 +268,7 @@ static inline void update_head_pos(int disk, r1bio_t *r1_bio) /* * Find the disk number which triggered given bio */ -static int find_bio_disk(r1bio_t *r1_bio, struct bio *bio) +static int find_bio_disk(struct r1bio *r1_bio, struct bio *bio) { int mirror; int raid_disks = r1_bio->mddev->raid_disks; @@ -286,7 +286,7 @@ static int find_bio_disk(r1bio_t *r1_bio, struct bio *bio) static void raid1_end_read_request(struct bio *bio, int error) { int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); - r1bio_t *r1_bio = bio->bi_private; + struct r1bio *r1_bio = bio->bi_private; int mirror; conf_t *conf = r1_bio->mddev->private; @@ -333,7 +333,7 @@ static void raid1_end_read_request(struct bio *bio, int error) rdev_dec_pending(conf->mirrors[mirror].rdev, conf->mddev); } -static void close_write(r1bio_t *r1_bio) +static void close_write(struct r1bio *r1_bio) { /* it really is the end of this request */ if (test_bit(R1BIO_BehindIO, &r1_bio->state)) { @@ -352,7 +352,7 @@ static void close_write(r1bio_t *r1_bio) md_write_end(r1_bio->mddev); } -static void r1_bio_write_done(r1bio_t *r1_bio) +static void r1_bio_write_done(struct r1bio *r1_bio) { if (!atomic_dec_and_test(&r1_bio->remaining)) return; @@ -371,7 +371,7 @@ static void r1_bio_write_done(r1bio_t *r1_bio) static void raid1_end_write_request(struct bio *bio, int error) { int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); - r1bio_t *r1_bio = bio->bi_private; + struct r1bio *r1_bio = bio->bi_private; int mirror, behind = test_bit(R1BIO_BehindIO, &r1_bio->state); conf_t *conf = r1_bio->mddev->private; struct bio *to_put = NULL; @@ -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. */ -static int read_balance(conf_t *conf, r1bio_t *r1_bio, int *max_sectors) +static int read_balance(conf_t *conf, struct r1bio *r1_bio, int *max_sectors) { const sector_t this_sector = r1_bio->sector; int sectors; @@ -764,7 +764,7 @@ static void unfreeze_array(conf_t *conf) /* duplicate the data pages for behind I/O */ -static void alloc_behind_pages(struct bio *bio, r1bio_t *r1_bio) +static void alloc_behind_pages(struct bio *bio, struct r1bio *r1_bio) { int i; struct bio_vec *bvec; @@ -800,7 +800,7 @@ static int make_request(struct mddev *mddev, struct bio * bio) { conf_t *conf = mddev->private; mirror_info_t *mirror; - r1bio_t *r1_bio; + struct r1bio *r1_bio; struct bio *read_bio; int i, disks; struct bitmap *bitmap; @@ -1354,7 +1354,7 @@ abort: static void end_sync_read(struct bio *bio, int error) { - r1bio_t *r1_bio = bio->bi_private; + struct r1bio *r1_bio = bio->bi_private; update_head_pos(r1_bio->read_disk, r1_bio); @@ -1373,7 +1373,7 @@ static void end_sync_read(struct bio *bio, int error) static void end_sync_write(struct bio *bio, int error) { int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); - r1bio_t *r1_bio = bio->bi_private; + struct r1bio *r1_bio = bio->bi_private; struct mddev *mddev = r1_bio->mddev; conf_t *conf = mddev->private; int mirror=0; @@ -1433,7 +1433,7 @@ static int r1_sync_page_io(struct md_rdev *rdev, sector_t sector, return 0; } -static int fix_sync_read_error(r1bio_t *r1_bio) +static int fix_sync_read_error(struct r1bio *r1_bio) { /* Try some synchronous reads of other devices to get * good data, much like with normal read errors. Only @@ -1553,7 +1553,7 @@ static int fix_sync_read_error(r1bio_t *r1_bio) return 1; } -static int process_checks(r1bio_t *r1_bio) +static int process_checks(struct r1bio *r1_bio) { /* We have read all readable devices. If we haven't * got the block, then there is no hope left. @@ -1635,7 +1635,7 @@ static int process_checks(r1bio_t *r1_bio) return 0; } -static void sync_request_write(struct mddev *mddev, r1bio_t *r1_bio) +static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio) { conf_t *conf = mddev->private; int i; @@ -1790,7 +1790,7 @@ static int submit_bio_wait(int rw, struct bio *bio) return test_bit(BIO_UPTODATE, &bio->bi_flags); } -static int narrow_write_error(r1bio_t *r1_bio, int i) +static int narrow_write_error(struct r1bio *r1_bio, int i) { struct mddev *mddev = r1_bio->mddev; conf_t *conf = mddev->private; @@ -1866,7 +1866,7 @@ static int narrow_write_error(r1bio_t *r1_bio, int i) return ok; } -static void handle_sync_write_finished(conf_t *conf, r1bio_t *r1_bio) +static void handle_sync_write_finished(conf_t *conf, struct r1bio *r1_bio) { int m; int s = r1_bio->sectors; @@ -1889,7 +1889,7 @@ static void handle_sync_write_finished(conf_t *conf, r1bio_t *r1_bio) md_done_sync(conf->mddev, s, 1); } -static void handle_write_finished(conf_t *conf, r1bio_t *r1_bio) +static void handle_write_finished(conf_t *conf, struct r1bio *r1_bio) { int m; for (m = 0; m < conf->raid_disks ; m++) @@ -1918,7 +1918,7 @@ static void handle_write_finished(conf_t *conf, r1bio_t *r1_bio) raid_end_bio_io(r1_bio); } -static void handle_read_error(conf_t *conf, r1bio_t *r1_bio) +static void handle_read_error(conf_t *conf, struct r1bio *r1_bio) { int disk; int max_sectors; @@ -2010,7 +2010,7 @@ read_more: static void raid1d(struct mddev *mddev) { - r1bio_t *r1_bio; + struct r1bio *r1_bio; unsigned long flags; conf_t *conf = mddev->private; struct list_head *head = &conf->retry_list; @@ -2029,7 +2029,7 @@ static void raid1d(struct mddev *mddev) spin_unlock_irqrestore(&conf->device_lock, flags); break; } - r1_bio = list_entry(head->prev, r1bio_t, retry_list); + r1_bio = list_entry(head->prev, struct r1bio, retry_list); list_del(head->prev); conf->nr_queued--; spin_unlock_irqrestore(&conf->device_lock, flags); @@ -2088,7 +2088,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) { conf_t *conf = mddev->private; - r1bio_t *r1_bio; + struct r1bio *r1_bio; struct bio *bio; sector_t max_sector, nr_sectors; int disk = -1; diff --git a/drivers/md/raid1.h b/drivers/md/raid1.h index 07e9cb91186b..d59e4676a1b0 100644 --- a/drivers/md/raid1.h +++ b/drivers/md/raid1.h @@ -21,9 +21,6 @@ struct pool_info { int raid_disks; }; - -typedef struct r1bio_s r1bio_t; - struct r1_private_data_s { struct mddev *mddev; mirror_info_t *mirrors; @@ -43,9 +40,9 @@ struct r1_private_data_s { spinlock_t device_lock; - /* list of 'r1bio_t' that need to be processed by raid1d, whether - * to retry a read, writeout a resync or recovery block, or - * anything else. + /* list of 'struct r1bio' that need to be processed by raid1d, + * whether to retry a read, writeout a resync or recovery + * block, or anything else. */ struct list_head retry_list; @@ -80,8 +77,8 @@ struct r1_private_data_s { * mempools - it changes when the array grows or shrinks */ struct pool_info *poolinfo; - mempool_t *r1bio_pool; - mempool_t *r1buf_pool; + mempool_t *r1bio_pool; + mempool_t *r1buf_pool; /* temporary buffer to synchronous IO when attempting to repair * a read error. @@ -104,7 +101,7 @@ typedef struct r1_private_data_s conf_t; * for this RAID1 operation, and about their status: */ -struct r1bio_s { +struct r1bio { atomic_t remaining; /* 'have we finished' count, * used from IRQ handlers */ diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 8c3bd6061f96..6927998e253a 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -64,7 +64,7 @@ static void lower_barrier(conf_t *conf); static void * r10bio_pool_alloc(gfp_t gfp_flags, void *data) { conf_t *conf = data; - int size = offsetof(struct r10bio_s, devs[conf->copies]); + int size = offsetof(struct r10bio, devs[conf->copies]); /* allocate a r10bio with room for raid_disks entries in the bios array */ return kzalloc(size, gfp_flags); @@ -94,7 +94,7 @@ static void * r10buf_pool_alloc(gfp_t gfp_flags, void *data) { conf_t *conf = data; struct page *page; - r10bio_t *r10_bio; + struct r10bio *r10_bio; struct bio *bio; int i, j; int nalloc; @@ -159,7 +159,7 @@ static void r10buf_pool_free(void *__r10_bio, void *data) { int i; conf_t *conf = data; - r10bio_t *r10bio = __r10_bio; + struct r10bio *r10bio = __r10_bio; int j; for (j=0; j < conf->copies; j++) { @@ -175,7 +175,7 @@ static void r10buf_pool_free(void *__r10_bio, void *data) r10bio_pool_free(r10bio, conf); } -static void put_all_bios(conf_t *conf, r10bio_t *r10_bio) +static void put_all_bios(conf_t *conf, struct r10bio *r10_bio) { int i; @@ -187,7 +187,7 @@ static void put_all_bios(conf_t *conf, r10bio_t *r10_bio) } } -static void free_r10bio(r10bio_t *r10_bio) +static void free_r10bio(struct r10bio *r10_bio) { conf_t *conf = r10_bio->mddev->private; @@ -195,7 +195,7 @@ static void free_r10bio(r10bio_t *r10_bio) mempool_free(r10_bio, conf->r10bio_pool); } -static void put_buf(r10bio_t *r10_bio) +static void put_buf(struct r10bio *r10_bio) { conf_t *conf = r10_bio->mddev->private; @@ -204,7 +204,7 @@ static void put_buf(r10bio_t *r10_bio) lower_barrier(conf); } -static void reschedule_retry(r10bio_t *r10_bio) +static void reschedule_retry(struct r10bio *r10_bio) { unsigned long flags; struct mddev *mddev = r10_bio->mddev; @@ -226,7 +226,7 @@ static void reschedule_retry(r10bio_t *r10_bio) * operation and are ready to return a success/failure code to the buffer * cache layer. */ -static void raid_end_bio_io(r10bio_t *r10_bio) +static void raid_end_bio_io(struct r10bio *r10_bio) { struct bio *bio = r10_bio->master_bio; int done; @@ -256,7 +256,7 @@ static void raid_end_bio_io(r10bio_t *r10_bio) /* * Update disk head position estimator based on IRQ completion info. */ -static inline void update_head_pos(int slot, r10bio_t *r10_bio) +static inline void update_head_pos(int slot, struct r10bio *r10_bio) { conf_t *conf = r10_bio->mddev->private; @@ -267,7 +267,7 @@ static inline void update_head_pos(int slot, r10bio_t *r10_bio) /* * Find the disk number which triggered given bio */ -static int find_bio_disk(conf_t *conf, r10bio_t *r10_bio, +static int find_bio_disk(conf_t *conf, struct r10bio *r10_bio, struct bio *bio, int *slotp) { int slot; @@ -287,7 +287,7 @@ static int find_bio_disk(conf_t *conf, r10bio_t *r10_bio, static void raid10_end_read_request(struct bio *bio, int error) { int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); - r10bio_t *r10_bio = bio->bi_private; + struct r10bio *r10_bio = bio->bi_private; int slot, dev; conf_t *conf = r10_bio->mddev->private; @@ -327,7 +327,7 @@ static void raid10_end_read_request(struct bio *bio, int error) } } -static void close_write(r10bio_t *r10_bio) +static void close_write(struct r10bio *r10_bio) { /* clear the bitmap if all writes complete successfully */ bitmap_endwrite(r10_bio->mddev->bitmap, r10_bio->sector, @@ -337,7 +337,7 @@ static void close_write(r10bio_t *r10_bio) md_write_end(r10_bio->mddev); } -static void one_write_done(r10bio_t *r10_bio) +static void one_write_done(struct r10bio *r10_bio) { if (atomic_dec_and_test(&r10_bio->remaining)) { if (test_bit(R10BIO_WriteError, &r10_bio->state)) @@ -355,7 +355,7 @@ static void one_write_done(r10bio_t *r10_bio) static void raid10_end_write_request(struct bio *bio, int error) { int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); - r10bio_t *r10_bio = bio->bi_private; + struct r10bio *r10_bio = bio->bi_private; int dev; int dec_rdev = 1; conf_t *conf = r10_bio->mddev->private; @@ -433,7 +433,7 @@ static void raid10_end_write_request(struct bio *bio, int error) * sector offset to a virtual address */ -static void raid10_find_phys(conf_t *conf, r10bio_t *r10bio) +static void raid10_find_phys(conf_t *conf, struct r10bio *r10bio) { int n,f; sector_t sector; @@ -555,7 +555,7 @@ static int raid10_mergeable_bvec(struct request_queue *q, * FIXME: possibly should rethink readbalancing and do it differently * depending on near_copies / far_copies geometry. */ -static int read_balance(conf_t *conf, r10bio_t *r10_bio, int *max_sectors) +static int read_balance(conf_t *conf, struct r10bio *r10_bio, int *max_sectors) { const sector_t this_sector = r10_bio->sector; int disk, slot; @@ -834,7 +834,7 @@ static int make_request(struct mddev *mddev, struct bio * bio) { conf_t *conf = mddev->private; mirror_info_t *mirror; - r10bio_t *r10_bio; + struct r10bio *r10_bio; struct bio *read_bio; int i; int chunk_sects = conf->chunk_mask + 1; @@ -1411,7 +1411,7 @@ abort: static void end_sync_read(struct bio *bio, int error) { - r10bio_t *r10_bio = bio->bi_private; + struct r10bio *r10_bio = bio->bi_private; conf_t *conf = r10_bio->mddev->private; int d; @@ -1439,7 +1439,7 @@ static void end_sync_read(struct bio *bio, int error) } } -static void end_sync_request(r10bio_t *r10_bio) +static void end_sync_request(struct r10bio *r10_bio) { struct mddev *mddev = r10_bio->mddev; @@ -1455,7 +1455,7 @@ static void end_sync_request(r10bio_t *r10_bio) md_done_sync(mddev, s, 1); break; } else { - r10bio_t *r10_bio2 = (r10bio_t *)r10_bio->master_bio; + struct r10bio *r10_bio2 = (struct r10bio *)r10_bio->master_bio; if (test_bit(R10BIO_MadeGood, &r10_bio->state) || test_bit(R10BIO_WriteError, &r10_bio->state)) reschedule_retry(r10_bio); @@ -1469,7 +1469,7 @@ static void end_sync_request(r10bio_t *r10_bio) static void end_sync_write(struct bio *bio, int error) { int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); - r10bio_t *r10_bio = bio->bi_private; + struct r10bio *r10_bio = bio->bi_private; struct mddev *mddev = r10_bio->mddev; conf_t *conf = mddev->private; int d; @@ -1509,7 +1509,7 @@ static void end_sync_write(struct bio *bio, int error) * We check if all blocks are in-sync and only write to blocks that * aren't in sync */ -static void sync_request_write(struct mddev *mddev, r10bio_t *r10_bio) +static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) { conf_t *conf = mddev->private; int i, first; @@ -1609,7 +1609,7 @@ done: * The second for writing. * */ -static void fix_recovery_read_error(r10bio_t *r10_bio) +static void fix_recovery_read_error(struct r10bio *r10_bio) { /* We got a read error during recovery. * We repeat the read in smaller page-sized sections. @@ -1688,7 +1688,7 @@ static void fix_recovery_read_error(r10bio_t *r10_bio) } } -static void recovery_request_write(struct mddev *mddev, r10bio_t *r10_bio) +static void recovery_request_write(struct mddev *mddev, struct r10bio *r10_bio) { conf_t *conf = mddev->private; int d; @@ -1778,7 +1778,7 @@ static int r10_sync_page_io(struct md_rdev *rdev, sector_t sector, * 3. Performs writes following reads for array synchronising. */ -static void fix_read_error(conf_t *conf, struct mddev *mddev, r10bio_t *r10_bio) +static void fix_read_error(conf_t *conf, struct mddev *mddev, struct r10bio *r10_bio) { int sect = 0; /* Offset from r10_bio->sector */ int sectors = r10_bio->sectors; @@ -1983,7 +1983,7 @@ static int submit_bio_wait(int rw, struct bio *bio) return test_bit(BIO_UPTODATE, &bio->bi_flags); } -static int narrow_write_error(r10bio_t *r10_bio, int i) +static int narrow_write_error(struct r10bio *r10_bio, int i) { struct bio *bio = r10_bio->master_bio; struct mddev *mddev = r10_bio->mddev; @@ -2040,7 +2040,7 @@ static int narrow_write_error(r10bio_t *r10_bio, int i) return ok; } -static void handle_read_error(struct mddev *mddev, r10bio_t *r10_bio) +static void handle_read_error(struct mddev *mddev, struct r10bio *r10_bio) { int slot = r10_bio->read_slot; int mirror = r10_bio->devs[slot].devnum; @@ -2139,7 +2139,7 @@ read_more: generic_make_request(bio); } -static void handle_write_completed(conf_t *conf, r10bio_t *r10_bio) +static void handle_write_completed(conf_t *conf, struct r10bio *r10_bio) { /* Some sort of write request has finished and it * succeeded in writing where we thought there was a @@ -2202,7 +2202,7 @@ static void handle_write_completed(conf_t *conf, r10bio_t *r10_bio) static void raid10d(struct mddev *mddev) { - r10bio_t *r10_bio; + struct r10bio *r10_bio; unsigned long flags; conf_t *conf = mddev->private; struct list_head *head = &conf->retry_list; @@ -2220,7 +2220,7 @@ static void raid10d(struct mddev *mddev) spin_unlock_irqrestore(&conf->device_lock, flags); break; } - r10_bio = list_entry(head->prev, r10bio_t, retry_list); + r10_bio = list_entry(head->prev, struct r10bio, retry_list); list_del(head->prev); conf->nr_queued--; spin_unlock_irqrestore(&conf->device_lock, flags); @@ -2301,7 +2301,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipped, int go_faster) { conf_t *conf = mddev->private; - r10bio_t *r10_bio; + struct r10bio *r10_bio; struct bio *biolist = NULL, *bio; sector_t max_sector, nr_sectors; int i; @@ -2393,7 +2393,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, for (i=0 ; iraid_disks; i++) { int still_degraded; - r10bio_t *rb2; + struct r10bio *rb2; sector_t sect; int must_sync; int any_working; @@ -2547,8 +2547,8 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, } if (biolist == NULL) { while (r10_bio) { - r10bio_t *rb2 = r10_bio; - r10_bio = (r10bio_t*) rb2->master_bio; + struct r10bio *rb2 = r10_bio; + r10_bio = (struct r10bio*) rb2->master_bio; rb2->master_bio = NULL; put_buf(rb2); } diff --git a/drivers/md/raid10.h b/drivers/md/raid10.h index c7721365f7bd..be7f8d9cfc63 100644 --- a/drivers/md/raid10.h +++ b/drivers/md/raid10.h @@ -13,8 +13,6 @@ struct mirror_info { */ }; -typedef struct r10bio_s r10bio_t; - struct r10_private_data_s { struct mddev *mddev; mirror_info_t *mirrors; @@ -80,7 +78,7 @@ typedef struct r10_private_data_s conf_t; * for this RAID10 operation, and about their status: */ -struct r10bio_s { +struct r10bio { atomic_t remaining; /* 'have we finished' count, * used from IRQ handlers */ -- cgit v1.2.2 From 0f6d02d580ca77ee4be085c29c5fe5b879df24d9 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 11 Oct 2011 16:48:46 +1100 Subject: md: remove typedefs: mirror_info_t -> struct mirror_info Signed-off-by: NeilBrown --- drivers/md/raid1.c | 10 +++++----- drivers/md/raid1.h | 4 +--- drivers/md/raid10.c | 12 ++++++------ drivers/md/raid10.h | 4 +--- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 6022111a4b28..f6eabeb21281 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -799,7 +799,7 @@ do_sync_io: static int make_request(struct mddev *mddev, struct bio * bio) { conf_t *conf = mddev->private; - mirror_info_t *mirror; + struct mirror_info *mirror; struct r1bio *r1_bio; struct bio *read_bio; int i, disks; @@ -1268,7 +1268,7 @@ static int raid1_add_disk(struct mddev *mddev, struct md_rdev *rdev) conf_t *conf = mddev->private; int err = -EEXIST; int mirror = 0; - mirror_info_t *p; + struct mirror_info *p; int first = 0; int last = mddev->raid_disks - 1; @@ -1316,7 +1316,7 @@ static int raid1_remove_disk(struct mddev *mddev, int number) conf_t *conf = mddev->private; int err = 0; struct md_rdev *rdev; - mirror_info_t *p = conf->mirrors+ number; + struct mirror_info *p = conf->mirrors+ number; print_conf(conf); rdev = p->rdev; @@ -2369,7 +2369,7 @@ static conf_t *setup_conf(struct mddev *mddev) { conf_t *conf; int i; - mirror_info_t *disk; + struct mirror_info *disk; struct md_rdev *rdev; int err = -ENOMEM; @@ -2612,7 +2612,7 @@ static int raid1_reshape(struct mddev *mddev) */ mempool_t *newpool, *oldpool; struct pool_info *newpoolinfo; - mirror_info_t *newmirrors; + struct mirror_info *newmirrors; conf_t *conf = mddev->private; int cnt, raid_disks; unsigned long flags; diff --git a/drivers/md/raid1.h b/drivers/md/raid1.h index d59e4676a1b0..dd5e66a4163f 100644 --- a/drivers/md/raid1.h +++ b/drivers/md/raid1.h @@ -1,8 +1,6 @@ #ifndef _RAID1_H #define _RAID1_H -typedef struct mirror_info mirror_info_t; - struct mirror_info { struct md_rdev *rdev; sector_t head_position; @@ -23,7 +21,7 @@ struct pool_info { struct r1_private_data_s { struct mddev *mddev; - mirror_info_t *mirrors; + struct mirror_info *mirrors; int raid_disks; /* When choose the best device for a read (read_balance()) diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 6927998e253a..d5fb4c8da772 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -833,7 +833,7 @@ static void unfreeze_array(conf_t *conf) static int make_request(struct mddev *mddev, struct bio * bio) { conf_t *conf = mddev->private; - mirror_info_t *mirror; + struct mirror_info *mirror; struct r10bio *r10_bio; struct bio *read_bio; int i; @@ -1249,7 +1249,7 @@ static void error(struct mddev *mddev, struct md_rdev *rdev) static void print_conf(conf_t *conf) { int i; - mirror_info_t *tmp; + struct mirror_info *tmp; printk(KERN_DEBUG "RAID10 conf printout:\n"); if (!conf) { @@ -1283,7 +1283,7 @@ static int raid10_spare_active(struct mddev *mddev) { int i; conf_t *conf = mddev->private; - mirror_info_t *tmp; + struct mirror_info *tmp; int count = 0; unsigned long flags; @@ -1334,7 +1334,7 @@ static int raid10_add_disk(struct mddev *mddev, struct md_rdev *rdev) else mirror = first; for ( ; mirror <= last ; mirror++) { - mirror_info_t *p = &conf->mirrors[mirror]; + struct mirror_info *p = &conf->mirrors[mirror]; if (p->recovery_disabled == mddev->recovery_disabled) continue; if (!p->rdev) @@ -1373,7 +1373,7 @@ static int raid10_remove_disk(struct mddev *mddev, int number) conf_t *conf = mddev->private; int err = 0; struct md_rdev *rdev; - mirror_info_t *p = conf->mirrors+ number; + struct mirror_info *p = conf->mirrors+ number; print_conf(conf); rdev = p->rdev; @@ -2840,7 +2840,7 @@ static int run(struct mddev *mddev) { conf_t *conf; int i, disk_idx, chunk_size; - mirror_info_t *disk; + struct mirror_info *disk; struct md_rdev *rdev; sector_t size; diff --git a/drivers/md/raid10.h b/drivers/md/raid10.h index be7f8d9cfc63..94f898a11be4 100644 --- a/drivers/md/raid10.h +++ b/drivers/md/raid10.h @@ -1,8 +1,6 @@ #ifndef _RAID10_H #define _RAID10_H -typedef struct mirror_info mirror_info_t; - struct mirror_info { struct md_rdev *rdev; sector_t head_position; @@ -15,7 +13,7 @@ struct mirror_info { struct r10_private_data_s { struct mddev *mddev; - mirror_info_t *mirrors; + struct mirror_info *mirrors; int raid_disks; spinlock_t device_lock; -- cgit v1.2.2 From a71207713a36e73fb1bc264453a9c594b95d3af1 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 11 Oct 2011 16:48:49 +1100 Subject: md/linear: remove typedefs: dev_info_t -> struct dev_info Signed-off-by: NeilBrown --- drivers/md/linear.c | 10 +++++----- drivers/md/linear.h | 4 +--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/md/linear.c b/drivers/md/linear.c index 2e176e020ab5..e9159ebcaaef 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c @@ -26,7 +26,7 @@ /* * find which device holds a particular offset */ -static inline dev_info_t *which_dev(struct mddev *mddev, sector_t sector) +static inline struct dev_info *which_dev(struct mddev *mddev, sector_t sector) { int lo, mid, hi; linear_conf_t *conf; @@ -64,7 +64,7 @@ static int linear_mergeable_bvec(struct request_queue *q, struct bio_vec *biovec) { struct mddev *mddev = q->queuedata; - dev_info_t *dev0; + struct dev_info *dev0; unsigned long maxsectors, bio_sectors = bvm->bi_size >> 9; sector_t sector = bvm->bi_sector + get_start_sect(bvm->bi_bdev); @@ -129,7 +129,7 @@ static linear_conf_t *linear_conf(struct mddev *mddev, int raid_disks) struct md_rdev *rdev; int i, cnt; - conf = kzalloc (sizeof (*conf) + raid_disks*sizeof(dev_info_t), + conf = kzalloc (sizeof (*conf) + raid_disks*sizeof(struct dev_info), GFP_KERNEL); if (!conf) return NULL; @@ -139,7 +139,7 @@ static linear_conf_t *linear_conf(struct mddev *mddev, int raid_disks) list_for_each_entry(rdev, &mddev->disks, same_set) { int j = rdev->raid_disk; - dev_info_t *disk = conf->disks + j; + struct dev_info *disk = conf->disks + j; sector_t sectors; if (j < 0 || j >= raid_disks || disk->rdev) { @@ -266,7 +266,7 @@ static int linear_stop (struct mddev *mddev) static int linear_make_request (struct mddev *mddev, struct bio *bio) { - dev_info_t *tmp_dev; + struct dev_info *tmp_dev; sector_t start_sector; if (unlikely(bio->bi_rw & REQ_FLUSH)) { diff --git a/drivers/md/linear.h b/drivers/md/linear.h index 367967a53009..4d0cf3c7cd46 100644 --- a/drivers/md/linear.h +++ b/drivers/md/linear.h @@ -6,13 +6,11 @@ struct dev_info { sector_t end_sector; }; -typedef struct dev_info dev_info_t; - struct linear_private_data { struct rcu_head rcu; sector_t array_sectors; - dev_info_t disks[0]; + struct dev_info disks[0]; }; -- cgit v1.2.2 From 8f1ae43dd27eff2d71708be46fad339dbdd70bd1 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 11 Oct 2011 16:48:52 +1100 Subject: md/faulty: remove typedef: conf_t -> struct faulty_conf Signed-off-by: NeilBrown --- drivers/md/faulty.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/md/faulty.c b/drivers/md/faulty.c index a2d4c46ff2a1..571445e52541 100644 --- a/drivers/md/faulty.c +++ b/drivers/md/faulty.c @@ -81,16 +81,16 @@ static void faulty_fail(struct bio *bio, int error) bio_io_error(b); } -typedef struct faulty_conf { +struct faulty_conf { int period[Modes]; atomic_t counters[Modes]; sector_t faults[MaxFault]; int modes[MaxFault]; int nfaults; struct md_rdev *rdev; -} conf_t; +}; -static int check_mode(conf_t *conf, int mode) +static int check_mode(struct faulty_conf *conf, int mode) { if (conf->period[mode] == 0 && atomic_read(&conf->counters[mode]) <= 0) @@ -105,7 +105,7 @@ static int check_mode(conf_t *conf, int mode) return 0; } -static int check_sector(conf_t *conf, sector_t start, sector_t end, int dir) +static int check_sector(struct faulty_conf *conf, sector_t start, sector_t end, int dir) { /* If we find a ReadFixable sector, we fix it ... */ int i; @@ -129,7 +129,7 @@ static int check_sector(conf_t *conf, sector_t start, sector_t end, int dir) return 0; } -static void add_sector(conf_t *conf, sector_t start, int mode) +static void add_sector(struct faulty_conf *conf, sector_t start, int mode) { int i; int n = conf->nfaults; @@ -171,7 +171,7 @@ static void add_sector(conf_t *conf, sector_t start, int mode) static int make_request(struct mddev *mddev, struct bio *bio) { - conf_t *conf = mddev->private; + struct faulty_conf *conf = mddev->private; int failit = 0; if (bio_data_dir(bio) == WRITE) { @@ -224,7 +224,7 @@ static int make_request(struct mddev *mddev, struct bio *bio) static void status(struct seq_file *seq, struct mddev *mddev) { - conf_t *conf = mddev->private; + struct faulty_conf *conf = mddev->private; int n; if ((n=atomic_read(&conf->counters[WriteTransient])) != 0) @@ -259,7 +259,7 @@ static int reshape(struct mddev *mddev) { int mode = mddev->new_layout & ModeMask; int count = mddev->new_layout >> ModeShift; - conf_t *conf = mddev->private; + struct faulty_conf *conf = mddev->private; if (mddev->new_layout < 0) return 0; @@ -299,7 +299,7 @@ static int run(struct mddev *mddev) { struct md_rdev *rdev; int i; - conf_t *conf; + struct faulty_conf *conf; if (md_check_no_bitmap(mddev)) return -EINVAL; @@ -327,7 +327,7 @@ static int run(struct mddev *mddev) static int stop(struct mddev *mddev) { - conf_t *conf = mddev->private; + struct faulty_conf *conf = mddev->private; kfree(conf); mddev->private = NULL; -- cgit v1.2.2 From e849b9381f726c0fa20c4e7b7139b936df777084 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 11 Oct 2011 16:48:54 +1100 Subject: md/linear: typedef removal: linear_conf_t -> struct linear_conf Signed-off-by: NeilBrown --- drivers/md/linear.c | 16 ++++++++-------- drivers/md/linear.h | 6 +----- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/md/linear.c b/drivers/md/linear.c index e9159ebcaaef..cbac48cfe72b 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c @@ -29,7 +29,7 @@ static inline struct dev_info *which_dev(struct mddev *mddev, sector_t sector) { int lo, mid, hi; - linear_conf_t *conf; + struct linear_conf *conf; lo = 0; hi = mddev->raid_disks - 1; @@ -90,7 +90,7 @@ static int linear_mergeable_bvec(struct request_queue *q, static int linear_congested(void *data, int bits) { struct mddev *mddev = data; - linear_conf_t *conf; + struct linear_conf *conf; int i, ret = 0; if (mddev_congested(mddev, bits)) @@ -110,7 +110,7 @@ static int linear_congested(void *data, int bits) static sector_t linear_size(struct mddev *mddev, sector_t sectors, int raid_disks) { - linear_conf_t *conf; + struct linear_conf *conf; sector_t array_sectors; rcu_read_lock(); @@ -123,9 +123,9 @@ static sector_t linear_size(struct mddev *mddev, sector_t sectors, int raid_disk return array_sectors; } -static linear_conf_t *linear_conf(struct mddev *mddev, int raid_disks) +static struct linear_conf *linear_conf(struct mddev *mddev, int raid_disks) { - linear_conf_t *conf; + struct linear_conf *conf; struct md_rdev *rdev; int i, cnt; @@ -196,7 +196,7 @@ out: static int linear_run (struct mddev *mddev) { - linear_conf_t *conf; + struct linear_conf *conf; if (md_check_no_bitmap(mddev)) return -EINVAL; @@ -223,7 +223,7 @@ static int linear_add(struct mddev *mddev, struct md_rdev *rdev) * The current one is never freed until the array is stopped. * This avoids races. */ - linear_conf_t *newconf, *oldconf; + struct linear_conf *newconf, *oldconf; if (rdev->saved_raid_disk != mddev->raid_disks) return -EINVAL; @@ -247,7 +247,7 @@ static int linear_add(struct mddev *mddev, struct md_rdev *rdev) static int linear_stop (struct mddev *mddev) { - linear_conf_t *conf = mddev->private; + struct linear_conf *conf = mddev->private; /* * We do not require rcu protection here since diff --git a/drivers/md/linear.h b/drivers/md/linear.h index 4d0cf3c7cd46..b685ddd7d7f7 100644 --- a/drivers/md/linear.h +++ b/drivers/md/linear.h @@ -6,14 +6,10 @@ struct dev_info { sector_t end_sector; }; -struct linear_private_data +struct linear_conf { struct rcu_head rcu; sector_t array_sectors; struct dev_info disks[0]; }; - - -typedef struct linear_private_data linear_conf_t; - #endif -- cgit v1.2.2 From 69724e28ca99990a8f0b5370bb946d7704936d67 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 11 Oct 2011 16:48:57 +1100 Subject: md/multipath: typedef removal: multipath_conf_t -> struct mpconf Signed-off-by: NeilBrown --- drivers/md/multipath.c | 30 +++++++++++++++--------------- drivers/md/multipath.h | 4 +--- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 9c8d4b664312..96505930afcb 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c @@ -31,7 +31,7 @@ #define NR_RESERVED_BUFS 32 -static int multipath_map (multipath_conf_t *conf) +static int multipath_map (struct mpconf *conf) { int i, disks = conf->raid_disks; @@ -59,7 +59,7 @@ static void multipath_reschedule_retry (struct multipath_bh *mp_bh) { unsigned long flags; struct mddev *mddev = mp_bh->mddev; - multipath_conf_t *conf = mddev->private; + struct mpconf *conf = mddev->private; spin_lock_irqsave(&conf->device_lock, flags); list_add(&mp_bh->retry_list, &conf->retry_list); @@ -76,7 +76,7 @@ static void multipath_reschedule_retry (struct multipath_bh *mp_bh) static void multipath_end_bh_io (struct multipath_bh *mp_bh, int err) { struct bio *bio = mp_bh->master_bio; - multipath_conf_t *conf = mp_bh->mddev->private; + struct mpconf *conf = mp_bh->mddev->private; bio_endio(bio, err); mempool_free(mp_bh, conf->pool); @@ -86,7 +86,7 @@ static void multipath_end_request(struct bio *bio, int error) { int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); struct multipath_bh *mp_bh = bio->bi_private; - multipath_conf_t *conf = mp_bh->mddev->private; + struct mpconf *conf = mp_bh->mddev->private; struct md_rdev *rdev = conf->multipaths[mp_bh->path].rdev; if (uptodate) @@ -108,7 +108,7 @@ static void multipath_end_request(struct bio *bio, int error) static int multipath_make_request(struct mddev *mddev, struct bio * bio) { - multipath_conf_t *conf = mddev->private; + struct mpconf *conf = mddev->private; struct multipath_bh * mp_bh; struct multipath_info *multipath; @@ -142,7 +142,7 @@ static int multipath_make_request(struct mddev *mddev, struct bio * bio) static void multipath_status (struct seq_file *seq, struct mddev *mddev) { - multipath_conf_t *conf = mddev->private; + struct mpconf *conf = mddev->private; int i; seq_printf (seq, " [%d/%d] [", conf->raid_disks, @@ -157,7 +157,7 @@ static void multipath_status (struct seq_file *seq, struct mddev *mddev) static int multipath_congested(void *data, int bits) { struct mddev *mddev = data; - multipath_conf_t *conf = mddev->private; + struct mpconf *conf = mddev->private; int i, ret = 0; if (mddev_congested(mddev, bits)) @@ -185,7 +185,7 @@ static int multipath_congested(void *data, int bits) */ static void multipath_error (struct mddev *mddev, struct md_rdev *rdev) { - multipath_conf_t *conf = mddev->private; + struct mpconf *conf = mddev->private; char b[BDEVNAME_SIZE]; if (conf->raid_disks - mddev->degraded <= 1) { @@ -218,7 +218,7 @@ static void multipath_error (struct mddev *mddev, struct md_rdev *rdev) conf->raid_disks - mddev->degraded); } -static void print_multipath_conf (multipath_conf_t *conf) +static void print_multipath_conf (struct mpconf *conf) { int i; struct multipath_info *tmp; @@ -244,7 +244,7 @@ static void print_multipath_conf (multipath_conf_t *conf) static int multipath_add_disk(struct mddev *mddev, struct md_rdev *rdev) { - multipath_conf_t *conf = mddev->private; + struct mpconf *conf = mddev->private; struct request_queue *q; int err = -EEXIST; int path; @@ -293,7 +293,7 @@ static int multipath_add_disk(struct mddev *mddev, struct md_rdev *rdev) static int multipath_remove_disk(struct mddev *mddev, int number) { - multipath_conf_t *conf = mddev->private; + struct mpconf *conf = mddev->private; int err = 0; struct md_rdev *rdev; struct multipath_info *p = conf->multipaths + number; @@ -340,7 +340,7 @@ static void multipathd (struct mddev *mddev) struct multipath_bh *mp_bh; struct bio *bio; unsigned long flags; - multipath_conf_t *conf = mddev->private; + struct mpconf *conf = mddev->private; struct list_head *head = &conf->retry_list; md_check_recovery(mddev); @@ -389,7 +389,7 @@ static sector_t multipath_size(struct mddev *mddev, sector_t sectors, int raid_d static int multipath_run (struct mddev *mddev) { - multipath_conf_t *conf; + struct mpconf *conf; int disk_idx; struct multipath_info *disk; struct md_rdev *rdev; @@ -409,7 +409,7 @@ static int multipath_run (struct mddev *mddev) * should be freed in multipath_stop()] */ - conf = kzalloc(sizeof(multipath_conf_t), GFP_KERNEL); + conf = kzalloc(sizeof(struct mpconf), GFP_KERNEL); mddev->private = conf; if (!conf) { printk(KERN_ERR @@ -512,7 +512,7 @@ out: static int multipath_stop (struct mddev *mddev) { - multipath_conf_t *conf = mddev->private; + struct mpconf *conf = mddev->private; md_unregister_thread(&mddev->thread); blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/ diff --git a/drivers/md/multipath.h b/drivers/md/multipath.h index 350a631b6c93..717c60f62898 100644 --- a/drivers/md/multipath.h +++ b/drivers/md/multipath.h @@ -5,7 +5,7 @@ struct multipath_info { struct md_rdev *rdev; }; -struct multipath_private_data { +struct mpconf { struct mddev *mddev; struct multipath_info *multipaths; int raid_disks; @@ -15,8 +15,6 @@ struct multipath_private_data { mempool_t *pool; }; -typedef struct multipath_private_data multipath_conf_t; - /* * this is our 'private' 'collective' MULTIPATH buffer head. * it contains information about what kind of IO operations were started -- cgit v1.2.2 From e373ab109172abc2d821bd3b5c1b400acddef5a5 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 11 Oct 2011 16:48:59 +1100 Subject: md/raid0: typedef removal: raid0_conf_t -> struct r0conf Signed-off-by: NeilBrown --- drivers/md/raid0.c | 22 +++++++++++----------- drivers/md/raid0.h | 8 ++------ drivers/md/raid10.c | 6 +++--- drivers/md/raid5.c | 8 ++++---- 4 files changed, 20 insertions(+), 24 deletions(-) diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index db51e6f68191..38a9012ff4fe 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -28,7 +28,7 @@ static int raid0_congested(void *data, int bits) { struct mddev *mddev = data; - raid0_conf_t *conf = mddev->private; + struct r0conf *conf = mddev->private; struct md_rdev **devlist = conf->devlist; int raid_disks = conf->strip_zone[0].nb_dev; int i, ret = 0; @@ -53,7 +53,7 @@ static void dump_zones(struct mddev *mddev) sector_t zone_size = 0; sector_t zone_start = 0; char b[BDEVNAME_SIZE]; - raid0_conf_t *conf = mddev->private; + struct r0conf *conf = mddev->private; int raid_disks = conf->strip_zone[0].nb_dev; printk(KERN_INFO "md: RAID0 configuration for %s - %d zone%s\n", mdname(mddev), @@ -77,7 +77,7 @@ static void dump_zones(struct mddev *mddev) printk(KERN_INFO "\n"); } -static int create_strip_zones(struct mddev *mddev, raid0_conf_t **private_conf) +static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) { int i, c, err; sector_t curr_zone_end, sectors; @@ -86,7 +86,7 @@ static int create_strip_zones(struct mddev *mddev, raid0_conf_t **private_conf) int cnt; char b[BDEVNAME_SIZE]; char b2[BDEVNAME_SIZE]; - raid0_conf_t *conf = kzalloc(sizeof(*conf), GFP_KERNEL); + struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL); if (!conf) return -ENOMEM; @@ -336,7 +336,7 @@ static sector_t raid0_size(struct mddev *mddev, sector_t sectors, int raid_disks static int raid0_run(struct mddev *mddev) { - raid0_conf_t *conf; + struct r0conf *conf; int ret; if (mddev->chunk_sectors == 0) { @@ -386,7 +386,7 @@ static int raid0_run(struct mddev *mddev) static int raid0_stop(struct mddev *mddev) { - raid0_conf_t *conf = mddev->private; + struct r0conf *conf = mddev->private; blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/ kfree(conf->strip_zone); @@ -399,7 +399,7 @@ static int raid0_stop(struct mddev *mddev) /* Find the zone which holds a particular offset * Update *sectorp to be an offset in that zone */ -static struct strip_zone *find_zone(struct raid0_private_data *conf, +static struct strip_zone *find_zone(struct r0conf *conf, sector_t *sectorp) { int i; @@ -424,7 +424,7 @@ static struct md_rdev *map_sector(struct mddev *mddev, struct strip_zone *zone, { unsigned int sect_in_chunk; sector_t chunk; - raid0_conf_t *conf = mddev->private; + struct r0conf *conf = mddev->private; int raid_disks = conf->strip_zone[0].nb_dev; unsigned int chunk_sects = mddev->chunk_sectors; @@ -537,7 +537,7 @@ static void raid0_status(struct seq_file *seq, struct mddev *mddev) static void *raid0_takeover_raid45(struct mddev *mddev) { struct md_rdev *rdev; - raid0_conf_t *priv_conf; + struct r0conf *priv_conf; if (mddev->degraded != 1) { printk(KERN_ERR "md/raid0:%s: raid5 must be degraded! Degraded disks: %d\n", @@ -570,7 +570,7 @@ static void *raid0_takeover_raid45(struct mddev *mddev) static void *raid0_takeover_raid10(struct mddev *mddev) { - raid0_conf_t *priv_conf; + struct r0conf *priv_conf; /* Check layout: * - far_copies must be 1 @@ -611,7 +611,7 @@ static void *raid0_takeover_raid10(struct mddev *mddev) static void *raid0_takeover_raid1(struct mddev *mddev) { - raid0_conf_t *priv_conf; + struct r0conf *priv_conf; /* Check layout: * - (N - 1) mirror drives must be already faulty diff --git a/drivers/md/raid0.h b/drivers/md/raid0.h index 9d877b8d382c..0884bba8df4c 100644 --- a/drivers/md/raid0.h +++ b/drivers/md/raid0.h @@ -1,20 +1,16 @@ #ifndef _RAID0_H #define _RAID0_H -struct strip_zone -{ +struct strip_zone { sector_t zone_end; /* Start of the next zone (in sectors) */ sector_t dev_start; /* Zone offset in real dev (in sectors) */ int nb_dev; /* # of devices attached to the zone */ }; -struct raid0_private_data -{ +struct r0conf { struct strip_zone *strip_zone; struct md_rdev **devlist; /* lists of rdevs, pointed to by strip_zone->dev */ int nr_strip_zones; }; -typedef struct raid0_private_data raid0_conf_t; - #endif diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index d5fb4c8da772..39661b19f409 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -3031,15 +3031,15 @@ static void *raid10_takeover_raid0(struct mddev *mddev) static void *raid10_takeover(struct mddev *mddev) { - struct raid0_private_data *raid0_priv; + struct r0conf *raid0_conf; /* raid10 can take over: * raid0 - providing it has only two drives */ if (mddev->level == 0) { /* for raid0 takeover only one zone is supported */ - raid0_priv = mddev->private; - if (raid0_priv->nr_strip_zones > 1) { + raid0_conf = mddev->private; + if (raid0_conf->nr_strip_zones > 1) { printk(KERN_ERR "md/raid10:%s: cannot takeover raid 0" " with more than one zone.\n", mdname(mddev)); diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 17725c59eb0b..8514e9aeb369 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -5405,18 +5405,18 @@ static void raid5_quiesce(struct mddev *mddev, int state) static void *raid45_takeover_raid0(struct mddev *mddev, int level) { - struct raid0_private_data *raid0_priv = mddev->private; + struct r0conf *raid0_conf = mddev->private; sector_t sectors; /* for raid0 takeover only one zone is supported */ - if (raid0_priv->nr_strip_zones > 1) { + if (raid0_conf->nr_strip_zones > 1) { printk(KERN_ERR "md/raid:%s: cannot takeover raid0 with more than one zone.\n", mdname(mddev)); return ERR_PTR(-EINVAL); } - sectors = raid0_priv->strip_zone[0].zone_end; - sector_div(sectors, raid0_priv->strip_zone[0].nb_dev); + sectors = raid0_conf->strip_zone[0].zone_end; + sector_div(sectors, raid0_conf->strip_zone[0].nb_dev); mddev->dev_sectors = sectors; mddev->new_level = level; mddev->new_layout = ALGORITHM_PARITY_N; -- cgit v1.2.2 From e879a8793f915aa7933364d962d2435bd71de462 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 11 Oct 2011 16:49:02 +1100 Subject: md/raid10: typedef removal: conf_t -> struct r10conf Signed-off-by: NeilBrown --- drivers/md/raid10.c | 108 ++++++++++++++++++++++++++-------------------------- drivers/md/raid10.h | 4 +- 2 files changed, 55 insertions(+), 57 deletions(-) diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 39661b19f409..f6a9b0c8f5fa 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -58,12 +58,12 @@ */ #define NR_RAID10_BIOS 256 -static void allow_barrier(conf_t *conf); -static void lower_barrier(conf_t *conf); +static void allow_barrier(struct r10conf *conf); +static void lower_barrier(struct r10conf *conf); static void * r10bio_pool_alloc(gfp_t gfp_flags, void *data) { - conf_t *conf = data; + struct r10conf *conf = data; int size = offsetof(struct r10bio, devs[conf->copies]); /* allocate a r10bio with room for raid_disks entries in the bios array */ @@ -92,7 +92,7 @@ static void r10bio_pool_free(void *r10_bio, void *data) */ static void * r10buf_pool_alloc(gfp_t gfp_flags, void *data) { - conf_t *conf = data; + struct r10conf *conf = data; struct page *page; struct r10bio *r10_bio; struct bio *bio; @@ -158,7 +158,7 @@ out_free_bio: static void r10buf_pool_free(void *__r10_bio, void *data) { int i; - conf_t *conf = data; + struct r10conf *conf = data; struct r10bio *r10bio = __r10_bio; int j; @@ -175,7 +175,7 @@ static void r10buf_pool_free(void *__r10_bio, void *data) r10bio_pool_free(r10bio, conf); } -static void put_all_bios(conf_t *conf, struct r10bio *r10_bio) +static void put_all_bios(struct r10conf *conf, struct r10bio *r10_bio) { int i; @@ -189,7 +189,7 @@ static void put_all_bios(conf_t *conf, struct r10bio *r10_bio) static void free_r10bio(struct r10bio *r10_bio) { - conf_t *conf = r10_bio->mddev->private; + struct r10conf *conf = r10_bio->mddev->private; put_all_bios(conf, r10_bio); mempool_free(r10_bio, conf->r10bio_pool); @@ -197,7 +197,7 @@ static void free_r10bio(struct r10bio *r10_bio) static void put_buf(struct r10bio *r10_bio) { - conf_t *conf = r10_bio->mddev->private; + struct r10conf *conf = r10_bio->mddev->private; mempool_free(r10_bio, conf->r10buf_pool); @@ -208,7 +208,7 @@ static void reschedule_retry(struct r10bio *r10_bio) { unsigned long flags; struct mddev *mddev = r10_bio->mddev; - conf_t *conf = mddev->private; + struct r10conf *conf = mddev->private; spin_lock_irqsave(&conf->device_lock, flags); list_add(&r10_bio->retry_list, &conf->retry_list); @@ -230,7 +230,7 @@ static void raid_end_bio_io(struct r10bio *r10_bio) { struct bio *bio = r10_bio->master_bio; int done; - conf_t *conf = r10_bio->mddev->private; + struct r10conf *conf = r10_bio->mddev->private; if (bio->bi_phys_segments) { unsigned long flags; @@ -258,7 +258,7 @@ static void raid_end_bio_io(struct r10bio *r10_bio) */ static inline void update_head_pos(int slot, struct r10bio *r10_bio) { - conf_t *conf = r10_bio->mddev->private; + struct r10conf *conf = r10_bio->mddev->private; conf->mirrors[r10_bio->devs[slot].devnum].head_position = r10_bio->devs[slot].addr + (r10_bio->sectors); @@ -267,7 +267,7 @@ static inline void update_head_pos(int slot, struct r10bio *r10_bio) /* * Find the disk number which triggered given bio */ -static int find_bio_disk(conf_t *conf, struct r10bio *r10_bio, +static int find_bio_disk(struct r10conf *conf, struct r10bio *r10_bio, struct bio *bio, int *slotp) { int slot; @@ -289,7 +289,7 @@ static void raid10_end_read_request(struct bio *bio, int error) int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); struct r10bio *r10_bio = bio->bi_private; int slot, dev; - conf_t *conf = r10_bio->mddev->private; + struct r10conf *conf = r10_bio->mddev->private; slot = r10_bio->read_slot; @@ -358,7 +358,7 @@ static void raid10_end_write_request(struct bio *bio, int error) struct r10bio *r10_bio = bio->bi_private; int dev; int dec_rdev = 1; - conf_t *conf = r10_bio->mddev->private; + struct r10conf *conf = r10_bio->mddev->private; int slot; dev = find_bio_disk(conf, r10_bio, bio, &slot); @@ -433,7 +433,7 @@ static void raid10_end_write_request(struct bio *bio, int error) * sector offset to a virtual address */ -static void raid10_find_phys(conf_t *conf, struct r10bio *r10bio) +static void raid10_find_phys(struct r10conf *conf, struct r10bio *r10bio) { int n,f; sector_t sector; @@ -481,7 +481,7 @@ static void raid10_find_phys(conf_t *conf, struct r10bio *r10bio) BUG_ON(slot != conf->copies); } -static sector_t raid10_find_virt(conf_t *conf, sector_t sector, int dev) +static sector_t raid10_find_virt(struct r10conf *conf, sector_t sector, int dev) { sector_t offset, chunk, vchunk; @@ -555,7 +555,7 @@ static int raid10_mergeable_bvec(struct request_queue *q, * FIXME: possibly should rethink readbalancing and do it differently * depending on near_copies / far_copies geometry. */ -static int read_balance(conf_t *conf, struct r10bio *r10_bio, int *max_sectors) +static int read_balance(struct r10conf *conf, struct r10bio *r10_bio, int *max_sectors) { const sector_t this_sector = r10_bio->sector; int disk, slot; @@ -678,7 +678,7 @@ retry: static int raid10_congested(void *data, int bits) { struct mddev *mddev = data; - conf_t *conf = mddev->private; + struct r10conf *conf = mddev->private; int i, ret = 0; if (mddev_congested(mddev, bits)) @@ -696,7 +696,7 @@ static int raid10_congested(void *data, int bits) return ret; } -static void flush_pending_writes(conf_t *conf) +static void flush_pending_writes(struct r10conf *conf) { /* Any writes that have been queued but are awaiting * bitmap updates get flushed here. @@ -743,7 +743,7 @@ static void flush_pending_writes(conf_t *conf) * lower_barrier when the particular background IO completes. */ -static void raise_barrier(conf_t *conf, int force) +static void raise_barrier(struct r10conf *conf, int force) { BUG_ON(force && !conf->barrier); spin_lock_irq(&conf->resync_lock); @@ -763,7 +763,7 @@ static void raise_barrier(conf_t *conf, int force) spin_unlock_irq(&conf->resync_lock); } -static void lower_barrier(conf_t *conf) +static void lower_barrier(struct r10conf *conf) { unsigned long flags; spin_lock_irqsave(&conf->resync_lock, flags); @@ -772,7 +772,7 @@ static void lower_barrier(conf_t *conf) wake_up(&conf->wait_barrier); } -static void wait_barrier(conf_t *conf) +static void wait_barrier(struct r10conf *conf) { spin_lock_irq(&conf->resync_lock); if (conf->barrier) { @@ -786,7 +786,7 @@ static void wait_barrier(conf_t *conf) spin_unlock_irq(&conf->resync_lock); } -static void allow_barrier(conf_t *conf) +static void allow_barrier(struct r10conf *conf) { unsigned long flags; spin_lock_irqsave(&conf->resync_lock, flags); @@ -795,7 +795,7 @@ static void allow_barrier(conf_t *conf) wake_up(&conf->wait_barrier); } -static void freeze_array(conf_t *conf) +static void freeze_array(struct r10conf *conf) { /* stop syncio and normal IO and wait for everything to * go quiet. @@ -820,7 +820,7 @@ static void freeze_array(conf_t *conf) spin_unlock_irq(&conf->resync_lock); } -static void unfreeze_array(conf_t *conf) +static void unfreeze_array(struct r10conf *conf) { /* reverse the effect of the freeze */ spin_lock_irq(&conf->resync_lock); @@ -832,7 +832,7 @@ static void unfreeze_array(conf_t *conf) static int make_request(struct mddev *mddev, struct bio * bio) { - conf_t *conf = mddev->private; + struct r10conf *conf = mddev->private; struct mirror_info *mirror; struct r10bio *r10_bio; struct bio *read_bio; @@ -1163,7 +1163,7 @@ retry_write: static void status(struct seq_file *seq, struct mddev *mddev) { - conf_t *conf = mddev->private; + struct r10conf *conf = mddev->private; int i; if (conf->near_copies < conf->raid_disks) @@ -1190,7 +1190,7 @@ static void status(struct seq_file *seq, struct mddev *mddev) * Don't consider the device numbered 'ignore' * as we might be about to remove it. */ -static int enough(conf_t *conf, int ignore) +static int enough(struct r10conf *conf, int ignore) { int first = 0; @@ -1212,7 +1212,7 @@ static int enough(conf_t *conf, int ignore) static void error(struct mddev *mddev, struct md_rdev *rdev) { char b[BDEVNAME_SIZE]; - conf_t *conf = mddev->private; + struct r10conf *conf = mddev->private; /* * If it is not operational, then we have already marked it as dead @@ -1246,7 +1246,7 @@ static void error(struct mddev *mddev, struct md_rdev *rdev) mdname(mddev), conf->raid_disks - mddev->degraded); } -static void print_conf(conf_t *conf) +static void print_conf(struct r10conf *conf) { int i; struct mirror_info *tmp; @@ -1270,7 +1270,7 @@ static void print_conf(conf_t *conf) } } -static void close_sync(conf_t *conf) +static void close_sync(struct r10conf *conf) { wait_barrier(conf); allow_barrier(conf); @@ -1282,7 +1282,7 @@ static void close_sync(conf_t *conf) static int raid10_spare_active(struct mddev *mddev) { int i; - conf_t *conf = mddev->private; + struct r10conf *conf = mddev->private; struct mirror_info *tmp; int count = 0; unsigned long flags; @@ -1311,7 +1311,7 @@ static int raid10_spare_active(struct mddev *mddev) static int raid10_add_disk(struct mddev *mddev, struct md_rdev *rdev) { - conf_t *conf = mddev->private; + struct r10conf *conf = mddev->private; int err = -EEXIST; int mirror; int first = 0; @@ -1370,7 +1370,7 @@ static int raid10_add_disk(struct mddev *mddev, struct md_rdev *rdev) static int raid10_remove_disk(struct mddev *mddev, int number) { - conf_t *conf = mddev->private; + struct r10conf *conf = mddev->private; int err = 0; struct md_rdev *rdev; struct mirror_info *p = conf->mirrors+ number; @@ -1412,7 +1412,7 @@ abort: static void end_sync_read(struct bio *bio, int error) { struct r10bio *r10_bio = bio->bi_private; - conf_t *conf = r10_bio->mddev->private; + struct r10conf *conf = r10_bio->mddev->private; int d; d = find_bio_disk(conf, r10_bio, bio, NULL); @@ -1471,7 +1471,7 @@ static void end_sync_write(struct bio *bio, int error) int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); struct r10bio *r10_bio = bio->bi_private; struct mddev *mddev = r10_bio->mddev; - conf_t *conf = mddev->private; + struct r10conf *conf = mddev->private; int d; sector_t first_bad; int bad_sectors; @@ -1511,7 +1511,7 @@ static void end_sync_write(struct bio *bio, int error) */ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) { - conf_t *conf = mddev->private; + struct r10conf *conf = mddev->private; int i, first; struct bio *tbio, *fbio; @@ -1619,7 +1619,7 @@ static void fix_recovery_read_error(struct r10bio *r10_bio) * new devices. */ struct mddev *mddev = r10_bio->mddev; - conf_t *conf = mddev->private; + struct r10conf *conf = mddev->private; struct bio *bio = r10_bio->devs[0].bio; sector_t sect = 0; int sectors = r10_bio->sectors; @@ -1690,7 +1690,7 @@ static void fix_recovery_read_error(struct r10bio *r10_bio) static void recovery_request_write(struct mddev *mddev, struct r10bio *r10_bio) { - conf_t *conf = mddev->private; + struct r10conf *conf = mddev->private; int d; struct bio *wbio; @@ -1778,7 +1778,7 @@ static int r10_sync_page_io(struct md_rdev *rdev, sector_t sector, * 3. Performs writes following reads for array synchronising. */ -static void fix_read_error(conf_t *conf, struct mddev *mddev, struct r10bio *r10_bio) +static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10bio *r10_bio) { int sect = 0; /* Offset from r10_bio->sector */ int sectors = r10_bio->sectors; @@ -1987,7 +1987,7 @@ static int narrow_write_error(struct r10bio *r10_bio, int i) { struct bio *bio = r10_bio->master_bio; struct mddev *mddev = r10_bio->mddev; - conf_t *conf = mddev->private; + struct r10conf *conf = mddev->private; struct md_rdev *rdev = conf->mirrors[r10_bio->devs[i].devnum].rdev; /* bio has the data to be written to slot 'i' where * we just recently had a write error. @@ -2045,7 +2045,7 @@ static void handle_read_error(struct mddev *mddev, struct r10bio *r10_bio) int slot = r10_bio->read_slot; int mirror = r10_bio->devs[slot].devnum; struct bio *bio; - conf_t *conf = mddev->private; + struct r10conf *conf = mddev->private; struct md_rdev *rdev; char b[BDEVNAME_SIZE]; unsigned long do_sync; @@ -2139,7 +2139,7 @@ read_more: generic_make_request(bio); } -static void handle_write_completed(conf_t *conf, struct r10bio *r10_bio) +static void handle_write_completed(struct r10conf *conf, struct r10bio *r10_bio) { /* Some sort of write request has finished and it * succeeded in writing where we thought there was a @@ -2204,7 +2204,7 @@ static void raid10d(struct mddev *mddev) { struct r10bio *r10_bio; unsigned long flags; - conf_t *conf = mddev->private; + struct r10conf *conf = mddev->private; struct list_head *head = &conf->retry_list; struct blk_plug plug; @@ -2252,7 +2252,7 @@ static void raid10d(struct mddev *mddev) } -static int init_resync(conf_t *conf) +static int init_resync(struct r10conf *conf) { int buffs; @@ -2300,7 +2300,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) { - conf_t *conf = mddev->private; + struct r10conf *conf = mddev->private; struct r10bio *r10_bio; struct bio *biolist = NULL, *bio; sector_t max_sector, nr_sectors; @@ -2717,7 +2717,7 @@ static sector_t raid10_size(struct mddev *mddev, sector_t sectors, int raid_disks) { sector_t size; - conf_t *conf = mddev->private; + struct r10conf *conf = mddev->private; if (!raid_disks) raid_disks = conf->raid_disks; @@ -2733,9 +2733,9 @@ raid10_size(struct mddev *mddev, sector_t sectors, int raid_disks) } -static conf_t *setup_conf(struct mddev *mddev) +static struct r10conf *setup_conf(struct mddev *mddev) { - conf_t *conf = NULL; + struct r10conf *conf = NULL; int nc, fc, fo; sector_t stride, size; int err = -EINVAL; @@ -2760,7 +2760,7 @@ static conf_t *setup_conf(struct mddev *mddev) } err = -ENOMEM; - conf = kzalloc(sizeof(conf_t), GFP_KERNEL); + conf = kzalloc(sizeof(struct r10conf), GFP_KERNEL); if (!conf) goto out; @@ -2838,7 +2838,7 @@ static conf_t *setup_conf(struct mddev *mddev) static int run(struct mddev *mddev) { - conf_t *conf; + struct r10conf *conf; int i, disk_idx, chunk_size; struct mirror_info *disk; struct md_rdev *rdev; @@ -2968,7 +2968,7 @@ out: static int stop(struct mddev *mddev) { - conf_t *conf = mddev->private; + struct r10conf *conf = mddev->private; raise_barrier(conf, 0); lower_barrier(conf); @@ -2985,7 +2985,7 @@ static int stop(struct mddev *mddev) static void raid10_quiesce(struct mddev *mddev, int state) { - conf_t *conf = mddev->private; + struct r10conf *conf = mddev->private; switch(state) { case 1: @@ -3000,7 +3000,7 @@ static void raid10_quiesce(struct mddev *mddev, int state) static void *raid10_takeover_raid0(struct mddev *mddev) { struct md_rdev *rdev; - conf_t *conf; + struct r10conf *conf; if (mddev->degraded > 0) { printk(KERN_ERR "md/raid10:%s: Error: degraded raid0!\n", diff --git a/drivers/md/raid10.h b/drivers/md/raid10.h index 94f898a11be4..35489a569597 100644 --- a/drivers/md/raid10.h +++ b/drivers/md/raid10.h @@ -11,7 +11,7 @@ struct mirror_info { */ }; -struct r10_private_data_s { +struct r10conf { struct mddev *mddev; struct mirror_info *mirrors; int raid_disks; @@ -67,8 +67,6 @@ struct r10_private_data_s { struct md_thread *thread; }; -typedef struct r10_private_data_s conf_t; - /* * this is our 'private' RAID10 bio. * -- cgit v1.2.2 From e8096360476689898f038feebf5b352c9ec43a2a Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 11 Oct 2011 16:49:05 +1100 Subject: md/raid1: typedef removal: conf_t -> struct r1conf Signed-off-by: NeilBrown --- drivers/md/raid1.c | 94 +++++++++++++++++++++++++++--------------------------- drivers/md/raid1.h | 4 +-- 2 files changed, 48 insertions(+), 50 deletions(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index f6eabeb21281..e09f59545e97 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -46,8 +46,8 @@ #define NR_RAID1_BIOS 256 -static void allow_barrier(conf_t *conf); -static void lower_barrier(conf_t *conf); +static void allow_barrier(struct r1conf *conf); +static void lower_barrier(struct r1conf *conf); 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); } -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; @@ -168,7 +168,7 @@ static void put_all_bios(conf_t *conf, 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); 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) { - conf_t *conf = r1_bio->mddev->private; + struct r1conf *conf = r1_bio->mddev->private; int i; for (i=0; iraid_disks; i++) { @@ -194,7 +194,7 @@ static void reschedule_retry(struct r1bio *r1_bio) { unsigned long flags; struct mddev *mddev = r1_bio->mddev; - conf_t *conf = mddev->private; + struct r1conf *conf = mddev->private; spin_lock_irqsave(&conf->device_lock, flags); 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; int done; - conf_t *conf = r1_bio->mddev->private; + struct r1conf *conf = r1_bio->mddev->private; if (bio->bi_phys_segments) { 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) { - conf_t *conf = r1_bio->mddev->private; + struct r1conf *conf = r1_bio->mddev->private; conf->mirrors[disk].head_position = 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); struct r1bio *r1_bio = bio->bi_private; int mirror; - conf_t *conf = r1_bio->mddev->private; + struct r1conf *conf = r1_bio->mddev->private; 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); struct r1bio *r1_bio = bio->bi_private; 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; 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. */ -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; 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) { - conf_t *conf = mddev->private; + struct r1conf *conf = mddev->private; int i, ret = 0; rcu_read_lock(); @@ -628,7 +628,7 @@ static int raid1_congested(void *data, int 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 * bitmap updates get flushed here. @@ -676,7 +676,7 @@ static void flush_pending_writes(conf_t *conf) */ #define RESYNC_DEPTH 32 -static void raise_barrier(conf_t *conf) +static void raise_barrier(struct r1conf *conf) { spin_lock_irq(&conf->resync_lock); @@ -695,7 +695,7 @@ static void raise_barrier(conf_t *conf) spin_unlock_irq(&conf->resync_lock); } -static void lower_barrier(conf_t *conf) +static void lower_barrier(struct r1conf *conf) { unsigned long flags; BUG_ON(conf->barrier <= 0); @@ -705,7 +705,7 @@ static void lower_barrier(conf_t *conf) 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); if (conf->barrier) { @@ -719,7 +719,7 @@ static void wait_barrier(conf_t *conf) spin_unlock_irq(&conf->resync_lock); } -static void allow_barrier(conf_t *conf) +static void allow_barrier(struct r1conf *conf) { unsigned long flags; spin_lock_irqsave(&conf->resync_lock, flags); @@ -728,7 +728,7 @@ static void allow_barrier(conf_t *conf) 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 * go quite. @@ -751,7 +751,7 @@ static void freeze_array(conf_t *conf) flush_pending_writes(conf)); 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 */ spin_lock_irq(&conf->resync_lock); @@ -798,7 +798,7 @@ do_sync_io: 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 r1bio *r1_bio; struct bio *read_bio; @@ -1140,7 +1140,7 @@ read_again: static void status(struct seq_file *seq, struct mddev *mddev) { - conf_t *conf = mddev->private; + struct r1conf *conf = mddev->private; int i; 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) { 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 @@ -1199,7 +1199,7 @@ static void error(struct mddev *mddev, struct md_rdev *rdev) mdname(mddev), conf->raid_disks - mddev->degraded); } -static void print_conf(conf_t *conf) +static void print_conf(struct r1conf *conf) { int i; @@ -1224,7 +1224,7 @@ static void print_conf(conf_t *conf) rcu_read_unlock(); } -static void close_sync(conf_t *conf) +static void close_sync(struct r1conf *conf) { wait_barrier(conf); allow_barrier(conf); @@ -1236,7 +1236,7 @@ static void close_sync(conf_t *conf) static int raid1_spare_active(struct mddev *mddev) { int i; - conf_t *conf = mddev->private; + struct r1conf *conf = mddev->private; int count = 0; 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) { - conf_t *conf = mddev->private; + struct r1conf *conf = mddev->private; int err = -EEXIST; int mirror = 0; 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) { - conf_t *conf = mddev->private; + struct r1conf *conf = mddev->private; int err = 0; struct md_rdev *rdev; 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); struct r1bio *r1_bio = bio->bi_private; struct mddev *mddev = r1_bio->mddev; - conf_t *conf = mddev->private; + struct r1conf *conf = mddev->private; int mirror=0; sector_t first_bad; int bad_sectors; @@ -1447,7 +1447,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio) * will have bi_end_io clear. */ 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]; sector_t sect = r1_bio->sector; int sectors = r1_bio->sectors; @@ -1563,7 +1563,7 @@ static int process_checks(struct r1bio *r1_bio) * attempt an over-write */ struct mddev *mddev = r1_bio->mddev; - conf_t *conf = mddev->private; + struct r1conf *conf = mddev->private; int primary; 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) { - conf_t *conf = mddev->private; + struct r1conf *conf = mddev->private; int i; int disks = conf->raid_disks; 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. */ -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) { 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) { struct mddev *mddev = r1_bio->mddev; - conf_t *conf = mddev->private; + struct r1conf *conf = mddev->private; struct md_rdev *rdev = conf->mirrors[i].rdev; int vcnt, idx; struct bio_vec *vec; @@ -1866,7 +1866,7 @@ static int narrow_write_error(struct r1bio *r1_bio, int i) 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 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); } -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; 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); } -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 max_sectors; @@ -2012,7 +2012,7 @@ static void raid1d(struct mddev *mddev) { struct r1bio *r1_bio; unsigned long flags; - conf_t *conf = mddev->private; + struct r1conf *conf = mddev->private; struct list_head *head = &conf->retry_list; 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; @@ -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) { - conf_t *conf = mddev->private; + struct r1conf *conf = mddev->private; struct r1bio *r1_bio; struct bio *bio; 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; } -static conf_t *setup_conf(struct mddev *mddev) +static struct r1conf *setup_conf(struct mddev *mddev) { - conf_t *conf; + struct r1conf *conf; int i; struct mirror_info *disk; struct md_rdev *rdev; int err = -ENOMEM; - conf = kzalloc(sizeof(conf_t), GFP_KERNEL); + conf = kzalloc(sizeof(struct r1conf), GFP_KERNEL); if (!conf) goto abort; @@ -2468,7 +2468,7 @@ static conf_t *setup_conf(struct mddev *mddev) static int run(struct mddev *mddev) { - conf_t *conf; + struct r1conf *conf; int i; struct md_rdev *rdev; @@ -2548,7 +2548,7 @@ static int run(struct mddev *mddev) static int stop(struct mddev *mddev) { - conf_t *conf = mddev->private; + struct r1conf *conf = mddev->private; struct bitmap *bitmap = mddev->bitmap; /* wait for behind writes to complete */ @@ -2613,7 +2613,7 @@ static int raid1_reshape(struct mddev *mddev) mempool_t *newpool, *oldpool; struct pool_info *newpoolinfo; struct mirror_info *newmirrors; - conf_t *conf = mddev->private; + struct r1conf *conf = mddev->private; int cnt, raid_disks; unsigned long flags; int d, d2, err; @@ -2705,7 +2705,7 @@ static int raid1_reshape(struct mddev *mddev) static void raid1_quiesce(struct mddev *mddev, int state) { - conf_t *conf = mddev->private; + struct r1conf *conf = mddev->private; switch(state) { 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 */ if (mddev->level == 5 && mddev->raid_disks == 2) { - conf_t *conf; + struct r1conf *conf; mddev->new_level = 1; mddev->new_layout = 0; mddev->new_chunk_sectors = 0; diff --git a/drivers/md/raid1.h b/drivers/md/raid1.h index dd5e66a4163f..5b16d09817df 100644 --- a/drivers/md/raid1.h +++ b/drivers/md/raid1.h @@ -19,7 +19,7 @@ struct pool_info { int raid_disks; }; -struct r1_private_data_s { +struct r1conf { struct mddev *mddev; struct mirror_info *mirrors; int raid_disks; @@ -90,8 +90,6 @@ struct r1_private_data_s { struct md_thread *thread; }; -typedef struct r1_private_data_s conf_t; - /* * this is our 'private' RAID1 bio. * -- cgit v1.2.2 From d1688a6d5515f1900af76a963b4bb6d9a6554cfa Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 11 Oct 2011 16:49:52 +1100 Subject: md/raid5: typedef removal: raid5_conf_t -> struct r5conf Signed-off-by: NeilBrown --- drivers/md/dm-raid.c | 4 +- drivers/md/raid5.c | 158 +++++++++++++++++++++++++-------------------------- drivers/md/raid5.h | 8 +-- 3 files changed, 84 insertions(+), 86 deletions(-) diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index c0c30d880447..220aefc80d15 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -1097,7 +1097,7 @@ static int raid_status(struct dm_target *ti, status_type_t type, rs->md.bitmap_info.max_write_behind); if (rs->print_flags & DMPF_STRIPE_CACHE) { - raid5_conf_t *conf = rs->md.private; + struct r5conf *conf = rs->md.private; /* convert from kiB to sectors */ DMEMIT(" stripe_cache %d", @@ -1146,7 +1146,7 @@ static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits) { struct raid_set *rs = ti->private; unsigned chunk_size = rs->md.chunk_sectors << 9; - raid5_conf_t *conf = rs->md.private; + struct r5conf *conf = rs->md.private; blk_limits_io_min(limits, chunk_size); blk_limits_io_opt(limits, chunk_size * (conf->raid_disks - conf->max_degraded)); diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 8514e9aeb369..921e96670ad4 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -70,7 +70,7 @@ #define NR_HASH (PAGE_SIZE / sizeof(struct hlist_head)) #define HASH_MASK (NR_HASH - 1) -static inline struct hlist_head *stripe_hash(raid5_conf_t *conf, sector_t sect) +static inline struct hlist_head *stripe_hash(struct r5conf *conf, sector_t sect) { int hash = (sect >> STRIPE_SHIFT) & HASH_MASK; return &conf->stripe_hashtbl[hash]; @@ -180,7 +180,7 @@ static void return_io(struct bio *return_bi) } } -static void print_raid5_conf (raid5_conf_t *conf); +static void print_raid5_conf (struct r5conf *conf); static int stripe_operations_active(struct stripe_head *sh) { @@ -189,7 +189,7 @@ static int stripe_operations_active(struct stripe_head *sh) test_bit(STRIPE_COMPUTE_RUN, &sh->state); } -static void __release_stripe(raid5_conf_t *conf, struct stripe_head *sh) +static void __release_stripe(struct r5conf *conf, struct stripe_head *sh) { if (atomic_dec_and_test(&sh->count)) { BUG_ON(!list_empty(&sh->lru)); @@ -225,7 +225,7 @@ static void __release_stripe(raid5_conf_t *conf, struct stripe_head *sh) static void release_stripe(struct stripe_head *sh) { - raid5_conf_t *conf = sh->raid_conf; + struct r5conf *conf = sh->raid_conf; unsigned long flags; spin_lock_irqsave(&conf->device_lock, flags); @@ -241,7 +241,7 @@ static inline void remove_hash(struct stripe_head *sh) hlist_del_init(&sh->hash); } -static inline void insert_hash(raid5_conf_t *conf, struct stripe_head *sh) +static inline void insert_hash(struct r5conf *conf, struct stripe_head *sh) { struct hlist_head *hp = stripe_hash(conf, sh->sector); @@ -253,7 +253,7 @@ static inline void insert_hash(raid5_conf_t *conf, struct stripe_head *sh) /* find an idle stripe, make sure it is unhashed, and return it. */ -static struct stripe_head *get_free_stripe(raid5_conf_t *conf) +static struct stripe_head *get_free_stripe(struct r5conf *conf) { struct stripe_head *sh = NULL; struct list_head *first; @@ -301,12 +301,12 @@ static int grow_buffers(struct stripe_head *sh) } static void raid5_build_block(struct stripe_head *sh, int i, int previous); -static void stripe_set_idx(sector_t stripe, raid5_conf_t *conf, int previous, +static void stripe_set_idx(sector_t stripe, struct r5conf *conf, int previous, struct stripe_head *sh); static void init_stripe(struct stripe_head *sh, sector_t sector, int previous) { - raid5_conf_t *conf = sh->raid_conf; + struct r5conf *conf = sh->raid_conf; int i; BUG_ON(atomic_read(&sh->count) != 0); @@ -342,7 +342,7 @@ static void init_stripe(struct stripe_head *sh, sector_t sector, int previous) insert_hash(conf, sh); } -static struct stripe_head *__find_stripe(raid5_conf_t *conf, sector_t sector, +static struct stripe_head *__find_stripe(struct r5conf *conf, sector_t sector, short generation) { struct stripe_head *sh; @@ -369,7 +369,7 @@ static struct stripe_head *__find_stripe(raid5_conf_t *conf, sector_t sector, * of the two sections, and some non-in_sync devices may * be insync in the section most affected by failed devices. */ -static int has_failed(raid5_conf_t *conf) +static int has_failed(struct r5conf *conf) { int degraded; int i; @@ -424,7 +424,7 @@ static int has_failed(raid5_conf_t *conf) } static struct stripe_head * -get_active_stripe(raid5_conf_t *conf, sector_t sector, +get_active_stripe(struct r5conf *conf, sector_t sector, int previous, int noblock, int noquiesce) { struct stripe_head *sh; @@ -484,7 +484,7 @@ raid5_end_write_request(struct bio *bi, int error); static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) { - raid5_conf_t *conf = sh->raid_conf; + struct r5conf *conf = sh->raid_conf; int i, disks = sh->disks; might_sleep(); @@ -643,7 +643,7 @@ static void ops_complete_biofill(void *stripe_head_ref) { struct stripe_head *sh = stripe_head_ref; struct bio *return_bi = NULL; - raid5_conf_t *conf = sh->raid_conf; + struct r5conf *conf = sh->raid_conf; int i; pr_debug("%s: stripe %llu\n", __func__, @@ -688,7 +688,7 @@ static void ops_complete_biofill(void *stripe_head_ref) static void ops_run_biofill(struct stripe_head *sh) { struct dma_async_tx_descriptor *tx = NULL; - raid5_conf_t *conf = sh->raid_conf; + struct r5conf *conf = sh->raid_conf; struct async_submit_ctl submit; int i; @@ -1239,7 +1239,7 @@ static void __raid_run_ops(struct stripe_head *sh, unsigned long ops_request) { int overlap_clear = 0, i, disks = sh->disks; struct dma_async_tx_descriptor *tx = NULL; - raid5_conf_t *conf = sh->raid_conf; + struct r5conf *conf = sh->raid_conf; int level = conf->level; struct raid5_percpu *percpu; unsigned long cpu; @@ -1330,7 +1330,7 @@ static void raid_run_ops(struct stripe_head *sh, unsigned long ops_request) #define raid_run_ops __raid_run_ops #endif -static int grow_one_stripe(raid5_conf_t *conf) +static int grow_one_stripe(struct r5conf *conf) { struct stripe_head *sh; sh = kmem_cache_zalloc(conf->slab_cache, GFP_KERNEL); @@ -1355,7 +1355,7 @@ static int grow_one_stripe(raid5_conf_t *conf) return 1; } -static int grow_stripes(raid5_conf_t *conf, int num) +static int grow_stripes(struct r5conf *conf, int num) { struct kmem_cache *sc; int devs = max(conf->raid_disks, conf->previous_raid_disks); @@ -1404,7 +1404,7 @@ static size_t scribble_len(int num) return len; } -static int resize_stripes(raid5_conf_t *conf, int newsize) +static int resize_stripes(struct r5conf *conf, int newsize) { /* Make all the stripes able to hold 'newsize' devices. * New slots in each stripe get 'page' set to a new page. @@ -1549,7 +1549,7 @@ static int resize_stripes(raid5_conf_t *conf, int newsize) return err; } -static int drop_one_stripe(raid5_conf_t *conf) +static int drop_one_stripe(struct r5conf *conf) { struct stripe_head *sh; @@ -1565,7 +1565,7 @@ static int drop_one_stripe(raid5_conf_t *conf) return 1; } -static void shrink_stripes(raid5_conf_t *conf) +static void shrink_stripes(struct r5conf *conf) { while (drop_one_stripe(conf)) ; @@ -1578,7 +1578,7 @@ static void shrink_stripes(raid5_conf_t *conf) static void raid5_end_read_request(struct bio * bi, int error) { struct stripe_head *sh = bi->bi_private; - raid5_conf_t *conf = sh->raid_conf; + struct r5conf *conf = sh->raid_conf; int disks = sh->disks, i; int uptodate = test_bit(BIO_UPTODATE, &bi->bi_flags); char b[BDEVNAME_SIZE]; @@ -1665,7 +1665,7 @@ static void raid5_end_read_request(struct bio * bi, int error) static void raid5_end_write_request(struct bio *bi, int error) { struct stripe_head *sh = bi->bi_private; - raid5_conf_t *conf = sh->raid_conf; + struct r5conf *conf = sh->raid_conf; int disks = sh->disks, i; int uptodate = test_bit(BIO_UPTODATE, &bi->bi_flags); sector_t first_bad; @@ -1722,7 +1722,7 @@ static void raid5_build_block(struct stripe_head *sh, int i, int previous) static void error(struct mddev *mddev, struct md_rdev *rdev) { char b[BDEVNAME_SIZE]; - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; pr_debug("raid456: error called\n"); if (test_and_clear_bit(In_sync, &rdev->flags)) { @@ -1751,7 +1751,7 @@ static void error(struct mddev *mddev, struct md_rdev *rdev) * Input: a 'big' sector number, * Output: index of the data and parity disk, and the sector # in them. */ -static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector, +static sector_t raid5_compute_sector(struct r5conf *conf, sector_t r_sector, int previous, int *dd_idx, struct stripe_head *sh) { @@ -1956,7 +1956,7 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector, static sector_t compute_blocknr(struct stripe_head *sh, int i, int previous) { - raid5_conf_t *conf = sh->raid_conf; + struct r5conf *conf = sh->raid_conf; int raid_disks = sh->disks; int data_disks = raid_disks - conf->max_degraded; sector_t new_sector = sh->sector, check; @@ -2081,7 +2081,7 @@ schedule_reconstruction(struct stripe_head *sh, struct stripe_head_state *s, int rcw, int expand) { int i, pd_idx = sh->pd_idx, disks = sh->disks; - raid5_conf_t *conf = sh->raid_conf; + struct r5conf *conf = sh->raid_conf; int level = conf->level; if (rcw) { @@ -2166,7 +2166,7 @@ schedule_reconstruction(struct stripe_head *sh, struct stripe_head_state *s, static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx, int forwrite) { struct bio **bip; - raid5_conf_t *conf = sh->raid_conf; + struct r5conf *conf = sh->raid_conf; int firstwrite=0; pr_debug("adding bi b#%llu to stripe s#%llu\n", @@ -2228,9 +2228,9 @@ static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx, in return 0; } -static void end_reshape(raid5_conf_t *conf); +static void end_reshape(struct r5conf *conf); -static void stripe_set_idx(sector_t stripe, raid5_conf_t *conf, int previous, +static void stripe_set_idx(sector_t stripe, struct r5conf *conf, int previous, struct stripe_head *sh) { int sectors_per_chunk = @@ -2247,7 +2247,7 @@ static void stripe_set_idx(sector_t stripe, raid5_conf_t *conf, int previous, } static void -handle_failed_stripe(raid5_conf_t *conf, struct stripe_head *sh, +handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh, struct stripe_head_state *s, int disks, struct bio **return_bi) { @@ -2352,7 +2352,7 @@ handle_failed_stripe(raid5_conf_t *conf, struct stripe_head *sh, } static void -handle_failed_sync(raid5_conf_t *conf, struct stripe_head *sh, +handle_failed_sync(struct r5conf *conf, struct stripe_head *sh, struct stripe_head_state *s) { int abort = 0; @@ -2501,7 +2501,7 @@ static void handle_stripe_fill(struct stripe_head *sh, * Note that if we 'wrote' to a failed drive, it will be UPTODATE, but * never LOCKED, so we don't need to test 'failed' directly. */ -static void handle_stripe_clean_event(raid5_conf_t *conf, +static void handle_stripe_clean_event(struct r5conf *conf, struct stripe_head *sh, int disks, struct bio **return_bi) { int i; @@ -2546,7 +2546,7 @@ static void handle_stripe_clean_event(raid5_conf_t *conf, md_wakeup_thread(conf->mddev->thread); } -static void handle_stripe_dirtying(raid5_conf_t *conf, +static void handle_stripe_dirtying(struct r5conf *conf, struct stripe_head *sh, struct stripe_head_state *s, int disks) @@ -2648,7 +2648,7 @@ static void handle_stripe_dirtying(raid5_conf_t *conf, schedule_reconstruction(sh, s, rcw == 0, 0); } -static void handle_parity_checks5(raid5_conf_t *conf, struct stripe_head *sh, +static void handle_parity_checks5(struct r5conf *conf, struct stripe_head *sh, struct stripe_head_state *s, int disks) { struct r5dev *dev = NULL; @@ -2736,7 +2736,7 @@ static void handle_parity_checks5(raid5_conf_t *conf, struct stripe_head *sh, } -static void handle_parity_checks6(raid5_conf_t *conf, struct stripe_head *sh, +static void handle_parity_checks6(struct r5conf *conf, struct stripe_head *sh, struct stripe_head_state *s, int disks) { @@ -2899,7 +2899,7 @@ static void handle_parity_checks6(raid5_conf_t *conf, struct stripe_head *sh, } } -static void handle_stripe_expansion(raid5_conf_t *conf, struct stripe_head *sh) +static void handle_stripe_expansion(struct r5conf *conf, struct stripe_head *sh) { int i; @@ -2978,7 +2978,7 @@ static void handle_stripe_expansion(raid5_conf_t *conf, struct stripe_head *sh) static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) { - raid5_conf_t *conf = sh->raid_conf; + struct r5conf *conf = sh->raid_conf; int disks = sh->disks; struct r5dev *dev; int i; @@ -3102,7 +3102,7 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) static void handle_stripe(struct stripe_head *sh) { struct stripe_head_state s; - raid5_conf_t *conf = sh->raid_conf; + struct r5conf *conf = sh->raid_conf; int i; int prexor; int disks = sh->disks; @@ -3373,7 +3373,7 @@ finish: clear_bit(STRIPE_ACTIVE, &sh->state); } -static void raid5_activate_delayed(raid5_conf_t *conf) +static void raid5_activate_delayed(struct r5conf *conf) { if (atomic_read(&conf->preread_active_stripes) < IO_THRESHOLD) { while (!list_empty(&conf->delayed_list)) { @@ -3389,7 +3389,7 @@ static void raid5_activate_delayed(raid5_conf_t *conf) } } -static void activate_bit_delay(raid5_conf_t *conf) +static void activate_bit_delay(struct r5conf *conf) { /* device_lock is held */ struct list_head head; @@ -3405,7 +3405,7 @@ static void activate_bit_delay(raid5_conf_t *conf) int md_raid5_congested(struct mddev *mddev, int bits) { - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; /* No difference between reads and writes. Just check * how busy the stripe_cache is @@ -3473,7 +3473,7 @@ static int in_chunk_boundary(struct mddev *mddev, struct bio *bio) * add bio to the retry LIFO ( in O(1) ... we are in interrupt ) * later sampled by raid5d. */ -static void add_bio_to_retry(struct bio *bi,raid5_conf_t *conf) +static void add_bio_to_retry(struct bio *bi,struct r5conf *conf) { unsigned long flags; @@ -3487,7 +3487,7 @@ static void add_bio_to_retry(struct bio *bi,raid5_conf_t *conf) } -static struct bio *remove_bio_from_retry(raid5_conf_t *conf) +static struct bio *remove_bio_from_retry(struct r5conf *conf) { struct bio *bi; @@ -3521,7 +3521,7 @@ static void raid5_align_endio(struct bio *bi, int error) { struct bio* raid_bi = bi->bi_private; struct mddev *mddev; - raid5_conf_t *conf; + struct r5conf *conf; int uptodate = test_bit(BIO_UPTODATE, &bi->bi_flags); struct md_rdev *rdev; @@ -3569,7 +3569,7 @@ static int bio_fits_rdev(struct bio *bi) static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio) { - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; int dd_idx; struct bio* align_bi; struct md_rdev *rdev; @@ -3645,7 +3645,7 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio) * head of the hold_list has changed, i.e. the head was promoted to the * handle_list. */ -static struct stripe_head *__get_priority_stripe(raid5_conf_t *conf) +static struct stripe_head *__get_priority_stripe(struct r5conf *conf) { struct stripe_head *sh; @@ -3690,7 +3690,7 @@ static struct stripe_head *__get_priority_stripe(raid5_conf_t *conf) static int make_request(struct mddev *mddev, struct bio * bi) { - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; int dd_idx; sector_t new_sector; sector_t logical_sector, last_sector; @@ -3861,7 +3861,7 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr, int *sk * As the reads complete, handle_stripe will copy the data * into the destination stripe and release that stripe. */ - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; struct stripe_head *sh; sector_t first_sector, last_sector; int raid_disks = conf->previous_raid_disks; @@ -4070,7 +4070,7 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr, int *sk /* FIXME go_faster isn't used */ static inline sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipped, int go_faster) { - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; struct stripe_head *sh; sector_t max_sector = mddev->dev_sectors; sector_t sync_blocks; @@ -4155,7 +4155,7 @@ static inline sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int return STRIPE_SECTORS; } -static int retry_aligned_read(raid5_conf_t *conf, struct bio *raid_bio) +static int retry_aligned_read(struct r5conf *conf, struct bio *raid_bio) { /* We may not be able to submit a whole bio at once as there * may not be enough stripe_heads available. @@ -4230,7 +4230,7 @@ static int retry_aligned_read(raid5_conf_t *conf, struct bio *raid_bio) static void raid5d(struct mddev *mddev) { struct stripe_head *sh; - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; int handled; struct blk_plug plug; @@ -4296,7 +4296,7 @@ static void raid5d(struct mddev *mddev) static ssize_t raid5_show_stripe_cache_size(struct mddev *mddev, char *page) { - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; if (conf) return sprintf(page, "%d\n", conf->max_nr_stripes); else @@ -4306,7 +4306,7 @@ raid5_show_stripe_cache_size(struct mddev *mddev, char *page) int raid5_set_cache_size(struct mddev *mddev, int size) { - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; int err; if (size <= 16 || size > 32768) @@ -4332,7 +4332,7 @@ EXPORT_SYMBOL(raid5_set_cache_size); static ssize_t raid5_store_stripe_cache_size(struct mddev *mddev, const char *page, size_t len) { - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; unsigned long new; int err; @@ -4357,7 +4357,7 @@ raid5_stripecache_size = __ATTR(stripe_cache_size, S_IRUGO | S_IWUSR, static ssize_t raid5_show_preread_threshold(struct mddev *mddev, char *page) { - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; if (conf) return sprintf(page, "%d\n", conf->bypass_threshold); else @@ -4367,7 +4367,7 @@ raid5_show_preread_threshold(struct mddev *mddev, char *page) static ssize_t raid5_store_preread_threshold(struct mddev *mddev, const char *page, size_t len) { - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; unsigned long new; if (len >= PAGE_SIZE) return -EINVAL; @@ -4391,7 +4391,7 @@ raid5_preread_bypass_threshold = __ATTR(preread_bypass_threshold, static ssize_t stripe_cache_active_show(struct mddev *mddev, char *page) { - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; if (conf) return sprintf(page, "%d\n", atomic_read(&conf->active_stripes)); else @@ -4415,7 +4415,7 @@ static struct attribute_group raid5_attrs_group = { static sector_t raid5_size(struct mddev *mddev, sector_t sectors, int raid_disks) { - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; if (!sectors) sectors = mddev->dev_sectors; @@ -4428,7 +4428,7 @@ raid5_size(struct mddev *mddev, sector_t sectors, int raid_disks) return sectors * (raid_disks - conf->max_degraded); } -static void raid5_free_percpu(raid5_conf_t *conf) +static void raid5_free_percpu(struct r5conf *conf) { struct raid5_percpu *percpu; unsigned long cpu; @@ -4450,7 +4450,7 @@ static void raid5_free_percpu(raid5_conf_t *conf) free_percpu(conf->percpu); } -static void free_conf(raid5_conf_t *conf) +static void free_conf(struct r5conf *conf) { shrink_stripes(conf); raid5_free_percpu(conf); @@ -4463,7 +4463,7 @@ static void free_conf(raid5_conf_t *conf) static int raid456_cpu_notify(struct notifier_block *nfb, unsigned long action, void *hcpu) { - raid5_conf_t *conf = container_of(nfb, raid5_conf_t, cpu_notify); + struct r5conf *conf = container_of(nfb, struct r5conf, cpu_notify); long cpu = (long)hcpu; struct raid5_percpu *percpu = per_cpu_ptr(conf->percpu, cpu); @@ -4498,7 +4498,7 @@ static int raid456_cpu_notify(struct notifier_block *nfb, unsigned long action, } #endif -static int raid5_alloc_percpu(raid5_conf_t *conf) +static int raid5_alloc_percpu(struct r5conf *conf) { unsigned long cpu; struct page *spare_page; @@ -4540,9 +4540,9 @@ static int raid5_alloc_percpu(raid5_conf_t *conf) return err; } -static raid5_conf_t *setup_conf(struct mddev *mddev) +static struct r5conf *setup_conf(struct mddev *mddev) { - raid5_conf_t *conf; + struct r5conf *conf; int raid_disk, memory, max_disks; struct md_rdev *rdev; struct disk_info *disk; @@ -4576,7 +4576,7 @@ static raid5_conf_t *setup_conf(struct mddev *mddev) return ERR_PTR(-EINVAL); } - conf = kzalloc(sizeof(raid5_conf_t), GFP_KERNEL); + conf = kzalloc(sizeof(struct r5conf), GFP_KERNEL); if (conf == NULL) goto abort; spin_lock_init(&conf->device_lock); @@ -4707,7 +4707,7 @@ static int only_parity(int raid_disk, int algo, int raid_disks, int max_degraded static int run(struct mddev *mddev) { - raid5_conf_t *conf; + struct r5conf *conf; int working_disks = 0; int dirty_parity_disks = 0; struct md_rdev *rdev; @@ -4944,7 +4944,7 @@ abort: static int stop(struct mddev *mddev) { - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; md_unregister_thread(&mddev->thread); if (mddev->queue) @@ -4957,7 +4957,7 @@ static int stop(struct mddev *mddev) static void status(struct seq_file *seq, struct mddev *mddev) { - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; int i; seq_printf(seq, " level %d, %dk chunk, algorithm %d", mddev->level, @@ -4970,7 +4970,7 @@ static void status(struct seq_file *seq, struct mddev *mddev) seq_printf (seq, "]"); } -static void print_raid5_conf (raid5_conf_t *conf) +static void print_raid5_conf (struct r5conf *conf) { int i; struct disk_info *tmp; @@ -4997,7 +4997,7 @@ static void print_raid5_conf (raid5_conf_t *conf) static int raid5_spare_active(struct mddev *mddev) { int i; - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; struct disk_info *tmp; int count = 0; unsigned long flags; @@ -5021,7 +5021,7 @@ static int raid5_spare_active(struct mddev *mddev) static int raid5_remove_disk(struct mddev *mddev, int number) { - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; int err = 0; struct md_rdev *rdev; struct disk_info *p = conf->disks + number; @@ -5064,7 +5064,7 @@ abort: static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev) { - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; int err = -EEXIST; int disk; struct disk_info *p; @@ -5142,7 +5142,7 @@ static int check_stripe_cache(struct mddev *mddev) * If the chunk size is greater, user-space should request more * stripe_heads first. */ - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; if (((mddev->chunk_sectors << 9) / STRIPE_SIZE) * 4 > conf->max_nr_stripes || ((mddev->new_chunk_sectors << 9) / STRIPE_SIZE) * 4 @@ -5158,7 +5158,7 @@ static int check_stripe_cache(struct mddev *mddev) static int check_reshape(struct mddev *mddev) { - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; if (mddev->delta_disks == 0 && mddev->new_layout == mddev->layout && @@ -5190,7 +5190,7 @@ static int check_reshape(struct mddev *mddev) static int raid5_start_reshape(struct mddev *mddev) { - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; struct md_rdev *rdev; int spares = 0; unsigned long flags; @@ -5305,7 +5305,7 @@ static int raid5_start_reshape(struct mddev *mddev) /* This is called from the reshape thread and should make any * changes needed in 'conf' */ -static void end_reshape(raid5_conf_t *conf) +static void end_reshape(struct r5conf *conf) { if (!test_bit(MD_RECOVERY_INTR, &conf->mddev->recovery)) { @@ -5334,7 +5334,7 @@ static void end_reshape(raid5_conf_t *conf) */ static void raid5_finish_reshape(struct mddev *mddev) { - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { @@ -5369,7 +5369,7 @@ static void raid5_finish_reshape(struct mddev *mddev) static void raid5_quiesce(struct mddev *mddev, int state) { - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; switch(state) { case 2: /* resume for a suspend */ @@ -5498,7 +5498,7 @@ static int raid5_check_reshape(struct mddev *mddev) * For larger arrays we record the new value - after validation * to be used by a reshape pass. */ - raid5_conf_t *conf = mddev->private; + struct r5conf *conf = mddev->private; int new_chunk = mddev->new_chunk_sectors; if (mddev->new_layout >= 0 && !algorithm_valid_raid5(mddev->new_layout)) diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index cf4702ccf73a..e10c5531f9c5 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h @@ -197,7 +197,7 @@ enum reconstruct_states { struct stripe_head { struct hlist_node hash; struct list_head lru; /* inactive_list or handle_list */ - struct raid5_private_data *raid_conf; + struct r5conf *raid_conf; short generation; /* increments with every * reshape */ sector_t sector; /* sector of this row */ @@ -347,7 +347,7 @@ struct disk_info { struct md_rdev *rdev; }; -struct raid5_private_data { +struct r5conf { struct hlist_head *stripe_hashtbl; struct mddev *mddev; struct disk_info *spare; @@ -439,8 +439,6 @@ struct raid5_private_data { struct md_thread *thread; }; -typedef struct raid5_private_data raid5_conf_t; - /* * Our supported algorithms */ @@ -504,6 +502,6 @@ static inline int algorithm_is_DDF(int layout) } extern int md_raid5_congested(struct mddev *mddev, int bits); -extern void md_raid5_kick_device(raid5_conf_t *conf); +extern void md_raid5_kick_device(struct r5conf *conf); extern int raid5_set_cache_size(struct mddev *mddev, int size); #endif -- cgit v1.2.2 From 29d3247ea2274bca0d0b7f41fcf3b82e0a8bc44c Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 11 Oct 2011 16:49:56 +1100 Subject: md/bitmap remove fault injection options. These are too hard to use to be much more than noise. Signed-off-by: NeilBrown --- drivers/md/bitmap.c | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 2d5158c8d6be..7878712721bf 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c @@ -29,27 +29,6 @@ #include "md.h" #include "bitmap.h" -/* debug macros */ - -#define DEBUG 0 - -#if DEBUG -/* these are for debugging purposes only! */ - -/* define one and only one of these */ -#define INJECT_FAULTS_1 0 /* cause bitmap_alloc_page to fail always */ -#define INJECT_FAULTS_2 0 /* cause bitmap file to be kicked when first bit set*/ -#define INJECT_FAULTS_3 0 /* treat bitmap file as kicked at init time */ -#define INJECT_FAULTS_4 0 /* undef */ -#define INJECT_FAULTS_5 0 /* undef */ -#define INJECT_FAULTS_6 0 - -/* if these are defined, the driver will fail! debug only */ -#define INJECT_FATAL_FAULT_1 0 /* fail kmalloc, causing bitmap_create to fail */ -#define INJECT_FATAL_FAULT_2 0 /* undef */ -#define INJECT_FATAL_FAULT_3 0 /* undef */ -#endif - static inline char *bmname(struct bitmap *bitmap) { return bitmap->mddev ? mdname(bitmap->mddev) : "mdX"; @@ -62,11 +41,7 @@ static unsigned char *bitmap_alloc_page(struct bitmap *bitmap) { unsigned char *page; -#ifdef INJECT_FAULTS_1 - page = NULL; -#else page = kzalloc(PAGE_SIZE, GFP_NOIO); -#endif if (!page) printk("%s: bitmap_alloc_page FAILED\n", bmname(bitmap)); else @@ -990,11 +965,7 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) BUG_ON(!file && !bitmap->mddev->bitmap_info.offset); -#ifdef INJECT_FAULTS_3 - outofdate = 1; -#else outofdate = bitmap->flags & BITMAP_STALE; -#endif if (outofdate) printk(KERN_INFO "%s: bitmap file is out of date, doing full " "recovery\n", bmname(bitmap)); @@ -1800,11 +1771,8 @@ int bitmap_create(struct mddev *mddev) bitmap->pages = pages; bitmap->missing_pages = pages; -#ifdef INJECT_FATAL_FAULT_1 - bitmap->bp = NULL; -#else bitmap->bp = kzalloc(pages * sizeof(*bitmap->bp), GFP_KERNEL); -#endif + err = -ENOMEM; if (!bitmap->bp) goto error; -- cgit v1.2.2 From 84fc4b56db85cb9e05326424049973a2036c9940 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 11 Oct 2011 16:49:58 +1100 Subject: md: rename "mdk_personality" to "md_personality" "mdk" doesn't mean anything any more. Signed-off-by: NeilBrown --- drivers/md/faulty.c | 2 +- drivers/md/linear.c | 2 +- drivers/md/md.c | 16 ++++++++-------- drivers/md/md.h | 8 ++++---- drivers/md/multipath.c | 2 +- drivers/md/raid0.c | 2 +- drivers/md/raid1.c | 2 +- drivers/md/raid10.c | 2 +- drivers/md/raid5.c | 8 ++++---- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/md/faulty.c b/drivers/md/faulty.c index 571445e52541..60816b132c2e 100644 --- a/drivers/md/faulty.c +++ b/drivers/md/faulty.c @@ -334,7 +334,7 @@ static int stop(struct mddev *mddev) return 0; } -static struct mdk_personality faulty_personality = +static struct md_personality faulty_personality = { .name = "faulty", .level = LEVEL_FAULTY, diff --git a/drivers/md/linear.c b/drivers/md/linear.c index cbac48cfe72b..10c5844460cb 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c @@ -330,7 +330,7 @@ static void linear_status (struct seq_file *seq, struct mddev *mddev) } -static struct mdk_personality linear_personality = +static struct md_personality linear_personality = { .name = "linear", .level = LEVEL_LINEAR, diff --git a/drivers/md/md.c b/drivers/md/md.c index 1f661bbcaefe..7a491771ff4d 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -771,9 +771,9 @@ static struct md_rdev * find_rdev(struct mddev * mddev, dev_t dev) return NULL; } -static struct mdk_personality *find_pers(int level, char *clevel) +static struct md_personality *find_pers(int level, char *clevel) { - struct mdk_personality *pers; + struct md_personality *pers; list_for_each_entry(pers, &pers_list, list) { if (level != LEVEL_NONE && pers->level == level) return pers; @@ -3272,7 +3272,7 @@ __ATTR(safe_mode_delay, S_IRUGO|S_IWUSR,safe_delay_show, safe_delay_store); static ssize_t level_show(struct mddev *mddev, char *page) { - struct mdk_personality *p = mddev->pers; + struct md_personality *p = mddev->pers; if (p) return sprintf(page, "%s\n", p->name); else if (mddev->clevel[0]) @@ -3288,7 +3288,7 @@ level_store(struct mddev *mddev, const char *buf, size_t len) { char clevel[16]; ssize_t rv = len; - struct mdk_personality *pers; + struct md_personality *pers; long level; void *priv; struct md_rdev *rdev; @@ -4700,7 +4700,7 @@ int md_run(struct mddev *mddev) { int err; struct md_rdev *rdev; - struct mdk_personality *pers; + struct md_personality *pers; if (list_empty(&mddev->disks)) /* cannot run an array with no devices.. */ @@ -6655,7 +6655,7 @@ static int md_seq_show(struct seq_file *seq, void *v) struct bitmap *bitmap; if (v == (void*)1) { - struct mdk_personality *pers; + struct md_personality *pers; seq_printf(seq, "Personalities : "); spin_lock(&pers_lock); list_for_each_entry(pers, &pers_list, list) @@ -6811,7 +6811,7 @@ static const struct file_operations md_seq_fops = { .poll = mdstat_poll, }; -int register_md_personality(struct mdk_personality *p) +int register_md_personality(struct md_personality *p) { spin_lock(&pers_lock); list_add_tail(&p->list, &pers_list); @@ -6820,7 +6820,7 @@ int register_md_personality(struct mdk_personality *p) return 0; } -int unregister_md_personality(struct mdk_personality *p) +int unregister_md_personality(struct md_personality *p) { printk(KERN_INFO "md: %s personality unregistered\n", p->name); spin_lock(&pers_lock); diff --git a/drivers/md/md.h b/drivers/md/md.h index b618da59ca1c..51c1d91557e0 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -184,7 +184,7 @@ extern void md_ack_all_badblocks(struct badblocks *bb); struct mddev { void *private; - struct mdk_personality *pers; + struct md_personality *pers; dev_t unit; int md_minor; struct list_head disks; @@ -413,7 +413,7 @@ static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sect atomic_add(nr_sectors, &bdev->bd_contains->bd_disk->sync_io); } -struct mdk_personality +struct md_personality { char *name; int level; @@ -551,8 +551,8 @@ static inline void safe_put_page(struct page *p) if (p) put_page(p); } -extern int register_md_personality(struct mdk_personality *p); -extern int unregister_md_personality(struct mdk_personality *p); +extern int register_md_personality(struct md_personality *p); +extern int unregister_md_personality(struct md_personality *p); extern struct md_thread *md_register_thread( void (*run)(struct mddev *mddev), struct mddev *mddev, diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 96505930afcb..d32c785e17d4 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c @@ -523,7 +523,7 @@ static int multipath_stop (struct mddev *mddev) return 0; } -static struct mdk_personality multipath_personality = +static struct md_personality multipath_personality = { .name = "multipath", .level = LEVEL_MULTIPATH, diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 38a9012ff4fe..0eb08a4df759 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -670,7 +670,7 @@ static void raid0_quiesce(struct mddev *mddev, int state) { } -static struct mdk_personality raid0_personality= +static struct md_personality raid0_personality= { .name = "raid0", .level = 0, diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index e09f59545e97..e023a25acf54 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -2738,7 +2738,7 @@ static void *raid1_takeover(struct mddev *mddev) return ERR_PTR(-EINVAL); } -static struct mdk_personality raid1_personality = +static struct md_personality raid1_personality = { .name = "raid1", .level = 1, diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index f6a9b0c8f5fa..8427ff1c5af1 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -3050,7 +3050,7 @@ static void *raid10_takeover(struct mddev *mddev) return ERR_PTR(-EINVAL); } -static struct mdk_personality raid10_personality = +static struct md_personality raid10_personality = { .name = "raid10", .level = 10, diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 921e96670ad4..eea9379f7fae 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -5591,7 +5591,7 @@ static void *raid4_takeover(struct mddev *mddev) return ERR_PTR(-EINVAL); } -static struct mdk_personality raid5_personality; +static struct md_personality raid5_personality; static void *raid6_takeover(struct mddev *mddev) { @@ -5640,7 +5640,7 @@ static void *raid6_takeover(struct mddev *mddev) } -static struct mdk_personality raid6_personality = +static struct md_personality raid6_personality = { .name = "raid6", .level = 6, @@ -5662,7 +5662,7 @@ static struct mdk_personality raid6_personality = .quiesce = raid5_quiesce, .takeover = raid6_takeover, }; -static struct mdk_personality raid5_personality = +static struct md_personality raid5_personality = { .name = "raid5", .level = 5, @@ -5685,7 +5685,7 @@ static struct mdk_personality raid5_personality = .takeover = raid5_takeover, }; -static struct mdk_personality raid4_personality = +static struct md_personality raid4_personality = { .name = "raid4", .level = 4, -- cgit v1.2.2 From 34db0cd60f8a1f4ab73d118a8be3797c20388223 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 11 Oct 2011 16:50:01 +1100 Subject: md: add proper write-congestion reporting to RAID1 and RAID10. RAID1 and RAID10 handle write requests by queuing them for handling by a separate thread. This is because when a write-intent-bitmap is active we might need to update the bitmap first, so it is good to queue a lot of writes, then do one big bitmap update for them all. However writeback request devices to appear to be congested after a while so it can make some guesstimate of throughput. The infinite queue defeats that (note that RAID5 has already has a finite queue so it doesn't suffer from this problem). So impose a limit on the number of pending write requests. By default it is 1024 which seems to be generally suitable. Make it configurable via module option just in case someone finds a regression. Signed-off-by: NeilBrown --- drivers/md/raid1.c | 20 ++++++++++++++++++++ drivers/md/raid1.h | 1 + drivers/md/raid10.c | 20 ++++++++++++++++++++ drivers/md/raid10.h | 2 +- 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index e023a25acf54..d8957d74fd25 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -45,6 +45,11 @@ */ #define NR_RAID1_BIOS 256 +/* When there are this many requests queue to be written by + * the raid1 thread, we become 'congested' to provide back-pressure + * for writeback. + */ +static int max_queued_requests = 1024; static void allow_barrier(struct r1conf *conf); static void lower_barrier(struct r1conf *conf); @@ -598,6 +603,10 @@ int md_raid1_congested(struct mddev *mddev, int bits) struct r1conf *conf = mddev->private; int i, ret = 0; + if ((bits & (1 << BDI_async_congested)) && + conf->pending_count >= max_queued_requests) + return 1; + rcu_read_lock(); for (i = 0; i < mddev->raid_disks; i++) { struct md_rdev *rdev = rcu_dereference(conf->mirrors[i].rdev); @@ -638,10 +647,12 @@ static void flush_pending_writes(struct r1conf *conf) if (conf->pending_bio_list.head) { struct bio *bio; bio = bio_list_get(&conf->pending_bio_list); + conf->pending_count = 0; spin_unlock_irq(&conf->device_lock); /* flush any pending bitmap writes to * disk before proceeding w/ I/O */ bitmap_unplug(conf->mddev->bitmap); + wake_up(&conf->wait_barrier); while (bio) { /* submit pending writes */ struct bio *next = bio->bi_next; @@ -945,6 +956,11 @@ read_again: /* * WRITE: */ + if (conf->pending_count >= max_queued_requests) { + md_wakeup_thread(mddev->thread); + wait_event(conf->wait_barrier, + conf->pending_count < max_queued_requests); + } /* first select target devices under rcu_lock and * inc refcount on their rdev. Record them by setting * bios[x] to bio @@ -1108,6 +1124,7 @@ read_again: atomic_inc(&r1_bio->remaining); spin_lock_irqsave(&conf->device_lock, flags); bio_list_add(&conf->pending_bio_list, mbio); + conf->pending_count++; spin_unlock_irqrestore(&conf->device_lock, flags); } /* Mustn't call r1_bio_write_done before this next test, @@ -2418,6 +2435,7 @@ static struct r1conf *setup_conf(struct mddev *mddev) init_waitqueue_head(&conf->wait_barrier); bio_list_init(&conf->pending_bio_list); + conf->pending_count = 0; conf->last_used = -1; for (i = 0; i < conf->raid_disks; i++) { @@ -2776,3 +2794,5 @@ MODULE_DESCRIPTION("RAID1 (mirroring) personality for MD"); MODULE_ALIAS("md-personality-3"); /* RAID1 */ MODULE_ALIAS("md-raid1"); MODULE_ALIAS("md-level-1"); + +module_param(max_queued_requests, int, S_IRUGO|S_IWUSR); diff --git a/drivers/md/raid1.h b/drivers/md/raid1.h index 5b16d09817df..c732b6cce935 100644 --- a/drivers/md/raid1.h +++ b/drivers/md/raid1.h @@ -46,6 +46,7 @@ struct r1conf { /* queue pending writes to be submitted on unplug */ struct bio_list pending_bio_list; + int pending_count; /* for use when syncing mirrors: * We don't allow both normal IO and resync/recovery IO at diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 8427ff1c5af1..9496463ca5df 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -58,6 +58,12 @@ */ #define NR_RAID10_BIOS 256 +/* When there are this many requests queue to be written by + * the raid10 thread, we become 'congested' to provide back-pressure + * for writeback. + */ +static int max_queued_requests = 1024; + static void allow_barrier(struct r10conf *conf); static void lower_barrier(struct r10conf *conf); @@ -681,6 +687,10 @@ static int raid10_congested(void *data, int bits) struct r10conf *conf = mddev->private; int i, ret = 0; + if ((bits & (1 << BDI_async_congested)) && + conf->pending_count >= max_queued_requests) + return 1; + if (mddev_congested(mddev, bits)) return 1; rcu_read_lock(); @@ -706,10 +716,12 @@ static void flush_pending_writes(struct r10conf *conf) if (conf->pending_bio_list.head) { struct bio *bio; bio = bio_list_get(&conf->pending_bio_list); + conf->pending_count = 0; spin_unlock_irq(&conf->device_lock); /* flush any pending bitmap writes to disk * before proceeding w/ I/O */ bitmap_unplug(conf->mddev->bitmap); + wake_up(&conf->wait_barrier); while (bio) { /* submit pending writes */ struct bio *next = bio->bi_next; @@ -996,6 +1008,11 @@ read_again: /* * WRITE: */ + if (conf->pending_count >= max_queued_requests) { + md_wakeup_thread(mddev->thread); + wait_event(conf->wait_barrier, + conf->pending_count < max_queued_requests); + } /* first select target devices under rcu_lock and * inc refcount on their rdev. Record them by setting * bios[x] to bio @@ -1129,6 +1146,7 @@ retry_write: atomic_inc(&r10_bio->remaining); spin_lock_irqsave(&conf->device_lock, flags); bio_list_add(&conf->pending_bio_list, mbio); + conf->pending_count++; spin_unlock_irqrestore(&conf->device_lock, flags); } @@ -3086,3 +3104,5 @@ MODULE_DESCRIPTION("RAID10 (striped mirror) personality for MD"); MODULE_ALIAS("md-personality-9"); /* RAID10 */ MODULE_ALIAS("md-raid10"); MODULE_ALIAS("md-level-10"); + +module_param(max_queued_requests, int, S_IRUGO|S_IWUSR); diff --git a/drivers/md/raid10.h b/drivers/md/raid10.h index 35489a569597..7facfdf841f4 100644 --- a/drivers/md/raid10.h +++ b/drivers/md/raid10.h @@ -42,7 +42,7 @@ struct r10conf { struct list_head retry_list; /* queue pending writes and submit them on unplug */ struct bio_list pending_bio_list; - + int pending_count; spinlock_t resync_lock; int nr_pending; -- cgit v1.2.2 From d30519fc59c5cc2f7772fa67b16b1a2426d36c95 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 18 Oct 2011 12:13:47 +1100 Subject: md: clear In_sync bit on devices added to an active array. When we add a device to an active array it can be meaningful to set the 'insync' flag. This indicates that the device is in-sync with the array except for locations recorded in the bitmap. A bitmap-based recovery can then bring it completely in-sync. Internally we move that flag to 'saved_raid_disk' but forgot to clear In_sync like we do in add_new_disk. So clear In_sync after moving its value to saved_raid_disk. Reported-by: Andrei Warkentin Signed-off-by: NeilBrown --- drivers/md/md.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/md/md.c b/drivers/md/md.c index 7a491771ff4d..0ea34858637a 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -2722,6 +2722,7 @@ slot_store(struct md_rdev *rdev, const char *buf, size_t len) rdev->saved_raid_disk = slot; else rdev->saved_raid_disk = -1; + clear_bit(In_sync, &rdev->flags); err = rdev->mddev->pers-> hot_add_disk(rdev->mddev, rdev); if (err) { -- cgit v1.2.2 From d70ed2e4fafdbef0800e73942482bb075c21578b Mon Sep 17 00:00:00 2001 From: Andrei Warkentin Date: Tue, 18 Oct 2011 12:16:48 +1100 Subject: MD: Allow restarting an interrupted incremental recovery. If an incremental recovery was interrupted, a subsequent re-add will result in a full recovery, even though an incremental should be possible (seen with raid1). Solve this problem by not updating the superblock on the recovering device until array is not degraded any longer. Cc: Neil Brown Signed-off-by: Andrei Warkentin Signed-off-by: NeilBrown --- drivers/md/md.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 0ea34858637a..e8d198da917c 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -2449,7 +2449,8 @@ repeat: if (rdev->sb_loaded != 1) continue; /* no noise on spare devices */ - if (!test_bit(Faulty, &rdev->flags)) { + if (!test_bit(Faulty, &rdev->flags) && + rdev->saved_raid_disk == -1) { md_super_write(mddev,rdev, rdev->sb_start, rdev->sb_size, rdev->sb_page); @@ -2465,9 +2466,12 @@ repeat: rdev->badblocks.size = 0; } - } else + } else if (test_bit(Faulty, &rdev->flags)) pr_debug("md: %s (skipping faulty)\n", bdevname(rdev->bdev, b)); + else + pr_debug("(skipping incremental s/r "); + if (mddev->level == LEVEL_MULTIPATH) /* only need to write one superblock... */ break; @@ -7366,15 +7370,19 @@ static void reap_sync_thread(struct mddev *mddev) if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery) && mddev->pers->finish_reshape) mddev->pers->finish_reshape(mddev); - md_update_sb(mddev, 1); - /* if array is no-longer degraded, then any saved_raid_disk - * information must be scrapped + /* If array is no-longer degraded, then any saved_raid_disk + * information must be scrapped. Also if any device is now + * In_sync we must scrape the saved_raid_disk for that device + * do the superblock for an incrementally recovered device + * written out. */ - if (!mddev->degraded) - list_for_each_entry(rdev, &mddev->disks, same_set) + list_for_each_entry(rdev, &mddev->disks, same_set) + if (!mddev->degraded || + test_bit(In_sync, &rdev->flags)) rdev->saved_raid_disk = -1; + md_update_sb(mddev, 1); clear_bit(MD_RECOVERY_RUNNING, &mddev->recovery); clear_bit(MD_RECOVERY_SYNC, &mddev->recovery); clear_bit(MD_RECOVERY_RESHAPE, &mddev->recovery); -- cgit v1.2.2 From 751e67ca2e2790e9b9b187557d5ba6f96b6c4a7e Mon Sep 17 00:00:00 2001 From: Chris Dunlop Date: Wed, 19 Oct 2011 16:48:26 +1100 Subject: md.c: trivial comment fix Trivial comment fix Signed-off-by: Chris Dunlop Signed-off-by: NeilBrown --- drivers/md/md.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index e8d198da917c..266e82ebaf11 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -741,8 +741,8 @@ static void mddev_unlock(struct mddev * mddev) } else mutex_unlock(&mddev->reconfig_mutex); - /* was we've dropped the mutex we need a spinlock to - * make sur the thread doesn't disappear + /* As we've dropped the mutex we need a spinlock to + * make sure the thread doesn't disappear */ spin_lock(&pers_lock); md_wakeup_thread(mddev->thread); -- cgit v1.2.2 From bd860c53d4f9cad520d233e1ba690aaacfb39e9b Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 17 Oct 2011 15:29:08 -0500 Subject: lib/raid6: Fix filename emitted in generated code The files were renamed in commit cc4589ebf; fix the name in the file itself. Signed-off-by: Dan McGee Signed-off-by: NeilBrown --- lib/raid6/int.uc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/raid6/int.uc b/lib/raid6/int.uc index d1e276a14fab..5b50f8dfc5d2 100644 --- a/lib/raid6/int.uc +++ b/lib/raid6/int.uc @@ -11,7 +11,7 @@ * ----------------------------------------------------------------------- */ /* - * raid6int$#.c + * int$#.c * * $#-way unrolled portable integer math RAID-6 instruction set * -- cgit v1.2.2 From 355840e7a7e56bb2834fd3b0da64da5465f8aeaa Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 26 Oct 2011 10:31:04 +1100 Subject: md/raid5: fix bug that could result in reads from a failed device. This bug was introduced in 415e72d034c50520ddb7ff79e7d1792c1306f0c9 which was in 2.6.36. There is a small window of time between when a device fails and when it is removed from the array. During this time we might still read from it, but we won't write to it - so it is possible that we could read stale data. We didn't need the test of 'Faulty' before because the test on In_sync is sufficient. Since we started allowing reads from the early part of non-In_sync devices we need a test on Faulty too. This is suitable for any kernel from 2.6.36 onwards, though the patch might need a bit of tweaking in 3.0 and earlier. Cc: stable@kernel.org Signed-off-by: NeilBrown --- drivers/md/raid5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index eea9379f7fae..521bf2605f82 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -3062,7 +3062,7 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) } } else if (test_bit(In_sync, &rdev->flags)) set_bit(R5_Insync, &dev->flags); - else { + else if (!test_bit(Faulty, &rdev->flags)) { /* in sync if before recovery_offset */ if (sh->sector + STRIPE_SECTORS <= rdev->recovery_offset) set_bit(R5_Insync, &dev->flags); -- cgit v1.2.2 From d890fa2b0586b6177b119643ff66932127d58afa Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 26 Oct 2011 11:54:39 +1100 Subject: md: Fix some bugs in recovery_disabled handling. In 3.0 we changed the way recovery_disabled was handle so that instead of testing against zero, we test an mddev-> value against a conf-> value. Two problems: 1/ one place in raid1 was missed and still sets to '1'. 2/ We didn't explicitly set the conf-> value at array creation time. It defaulted to '0' just like the mddev value does so they could appear equal and thus disable recovery. This did not affect normal 'md' as it calls bind_rdev_to_array which changes the mddev value. However the dmraid interface doesn't call this and so doesn't change ->recovery_disabled; so at array start all recovery is incorrectly disabled. So initialise the 'conf' value to one less that the mddev value, so the will only be the same when explicitly set that way. Reported-by: Jonathan Brassow Signed-off-by: NeilBrown --- drivers/md/raid1.c | 4 +++- drivers/md/raid10.c | 2 ++ drivers/md/raid5.c | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index d8957d74fd25..4602fc57c961 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1519,7 +1519,8 @@ static int fix_sync_read_error(struct r1bio *r1_bio) abort = 1; } if (abort) { - mddev->recovery_disabled = 1; + conf->recovery_disabled = + mddev->recovery_disabled; set_bit(MD_RECOVERY_INTR, &mddev->recovery); md_done_sync(mddev, r1_bio->sectors, 0); put_buf(r1_bio); @@ -2436,6 +2437,7 @@ static struct r1conf *setup_conf(struct mddev *mddev) bio_list_init(&conf->pending_bio_list); conf->pending_count = 0; + conf->recovery_disabled = mddev->recovery_disabled - 1; conf->last_used = -1; for (i = 0; i < conf->raid_disks; i++) { diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 9496463ca5df..132c18ef8665 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -1373,6 +1373,7 @@ static int raid10_add_disk(struct mddev *mddev, struct md_rdev *rdev) } p->head_position = 0; + p->recovery_disabled = mddev->recovery_disabled - 1; rdev->raid_disk = mirror; err = 0; if (rdev->saved_raid_disk != mirror) @@ -2931,6 +2932,7 @@ static int run(struct mddev *mddev) if (disk->rdev) conf->fullsync = 1; } + disk->recovery_disabled = mddev->recovery_disabled - 1; } if (mddev->recovery_cp != MaxSector) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 521bf2605f82..f6fe053a5bed 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -4591,6 +4591,7 @@ static struct r5conf *setup_conf(struct mddev *mddev) atomic_set(&conf->preread_active_stripes, 0); atomic_set(&conf->active_aligned_reads, 0); conf->bypass_threshold = BYPASS_THRESHOLD; + conf->recovery_disabled = mddev->recovery_disabled - 1; conf->raid_disks = mddev->raid_disks; if (mddev->reshape_position == MaxSector) -- cgit v1.2.2