aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c360
1 files changed, 180 insertions, 180 deletions
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;
95 95
96static int sysctl_speed_limit_min = 1000; 96static int sysctl_speed_limit_min = 1000;
97static int sysctl_speed_limit_max = 200000; 97static int sysctl_speed_limit_max = 200000;
98static inline int speed_min(mddev_t *mddev) 98static inline int speed_min(struct mddev *mddev)
99{ 99{
100 return mddev->sync_speed_min ? 100 return mddev->sync_speed_min ?
101 mddev->sync_speed_min : sysctl_speed_limit_min; 101 mddev->sync_speed_min : sysctl_speed_limit_min;
102} 102}
103 103
104static inline int speed_max(mddev_t *mddev) 104static inline int speed_max(struct mddev *mddev)
105{ 105{
106 return mddev->sync_speed_max ? 106 return mddev->sync_speed_max ?
107 mddev->sync_speed_max : sysctl_speed_limit_max; 107 mddev->sync_speed_max : sysctl_speed_limit_max;
@@ -157,7 +157,7 @@ static int start_readonly;
157 157
158static void mddev_bio_destructor(struct bio *bio) 158static void mddev_bio_destructor(struct bio *bio)
159{ 159{
160 mddev_t *mddev, **mddevp; 160 struct mddev *mddev, **mddevp;
161 161
162 mddevp = (void*)bio; 162 mddevp = (void*)bio;
163 mddev = mddevp[-1]; 163 mddev = mddevp[-1];
@@ -166,10 +166,10 @@ static void mddev_bio_destructor(struct bio *bio)
166} 166}
167 167
168struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, 168struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs,
169 mddev_t *mddev) 169 struct mddev *mddev)
170{ 170{
171 struct bio *b; 171 struct bio *b;
172 mddev_t **mddevp; 172 struct mddev **mddevp;
173 173
174 if (!mddev || !mddev->bio_set) 174 if (!mddev || !mddev->bio_set)
175 return bio_alloc(gfp_mask, nr_iovecs); 175 return bio_alloc(gfp_mask, nr_iovecs);
@@ -186,10 +186,10 @@ struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs,
186EXPORT_SYMBOL_GPL(bio_alloc_mddev); 186EXPORT_SYMBOL_GPL(bio_alloc_mddev);
187 187
188struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask, 188struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask,
189 mddev_t *mddev) 189 struct mddev *mddev)
190{ 190{
191 struct bio *b; 191 struct bio *b;
192 mddev_t **mddevp; 192 struct mddev **mddevp;
193 193
194 if (!mddev || !mddev->bio_set) 194 if (!mddev || !mddev->bio_set)
195 return bio_clone(bio, gfp_mask); 195 return bio_clone(bio, gfp_mask);
@@ -278,7 +278,7 @@ EXPORT_SYMBOL_GPL(md_trim_bio);
278 */ 278 */
279static DECLARE_WAIT_QUEUE_HEAD(md_event_waiters); 279static DECLARE_WAIT_QUEUE_HEAD(md_event_waiters);
280static atomic_t md_event_count; 280static atomic_t md_event_count;
281void md_new_event(mddev_t *mddev) 281void md_new_event(struct mddev *mddev)
282{ 282{
283 atomic_inc(&md_event_count); 283 atomic_inc(&md_event_count);
284 wake_up(&md_event_waiters); 284 wake_up(&md_event_waiters);
@@ -288,7 +288,7 @@ EXPORT_SYMBOL_GPL(md_new_event);
288/* Alternate version that can be called from interrupts 288/* Alternate version that can be called from interrupts
289 * when calling sysfs_notify isn't needed. 289 * when calling sysfs_notify isn't needed.
290 */ 290 */
291static void md_new_event_inintr(mddev_t *mddev) 291static void md_new_event_inintr(struct mddev *mddev)
292{ 292{
293 atomic_inc(&md_event_count); 293 atomic_inc(&md_event_count);
294 wake_up(&md_event_waiters); 294 wake_up(&md_event_waiters);
@@ -309,19 +309,19 @@ static DEFINE_SPINLOCK(all_mddevs_lock);
309 * Any code which breaks out of this loop while own 309 * Any code which breaks out of this loop while own
310 * a reference to the current mddev and must mddev_put it. 310 * a reference to the current mddev and must mddev_put it.
311 */ 311 */
312#define for_each_mddev(mddev,tmp) \ 312#define for_each_mddev(_mddev,_tmp) \
313 \ 313 \
314 for (({ spin_lock(&all_mddevs_lock); \ 314 for (({ spin_lock(&all_mddevs_lock); \
315 tmp = all_mddevs.next; \ 315 _tmp = all_mddevs.next; \
316 mddev = NULL;}); \ 316 _mddev = NULL;}); \
317 ({ if (tmp != &all_mddevs) \ 317 ({ if (_tmp != &all_mddevs) \
318 mddev_get(list_entry(tmp, mddev_t, all_mddevs));\ 318 mddev_get(list_entry(_tmp, struct mddev, all_mddevs));\
319 spin_unlock(&all_mddevs_lock); \ 319 spin_unlock(&all_mddevs_lock); \
320 if (mddev) mddev_put(mddev); \ 320 if (_mddev) mddev_put(_mddev); \
321 mddev = list_entry(tmp, mddev_t, all_mddevs); \ 321 _mddev = list_entry(_tmp, struct mddev, all_mddevs); \
322 tmp != &all_mddevs;}); \ 322 _tmp != &all_mddevs;}); \
323 ({ spin_lock(&all_mddevs_lock); \ 323 ({ spin_lock(&all_mddevs_lock); \
324 tmp = tmp->next;}) \ 324 _tmp = _tmp->next;}) \
325 ) 325 )
326 326
327 327
@@ -335,7 +335,7 @@ static DEFINE_SPINLOCK(all_mddevs_lock);
335static int md_make_request(struct request_queue *q, struct bio *bio) 335static int md_make_request(struct request_queue *q, struct bio *bio)
336{ 336{
337 const int rw = bio_data_dir(bio); 337 const int rw = bio_data_dir(bio);
338 mddev_t *mddev = q->queuedata; 338 struct mddev *mddev = q->queuedata;
339 int rv; 339 int rv;
340 int cpu; 340 int cpu;
341 unsigned int sectors; 341 unsigned int sectors;
@@ -387,7 +387,7 @@ static int md_make_request(struct request_queue *q, struct bio *bio)
387 * Once ->stop is called and completes, the module will be completely 387 * Once ->stop is called and completes, the module will be completely
388 * unused. 388 * unused.
389 */ 389 */
390void mddev_suspend(mddev_t *mddev) 390void mddev_suspend(struct mddev *mddev)
391{ 391{
392 BUG_ON(mddev->suspended); 392 BUG_ON(mddev->suspended);
393 mddev->suspended = 1; 393 mddev->suspended = 1;
@@ -397,7 +397,7 @@ void mddev_suspend(mddev_t *mddev)
397} 397}
398EXPORT_SYMBOL_GPL(mddev_suspend); 398EXPORT_SYMBOL_GPL(mddev_suspend);
399 399
400void mddev_resume(mddev_t *mddev) 400void mddev_resume(struct mddev *mddev)
401{ 401{
402 mddev->suspended = 0; 402 mddev->suspended = 0;
403 wake_up(&mddev->sb_wait); 403 wake_up(&mddev->sb_wait);
@@ -408,7 +408,7 @@ void mddev_resume(mddev_t *mddev)
408} 408}
409EXPORT_SYMBOL_GPL(mddev_resume); 409EXPORT_SYMBOL_GPL(mddev_resume);
410 410
411int mddev_congested(mddev_t *mddev, int bits) 411int mddev_congested(struct mddev *mddev, int bits)
412{ 412{
413 return mddev->suspended; 413 return mddev->suspended;
414} 414}
@@ -421,7 +421,7 @@ EXPORT_SYMBOL(mddev_congested);
421static void md_end_flush(struct bio *bio, int err) 421static void md_end_flush(struct bio *bio, int err)
422{ 422{
423 struct md_rdev *rdev = bio->bi_private; 423 struct md_rdev *rdev = bio->bi_private;
424 mddev_t *mddev = rdev->mddev; 424 struct mddev *mddev = rdev->mddev;
425 425
426 rdev_dec_pending(rdev, mddev); 426 rdev_dec_pending(rdev, mddev);
427 427
@@ -436,7 +436,7 @@ static void md_submit_flush_data(struct work_struct *ws);
436 436
437static void submit_flushes(struct work_struct *ws) 437static void submit_flushes(struct work_struct *ws)
438{ 438{
439 mddev_t *mddev = container_of(ws, mddev_t, flush_work); 439 struct mddev *mddev = container_of(ws, struct mddev, flush_work);
440 struct md_rdev *rdev; 440 struct md_rdev *rdev;
441 441
442 INIT_WORK(&mddev->flush_work, md_submit_flush_data); 442 INIT_WORK(&mddev->flush_work, md_submit_flush_data);
@@ -469,7 +469,7 @@ static void submit_flushes(struct work_struct *ws)
469 469
470static void md_submit_flush_data(struct work_struct *ws) 470static void md_submit_flush_data(struct work_struct *ws)
471{ 471{
472 mddev_t *mddev = container_of(ws, mddev_t, flush_work); 472 struct mddev *mddev = container_of(ws, struct mddev, flush_work);
473 struct bio *bio = mddev->flush_bio; 473 struct bio *bio = mddev->flush_bio;
474 474
475 if (bio->bi_size == 0) 475 if (bio->bi_size == 0)
@@ -485,7 +485,7 @@ static void md_submit_flush_data(struct work_struct *ws)
485 wake_up(&mddev->sb_wait); 485 wake_up(&mddev->sb_wait);
486} 486}
487 487
488void md_flush_request(mddev_t *mddev, struct bio *bio) 488void md_flush_request(struct mddev *mddev, struct bio *bio)
489{ 489{
490 spin_lock_irq(&mddev->write_lock); 490 spin_lock_irq(&mddev->write_lock);
491 wait_event_lock_irq(mddev->sb_wait, 491 wait_event_lock_irq(mddev->sb_wait,
@@ -509,7 +509,7 @@ EXPORT_SYMBOL(md_flush_request);
509 */ 509 */
510struct md_plug_cb { 510struct md_plug_cb {
511 struct blk_plug_cb cb; 511 struct blk_plug_cb cb;
512 mddev_t *mddev; 512 struct mddev *mddev;
513}; 513};
514 514
515static void plugger_unplug(struct blk_plug_cb *cb) 515static void plugger_unplug(struct blk_plug_cb *cb)
@@ -523,7 +523,7 @@ static void plugger_unplug(struct blk_plug_cb *cb)
523/* Check that an unplug wakeup will come shortly. 523/* Check that an unplug wakeup will come shortly.
524 * If not, wakeup the md thread immediately 524 * If not, wakeup the md thread immediately
525 */ 525 */
526int mddev_check_plugged(mddev_t *mddev) 526int mddev_check_plugged(struct mddev *mddev)
527{ 527{
528 struct blk_plug *plug = current->plug; 528 struct blk_plug *plug = current->plug;
529 struct md_plug_cb *mdcb; 529 struct md_plug_cb *mdcb;
@@ -555,7 +555,7 @@ int mddev_check_plugged(mddev_t *mddev)
555} 555}
556EXPORT_SYMBOL_GPL(mddev_check_plugged); 556EXPORT_SYMBOL_GPL(mddev_check_plugged);
557 557
558static inline mddev_t *mddev_get(mddev_t *mddev) 558static inline struct mddev *mddev_get(struct mddev *mddev)
559{ 559{
560 atomic_inc(&mddev->active); 560 atomic_inc(&mddev->active);
561 return mddev; 561 return mddev;
@@ -563,7 +563,7 @@ static inline mddev_t *mddev_get(mddev_t *mddev)
563 563
564static void mddev_delayed_delete(struct work_struct *ws); 564static void mddev_delayed_delete(struct work_struct *ws);
565 565
566static void mddev_put(mddev_t *mddev) 566static void mddev_put(struct mddev *mddev)
567{ 567{
568 struct bio_set *bs = NULL; 568 struct bio_set *bs = NULL;
569 569
@@ -592,7 +592,7 @@ static void mddev_put(mddev_t *mddev)
592 bioset_free(bs); 592 bioset_free(bs);
593} 593}
594 594
595void mddev_init(mddev_t *mddev) 595void mddev_init(struct mddev *mddev)
596{ 596{
597 mutex_init(&mddev->open_mutex); 597 mutex_init(&mddev->open_mutex);
598 mutex_init(&mddev->reconfig_mutex); 598 mutex_init(&mddev->reconfig_mutex);
@@ -615,9 +615,9 @@ void mddev_init(mddev_t *mddev)
615} 615}
616EXPORT_SYMBOL_GPL(mddev_init); 616EXPORT_SYMBOL_GPL(mddev_init);
617 617
618static mddev_t * mddev_find(dev_t unit) 618static struct mddev * mddev_find(dev_t unit)
619{ 619{
620 mddev_t *mddev, *new = NULL; 620 struct mddev *mddev, *new = NULL;
621 621
622 if (unit && MAJOR(unit) != MD_MAJOR) 622 if (unit && MAJOR(unit) != MD_MAJOR)
623 unit &= ~((1<<MdpMinorShift)-1); 623 unit &= ~((1<<MdpMinorShift)-1);
@@ -689,24 +689,24 @@ static mddev_t * mddev_find(dev_t unit)
689 goto retry; 689 goto retry;
690} 690}
691 691
692static inline int mddev_lock(mddev_t * mddev) 692static inline int mddev_lock(struct mddev * mddev)
693{ 693{
694 return mutex_lock_interruptible(&mddev->reconfig_mutex); 694 return mutex_lock_interruptible(&mddev->reconfig_mutex);
695} 695}
696 696
697static inline int mddev_is_locked(mddev_t *mddev) 697static inline int mddev_is_locked(struct mddev *mddev)
698{ 698{
699 return mutex_is_locked(&mddev->reconfig_mutex); 699 return mutex_is_locked(&mddev->reconfig_mutex);
700} 700}
701 701
702static inline int mddev_trylock(mddev_t * mddev) 702static inline int mddev_trylock(struct mddev * mddev)
703{ 703{
704 return mutex_trylock(&mddev->reconfig_mutex); 704 return mutex_trylock(&mddev->reconfig_mutex);
705} 705}
706 706
707static struct attribute_group md_redundancy_group; 707static struct attribute_group md_redundancy_group;
708 708
709static void mddev_unlock(mddev_t * mddev) 709static void mddev_unlock(struct mddev * mddev)
710{ 710{
711 if (mddev->to_remove) { 711 if (mddev->to_remove) {
712 /* These cannot be removed under reconfig_mutex as 712 /* These cannot be removed under reconfig_mutex as
@@ -749,7 +749,7 @@ static void mddev_unlock(mddev_t * mddev)
749 spin_unlock(&pers_lock); 749 spin_unlock(&pers_lock);
750} 750}
751 751
752static struct md_rdev * find_rdev_nr(mddev_t *mddev, int nr) 752static struct md_rdev * find_rdev_nr(struct mddev *mddev, int nr)
753{ 753{
754 struct md_rdev *rdev; 754 struct md_rdev *rdev;
755 755
@@ -760,7 +760,7 @@ static struct md_rdev * find_rdev_nr(mddev_t *mddev, int nr)
760 return NULL; 760 return NULL;
761} 761}
762 762
763static struct md_rdev * find_rdev(mddev_t * mddev, dev_t dev) 763static struct md_rdev * find_rdev(struct mddev * mddev, dev_t dev)
764{ 764{
765 struct md_rdev *rdev; 765 struct md_rdev *rdev;
766 766
@@ -823,7 +823,7 @@ static void free_disk_sb(struct md_rdev * rdev)
823static void super_written(struct bio *bio, int error) 823static void super_written(struct bio *bio, int error)
824{ 824{
825 struct md_rdev *rdev = bio->bi_private; 825 struct md_rdev *rdev = bio->bi_private;
826 mddev_t *mddev = rdev->mddev; 826 struct mddev *mddev = rdev->mddev;
827 827
828 if (error || !test_bit(BIO_UPTODATE, &bio->bi_flags)) { 828 if (error || !test_bit(BIO_UPTODATE, &bio->bi_flags)) {
829 printk("md: super_written gets error=%d, uptodate=%d\n", 829 printk("md: super_written gets error=%d, uptodate=%d\n",
@@ -837,7 +837,7 @@ static void super_written(struct bio *bio, int error)
837 bio_put(bio); 837 bio_put(bio);
838} 838}
839 839
840void md_super_write(mddev_t *mddev, struct md_rdev *rdev, 840void md_super_write(struct mddev *mddev, struct md_rdev *rdev,
841 sector_t sector, int size, struct page *page) 841 sector_t sector, int size, struct page *page)
842{ 842{
843 /* write first size bytes of page to sector of rdev 843 /* 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,
858 submit_bio(WRITE_FLUSH_FUA, bio); 858 submit_bio(WRITE_FLUSH_FUA, bio);
859} 859}
860 860
861void md_super_wait(mddev_t *mddev) 861void md_super_wait(struct mddev *mddev)
862{ 862{
863 /* wait for all superblock writes that were scheduled to complete */ 863 /* wait for all superblock writes that were scheduled to complete */
864 DEFINE_WAIT(wq); 864 DEFINE_WAIT(wq);
@@ -1021,13 +1021,13 @@ static unsigned int calc_sb_csum(mdp_super_t * sb)
1021 * -EINVAL superblock incompatible or invalid 1021 * -EINVAL superblock incompatible or invalid
1022 * -othererror e.g. -EIO 1022 * -othererror e.g. -EIO
1023 * 1023 *
1024 * int validate_super(mddev_t *mddev, struct md_rdev *dev) 1024 * int validate_super(struct mddev *mddev, struct md_rdev *dev)
1025 * Verify that dev is acceptable into mddev. 1025 * Verify that dev is acceptable into mddev.
1026 * The first time, mddev->raid_disks will be 0, and data from 1026 * The first time, mddev->raid_disks will be 0, and data from
1027 * dev should be merged in. Subsequent calls check that dev 1027 * dev should be merged in. Subsequent calls check that dev
1028 * is new enough. Return 0 or -EINVAL 1028 * is new enough. Return 0 or -EINVAL
1029 * 1029 *
1030 * void sync_super(mddev_t *mddev, struct md_rdev *dev) 1030 * void sync_super(struct mddev *mddev, struct md_rdev *dev)
1031 * Update the superblock for rdev with data in mddev 1031 * Update the superblock for rdev with data in mddev
1032 * This does not write to disc. 1032 * This does not write to disc.
1033 * 1033 *
@@ -1038,8 +1038,8 @@ struct super_type {
1038 struct module *owner; 1038 struct module *owner;
1039 int (*load_super)(struct md_rdev *rdev, struct md_rdev *refdev, 1039 int (*load_super)(struct md_rdev *rdev, struct md_rdev *refdev,
1040 int minor_version); 1040 int minor_version);
1041 int (*validate_super)(mddev_t *mddev, struct md_rdev *rdev); 1041 int (*validate_super)(struct mddev *mddev, struct md_rdev *rdev);
1042 void (*sync_super)(mddev_t *mddev, struct md_rdev *rdev); 1042 void (*sync_super)(struct mddev *mddev, struct md_rdev *rdev);
1043 unsigned long long (*rdev_size_change)(struct md_rdev *rdev, 1043 unsigned long long (*rdev_size_change)(struct md_rdev *rdev,
1044 sector_t num_sectors); 1044 sector_t num_sectors);
1045}; 1045};
@@ -1052,7 +1052,7 @@ struct super_type {
1052 * has a bitmap. Otherwise, it returns 0. 1052 * has a bitmap. Otherwise, it returns 0.
1053 * 1053 *
1054 */ 1054 */
1055int md_check_no_bitmap(mddev_t *mddev) 1055int md_check_no_bitmap(struct mddev *mddev)
1056{ 1056{
1057 if (!mddev->bitmap_info.file && !mddev->bitmap_info.offset) 1057 if (!mddev->bitmap_info.file && !mddev->bitmap_info.offset)
1058 return 0; 1058 return 0;
@@ -1160,7 +1160,7 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor
1160/* 1160/*
1161 * validate_super for 0.90.0 1161 * validate_super for 0.90.0
1162 */ 1162 */
1163static int super_90_validate(mddev_t *mddev, struct md_rdev *rdev) 1163static int super_90_validate(struct mddev *mddev, struct md_rdev *rdev)
1164{ 1164{
1165 mdp_disk_t *desc; 1165 mdp_disk_t *desc;
1166 mdp_super_t *sb = page_address(rdev->sb_page); 1166 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)
1272/* 1272/*
1273 * sync_super for 0.90.0 1273 * sync_super for 0.90.0
1274 */ 1274 */
1275static void super_90_sync(mddev_t *mddev, struct md_rdev *rdev) 1275static void super_90_sync(struct mddev *mddev, struct md_rdev *rdev)
1276{ 1276{
1277 mdp_super_t *sb; 1277 mdp_super_t *sb;
1278 struct md_rdev *rdev2; 1278 struct md_rdev *rdev2;
@@ -1622,7 +1622,7 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_
1622 return ret; 1622 return ret;
1623} 1623}
1624 1624
1625static int super_1_validate(mddev_t *mddev, struct md_rdev *rdev) 1625static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev)
1626{ 1626{
1627 struct mdp_superblock_1 *sb = page_address(rdev->sb_page); 1627 struct mdp_superblock_1 *sb = page_address(rdev->sb_page);
1628 __u64 ev1 = le64_to_cpu(sb->events); 1628 __u64 ev1 = le64_to_cpu(sb->events);
@@ -1723,7 +1723,7 @@ static int super_1_validate(mddev_t *mddev, struct md_rdev *rdev)
1723 return 0; 1723 return 0;
1724} 1724}
1725 1725
1726static void super_1_sync(mddev_t *mddev, struct md_rdev *rdev) 1726static void super_1_sync(struct mddev *mddev, struct md_rdev *rdev)
1727{ 1727{
1728 struct mdp_superblock_1 *sb; 1728 struct mdp_superblock_1 *sb;
1729 struct md_rdev *rdev2; 1729 struct md_rdev *rdev2;
@@ -1902,7 +1902,7 @@ static struct super_type super_types[] = {
1902 }, 1902 },
1903}; 1903};
1904 1904
1905static void sync_super(mddev_t *mddev, struct md_rdev *rdev) 1905static void sync_super(struct mddev *mddev, struct md_rdev *rdev)
1906{ 1906{
1907 if (mddev->sync_super) { 1907 if (mddev->sync_super) {
1908 mddev->sync_super(mddev, rdev); 1908 mddev->sync_super(mddev, rdev);
@@ -1914,7 +1914,7 @@ static void sync_super(mddev_t *mddev, struct md_rdev *rdev)
1914 super_types[mddev->major_version].sync_super(mddev, rdev); 1914 super_types[mddev->major_version].sync_super(mddev, rdev);
1915} 1915}
1916 1916
1917static int match_mddev_units(mddev_t *mddev1, mddev_t *mddev2) 1917static int match_mddev_units(struct mddev *mddev1, struct mddev *mddev2)
1918{ 1918{
1919 struct md_rdev *rdev, *rdev2; 1919 struct md_rdev *rdev, *rdev2;
1920 1920
@@ -1939,7 +1939,7 @@ static LIST_HEAD(pending_raid_disks);
1939 * from the array. It only succeeds if all working and active component devices 1939 * from the array. It only succeeds if all working and active component devices
1940 * are integrity capable with matching profiles. 1940 * are integrity capable with matching profiles.
1941 */ 1941 */
1942int md_integrity_register(mddev_t *mddev) 1942int md_integrity_register(struct mddev *mddev)
1943{ 1943{
1944 struct md_rdev *rdev, *reference = NULL; 1944 struct md_rdev *rdev, *reference = NULL;
1945 1945
@@ -1986,7 +1986,7 @@ int md_integrity_register(mddev_t *mddev)
1986EXPORT_SYMBOL(md_integrity_register); 1986EXPORT_SYMBOL(md_integrity_register);
1987 1987
1988/* Disable data integrity if non-capable/non-matching disk is being added */ 1988/* Disable data integrity if non-capable/non-matching disk is being added */
1989void md_integrity_add_rdev(struct md_rdev *rdev, mddev_t *mddev) 1989void md_integrity_add_rdev(struct md_rdev *rdev, struct mddev *mddev)
1990{ 1990{
1991 struct blk_integrity *bi_rdev = bdev_get_integrity(rdev->bdev); 1991 struct blk_integrity *bi_rdev = bdev_get_integrity(rdev->bdev);
1992 struct blk_integrity *bi_mddev = blk_get_integrity(mddev->gendisk); 1992 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)
2003} 2003}
2004EXPORT_SYMBOL(md_integrity_add_rdev); 2004EXPORT_SYMBOL(md_integrity_add_rdev);
2005 2005
2006static int bind_rdev_to_array(struct md_rdev * rdev, mddev_t * mddev) 2006static int bind_rdev_to_array(struct md_rdev * rdev, struct mddev * mddev)
2007{ 2007{
2008 char b[BDEVNAME_SIZE]; 2008 char b[BDEVNAME_SIZE];
2009 struct kobject *ko; 2009 struct kobject *ko;
@@ -2170,7 +2170,7 @@ static void kick_rdev_from_array(struct md_rdev * rdev)
2170 export_rdev(rdev); 2170 export_rdev(rdev);
2171} 2171}
2172 2172
2173static void export_array(mddev_t *mddev) 2173static void export_array(struct mddev *mddev)
2174{ 2174{
2175 struct md_rdev *rdev, *tmp; 2175 struct md_rdev *rdev, *tmp;
2176 2176
@@ -2293,7 +2293,7 @@ static void md_print_devices(void)
2293{ 2293{
2294 struct list_head *tmp; 2294 struct list_head *tmp;
2295 struct md_rdev *rdev; 2295 struct md_rdev *rdev;
2296 mddev_t *mddev; 2296 struct mddev *mddev;
2297 char b[BDEVNAME_SIZE]; 2297 char b[BDEVNAME_SIZE];
2298 2298
2299 printk("\n"); 2299 printk("\n");
@@ -2318,7 +2318,7 @@ static void md_print_devices(void)
2318} 2318}
2319 2319
2320 2320
2321static void sync_sbs(mddev_t * mddev, int nospares) 2321static void sync_sbs(struct mddev * mddev, int nospares)
2322{ 2322{
2323 /* Update each superblock (in-memory image), but 2323 /* Update each superblock (in-memory image), but
2324 * if we are allowed to, skip spares which already 2324 * if we are allowed to, skip spares which already
@@ -2341,7 +2341,7 @@ static void sync_sbs(mddev_t * mddev, int nospares)
2341 } 2341 }
2342} 2342}
2343 2343
2344static void md_update_sb(mddev_t * mddev, int force_change) 2344static void md_update_sb(struct mddev * mddev, int force_change)
2345{ 2345{
2346 struct md_rdev *rdev; 2346 struct md_rdev *rdev;
2347 int sync_req; 2347 int sync_req;
@@ -2586,7 +2586,7 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)
2586 if (rdev->raid_disk >= 0) 2586 if (rdev->raid_disk >= 0)
2587 err = -EBUSY; 2587 err = -EBUSY;
2588 else { 2588 else {
2589 mddev_t *mddev = rdev->mddev; 2589 struct mddev *mddev = rdev->mddev;
2590 kick_rdev_from_array(rdev); 2590 kick_rdev_from_array(rdev);
2591 if (mddev->pers) 2591 if (mddev->pers)
2592 md_update_sb(mddev, 1); 2592 md_update_sb(mddev, 1);
@@ -2814,7 +2814,7 @@ static int strict_blocks_to_sectors(const char *buf, sector_t *sectors)
2814static ssize_t 2814static ssize_t
2815rdev_size_store(struct md_rdev *rdev, const char *buf, size_t len) 2815rdev_size_store(struct md_rdev *rdev, const char *buf, size_t len)
2816{ 2816{
2817 mddev_t *my_mddev = rdev->mddev; 2817 struct mddev *my_mddev = rdev->mddev;
2818 sector_t oldsectors = rdev->sectors; 2818 sector_t oldsectors = rdev->sectors;
2819 sector_t sectors; 2819 sector_t sectors;
2820 2820
@@ -2840,7 +2840,7 @@ rdev_size_store(struct md_rdev *rdev, const char *buf, size_t len)
2840 * a deadlock. We have already changed rdev->sectors, and if 2840 * a deadlock. We have already changed rdev->sectors, and if
2841 * we have to change it back, we will have the lock again. 2841 * we have to change it back, we will have the lock again.
2842 */ 2842 */
2843 mddev_t *mddev; 2843 struct mddev *mddev;
2844 int overlap = 0; 2844 int overlap = 0;
2845 struct list_head *tmp; 2845 struct list_head *tmp;
2846 2846
@@ -2967,7 +2967,7 @@ rdev_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
2967{ 2967{
2968 struct rdev_sysfs_entry *entry = container_of(attr, struct rdev_sysfs_entry, attr); 2968 struct rdev_sysfs_entry *entry = container_of(attr, struct rdev_sysfs_entry, attr);
2969 struct md_rdev *rdev = container_of(kobj, struct md_rdev, kobj); 2969 struct md_rdev *rdev = container_of(kobj, struct md_rdev, kobj);
2970 mddev_t *mddev = rdev->mddev; 2970 struct mddev *mddev = rdev->mddev;
2971 ssize_t rv; 2971 ssize_t rv;
2972 2972
2973 if (!entry->show) 2973 if (!entry->show)
@@ -2991,7 +2991,7 @@ rdev_attr_store(struct kobject *kobj, struct attribute *attr,
2991 struct rdev_sysfs_entry *entry = container_of(attr, struct rdev_sysfs_entry, attr); 2991 struct rdev_sysfs_entry *entry = container_of(attr, struct rdev_sysfs_entry, attr);
2992 struct md_rdev *rdev = container_of(kobj, struct md_rdev, kobj); 2992 struct md_rdev *rdev = container_of(kobj, struct md_rdev, kobj);
2993 ssize_t rv; 2993 ssize_t rv;
2994 mddev_t *mddev = rdev->mddev; 2994 struct mddev *mddev = rdev->mddev;
2995 2995
2996 if (!entry->store) 2996 if (!entry->store)
2997 return -EIO; 2997 return -EIO;
@@ -3139,7 +3139,7 @@ abort_free:
3139 */ 3139 */
3140 3140
3141 3141
3142static void analyze_sbs(mddev_t * mddev) 3142static void analyze_sbs(struct mddev * mddev)
3143{ 3143{
3144 int i; 3144 int i;
3145 struct md_rdev *rdev, *freshest, *tmp; 3145 struct md_rdev *rdev, *freshest, *tmp;
@@ -3242,13 +3242,13 @@ int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale)
3242static void md_safemode_timeout(unsigned long data); 3242static void md_safemode_timeout(unsigned long data);
3243 3243
3244static ssize_t 3244static ssize_t
3245safe_delay_show(mddev_t *mddev, char *page) 3245safe_delay_show(struct mddev *mddev, char *page)
3246{ 3246{
3247 int msec = (mddev->safemode_delay*1000)/HZ; 3247 int msec = (mddev->safemode_delay*1000)/HZ;
3248 return sprintf(page, "%d.%03d\n", msec/1000, msec%1000); 3248 return sprintf(page, "%d.%03d\n", msec/1000, msec%1000);
3249} 3249}
3250static ssize_t 3250static ssize_t
3251safe_delay_store(mddev_t *mddev, const char *cbuf, size_t len) 3251safe_delay_store(struct mddev *mddev, const char *cbuf, size_t len)
3252{ 3252{
3253 unsigned long msec; 3253 unsigned long msec;
3254 3254
@@ -3270,7 +3270,7 @@ static struct md_sysfs_entry md_safe_delay =
3270__ATTR(safe_mode_delay, S_IRUGO|S_IWUSR,safe_delay_show, safe_delay_store); 3270__ATTR(safe_mode_delay, S_IRUGO|S_IWUSR,safe_delay_show, safe_delay_store);
3271 3271
3272static ssize_t 3272static ssize_t
3273level_show(mddev_t *mddev, char *page) 3273level_show(struct mddev *mddev, char *page)
3274{ 3274{
3275 struct mdk_personality *p = mddev->pers; 3275 struct mdk_personality *p = mddev->pers;
3276 if (p) 3276 if (p)
@@ -3284,7 +3284,7 @@ level_show(mddev_t *mddev, char *page)
3284} 3284}
3285 3285
3286static ssize_t 3286static ssize_t
3287level_store(mddev_t *mddev, const char *buf, size_t len) 3287level_store(struct mddev *mddev, const char *buf, size_t len)
3288{ 3288{
3289 char clevel[16]; 3289 char clevel[16];
3290 ssize_t rv = len; 3290 ssize_t rv = len;
@@ -3465,7 +3465,7 @@ __ATTR(level, S_IRUGO|S_IWUSR, level_show, level_store);
3465 3465
3466 3466
3467static ssize_t 3467static ssize_t
3468layout_show(mddev_t *mddev, char *page) 3468layout_show(struct mddev *mddev, char *page)
3469{ 3469{
3470 /* just a number, not meaningful for all levels */ 3470 /* just a number, not meaningful for all levels */
3471 if (mddev->reshape_position != MaxSector && 3471 if (mddev->reshape_position != MaxSector &&
@@ -3476,7 +3476,7 @@ layout_show(mddev_t *mddev, char *page)
3476} 3476}
3477 3477
3478static ssize_t 3478static ssize_t
3479layout_store(mddev_t *mddev, const char *buf, size_t len) 3479layout_store(struct mddev *mddev, const char *buf, size_t len)
3480{ 3480{
3481 char *e; 3481 char *e;
3482 unsigned long n = simple_strtoul(buf, &e, 10); 3482 unsigned long n = simple_strtoul(buf, &e, 10);
@@ -3506,7 +3506,7 @@ __ATTR(layout, S_IRUGO|S_IWUSR, layout_show, layout_store);
3506 3506
3507 3507
3508static ssize_t 3508static ssize_t
3509raid_disks_show(mddev_t *mddev, char *page) 3509raid_disks_show(struct mddev *mddev, char *page)
3510{ 3510{
3511 if (mddev->raid_disks == 0) 3511 if (mddev->raid_disks == 0)
3512 return 0; 3512 return 0;
@@ -3517,10 +3517,10 @@ raid_disks_show(mddev_t *mddev, char *page)
3517 return sprintf(page, "%d\n", mddev->raid_disks); 3517 return sprintf(page, "%d\n", mddev->raid_disks);
3518} 3518}
3519 3519
3520static int update_raid_disks(mddev_t *mddev, int raid_disks); 3520static int update_raid_disks(struct mddev *mddev, int raid_disks);
3521 3521
3522static ssize_t 3522static ssize_t
3523raid_disks_store(mddev_t *mddev, const char *buf, size_t len) 3523raid_disks_store(struct mddev *mddev, const char *buf, size_t len)
3524{ 3524{
3525 char *e; 3525 char *e;
3526 int rv = 0; 3526 int rv = 0;
@@ -3543,7 +3543,7 @@ static struct md_sysfs_entry md_raid_disks =
3543__ATTR(raid_disks, S_IRUGO|S_IWUSR, raid_disks_show, raid_disks_store); 3543__ATTR(raid_disks, S_IRUGO|S_IWUSR, raid_disks_show, raid_disks_store);
3544 3544
3545static ssize_t 3545static ssize_t
3546chunk_size_show(mddev_t *mddev, char *page) 3546chunk_size_show(struct mddev *mddev, char *page)
3547{ 3547{
3548 if (mddev->reshape_position != MaxSector && 3548 if (mddev->reshape_position != MaxSector &&
3549 mddev->chunk_sectors != mddev->new_chunk_sectors) 3549 mddev->chunk_sectors != mddev->new_chunk_sectors)
@@ -3554,7 +3554,7 @@ chunk_size_show(mddev_t *mddev, char *page)
3554} 3554}
3555 3555
3556static ssize_t 3556static ssize_t
3557chunk_size_store(mddev_t *mddev, const char *buf, size_t len) 3557chunk_size_store(struct mddev *mddev, const char *buf, size_t len)
3558{ 3558{
3559 char *e; 3559 char *e;
3560 unsigned long n = simple_strtoul(buf, &e, 10); 3560 unsigned long n = simple_strtoul(buf, &e, 10);
@@ -3583,7 +3583,7 @@ static struct md_sysfs_entry md_chunk_size =
3583__ATTR(chunk_size, S_IRUGO|S_IWUSR, chunk_size_show, chunk_size_store); 3583__ATTR(chunk_size, S_IRUGO|S_IWUSR, chunk_size_show, chunk_size_store);
3584 3584
3585static ssize_t 3585static ssize_t
3586resync_start_show(mddev_t *mddev, char *page) 3586resync_start_show(struct mddev *mddev, char *page)
3587{ 3587{
3588 if (mddev->recovery_cp == MaxSector) 3588 if (mddev->recovery_cp == MaxSector)
3589 return sprintf(page, "none\n"); 3589 return sprintf(page, "none\n");
@@ -3591,7 +3591,7 @@ resync_start_show(mddev_t *mddev, char *page)
3591} 3591}
3592 3592
3593static ssize_t 3593static ssize_t
3594resync_start_store(mddev_t *mddev, const char *buf, size_t len) 3594resync_start_store(struct mddev *mddev, const char *buf, size_t len)
3595{ 3595{
3596 char *e; 3596 char *e;
3597 unsigned long long n = simple_strtoull(buf, &e, 10); 3597 unsigned long long n = simple_strtoull(buf, &e, 10);
@@ -3661,7 +3661,7 @@ static int match_word(const char *word, char **list)
3661} 3661}
3662 3662
3663static ssize_t 3663static ssize_t
3664array_state_show(mddev_t *mddev, char *page) 3664array_state_show(struct mddev *mddev, char *page)
3665{ 3665{
3666 enum array_state st = inactive; 3666 enum array_state st = inactive;
3667 3667
@@ -3694,13 +3694,13 @@ array_state_show(mddev_t *mddev, char *page)
3694 return sprintf(page, "%s\n", array_states[st]); 3694 return sprintf(page, "%s\n", array_states[st]);
3695} 3695}
3696 3696
3697static int do_md_stop(mddev_t * mddev, int ro, int is_open); 3697static int do_md_stop(struct mddev * mddev, int ro, int is_open);
3698static int md_set_readonly(mddev_t * mddev, int is_open); 3698static int md_set_readonly(struct mddev * mddev, int is_open);
3699static int do_md_run(mddev_t * mddev); 3699static int do_md_run(struct mddev * mddev);
3700static int restart_array(mddev_t *mddev); 3700static int restart_array(struct mddev *mddev);
3701 3701
3702static ssize_t 3702static ssize_t
3703array_state_store(mddev_t *mddev, const char *buf, size_t len) 3703array_state_store(struct mddev *mddev, const char *buf, size_t len)
3704{ 3704{
3705 int err = -EINVAL; 3705 int err = -EINVAL;
3706 enum array_state st = match_word(buf, array_states); 3706 enum array_state st = match_word(buf, array_states);
@@ -3794,13 +3794,13 @@ static struct md_sysfs_entry md_array_state =
3794__ATTR(array_state, S_IRUGO|S_IWUSR, array_state_show, array_state_store); 3794__ATTR(array_state, S_IRUGO|S_IWUSR, array_state_show, array_state_store);
3795 3795
3796static ssize_t 3796static ssize_t
3797max_corrected_read_errors_show(mddev_t *mddev, char *page) { 3797max_corrected_read_errors_show(struct mddev *mddev, char *page) {
3798 return sprintf(page, "%d\n", 3798 return sprintf(page, "%d\n",
3799 atomic_read(&mddev->max_corr_read_errors)); 3799 atomic_read(&mddev->max_corr_read_errors));
3800} 3800}
3801 3801
3802static ssize_t 3802static ssize_t
3803max_corrected_read_errors_store(mddev_t *mddev, const char *buf, size_t len) 3803max_corrected_read_errors_store(struct mddev *mddev, const char *buf, size_t len)
3804{ 3804{
3805 char *e; 3805 char *e;
3806 unsigned long n = simple_strtoul(buf, &e, 10); 3806 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,
3817 max_corrected_read_errors_store); 3817 max_corrected_read_errors_store);
3818 3818
3819static ssize_t 3819static ssize_t
3820null_show(mddev_t *mddev, char *page) 3820null_show(struct mddev *mddev, char *page)
3821{ 3821{
3822 return -EINVAL; 3822 return -EINVAL;
3823} 3823}
3824 3824
3825static ssize_t 3825static ssize_t
3826new_dev_store(mddev_t *mddev, const char *buf, size_t len) 3826new_dev_store(struct mddev *mddev, const char *buf, size_t len)
3827{ 3827{
3828 /* buf must be %d:%d\n? giving major and minor numbers */ 3828 /* buf must be %d:%d\n? giving major and minor numbers */
3829 /* The new device is added to the array. 3829 /* The new device is added to the array.
@@ -3880,7 +3880,7 @@ static struct md_sysfs_entry md_new_device =
3880__ATTR(new_dev, S_IWUSR, null_show, new_dev_store); 3880__ATTR(new_dev, S_IWUSR, null_show, new_dev_store);
3881 3881
3882static ssize_t 3882static ssize_t
3883bitmap_store(mddev_t *mddev, const char *buf, size_t len) 3883bitmap_store(struct mddev *mddev, const char *buf, size_t len)
3884{ 3884{
3885 char *end; 3885 char *end;
3886 unsigned long chunk, end_chunk; 3886 unsigned long chunk, end_chunk;
@@ -3909,16 +3909,16 @@ static struct md_sysfs_entry md_bitmap =
3909__ATTR(bitmap_set_bits, S_IWUSR, null_show, bitmap_store); 3909__ATTR(bitmap_set_bits, S_IWUSR, null_show, bitmap_store);
3910 3910
3911static ssize_t 3911static ssize_t
3912size_show(mddev_t *mddev, char *page) 3912size_show(struct mddev *mddev, char *page)
3913{ 3913{
3914 return sprintf(page, "%llu\n", 3914 return sprintf(page, "%llu\n",
3915 (unsigned long long)mddev->dev_sectors / 2); 3915 (unsigned long long)mddev->dev_sectors / 2);
3916} 3916}
3917 3917
3918static int update_size(mddev_t *mddev, sector_t num_sectors); 3918static int update_size(struct mddev *mddev, sector_t num_sectors);
3919 3919
3920static ssize_t 3920static ssize_t
3921size_store(mddev_t *mddev, const char *buf, size_t len) 3921size_store(struct mddev *mddev, const char *buf, size_t len)
3922{ 3922{
3923 /* If array is inactive, we can reduce the component size, but 3923 /* If array is inactive, we can reduce the component size, but
3924 * not increase it (except from 0). 3924 * not increase it (except from 0).
@@ -3953,7 +3953,7 @@ __ATTR(component_size, S_IRUGO|S_IWUSR, size_show, size_store);
3953 * or N.M for internally known formats 3953 * or N.M for internally known formats
3954 */ 3954 */
3955static ssize_t 3955static ssize_t
3956metadata_show(mddev_t *mddev, char *page) 3956metadata_show(struct mddev *mddev, char *page)
3957{ 3957{
3958 if (mddev->persistent) 3958 if (mddev->persistent)
3959 return sprintf(page, "%d.%d\n", 3959 return sprintf(page, "%d.%d\n",
@@ -3965,7 +3965,7 @@ metadata_show(mddev_t *mddev, char *page)
3965} 3965}
3966 3966
3967static ssize_t 3967static ssize_t
3968metadata_store(mddev_t *mddev, const char *buf, size_t len) 3968metadata_store(struct mddev *mddev, const char *buf, size_t len)
3969{ 3969{
3970 int major, minor; 3970 int major, minor;
3971 char *e; 3971 char *e;
@@ -4019,7 +4019,7 @@ static struct md_sysfs_entry md_metadata =
4019__ATTR(metadata_version, S_IRUGO|S_IWUSR, metadata_show, metadata_store); 4019__ATTR(metadata_version, S_IRUGO|S_IWUSR, metadata_show, metadata_store);
4020 4020
4021static ssize_t 4021static ssize_t
4022action_show(mddev_t *mddev, char *page) 4022action_show(struct mddev *mddev, char *page)
4023{ 4023{
4024 char *type = "idle"; 4024 char *type = "idle";
4025 if (test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) 4025 if (test_bit(MD_RECOVERY_FROZEN, &mddev->recovery))
@@ -4041,10 +4041,10 @@ action_show(mddev_t *mddev, char *page)
4041 return sprintf(page, "%s\n", type); 4041 return sprintf(page, "%s\n", type);
4042} 4042}
4043 4043
4044static void reap_sync_thread(mddev_t *mddev); 4044static void reap_sync_thread(struct mddev *mddev);
4045 4045
4046static ssize_t 4046static ssize_t
4047action_store(mddev_t *mddev, const char *page, size_t len) 4047action_store(struct mddev *mddev, const char *page, size_t len)
4048{ 4048{
4049 if (!mddev->pers || !mddev->pers->sync_request) 4049 if (!mddev->pers || !mddev->pers->sync_request)
4050 return -EINVAL; 4050 return -EINVAL;
@@ -4090,7 +4090,7 @@ action_store(mddev_t *mddev, const char *page, size_t len)
4090} 4090}
4091 4091
4092static ssize_t 4092static ssize_t
4093mismatch_cnt_show(mddev_t *mddev, char *page) 4093mismatch_cnt_show(struct mddev *mddev, char *page)
4094{ 4094{
4095 return sprintf(page, "%llu\n", 4095 return sprintf(page, "%llu\n",
4096 (unsigned long long) mddev->resync_mismatches); 4096 (unsigned long long) mddev->resync_mismatches);
@@ -4103,14 +4103,14 @@ __ATTR(sync_action, S_IRUGO|S_IWUSR, action_show, action_store);
4103static struct md_sysfs_entry md_mismatches = __ATTR_RO(mismatch_cnt); 4103static struct md_sysfs_entry md_mismatches = __ATTR_RO(mismatch_cnt);
4104 4104
4105static ssize_t 4105static ssize_t
4106sync_min_show(mddev_t *mddev, char *page) 4106sync_min_show(struct mddev *mddev, char *page)
4107{ 4107{
4108 return sprintf(page, "%d (%s)\n", speed_min(mddev), 4108 return sprintf(page, "%d (%s)\n", speed_min(mddev),
4109 mddev->sync_speed_min ? "local": "system"); 4109 mddev->sync_speed_min ? "local": "system");
4110} 4110}
4111 4111
4112static ssize_t 4112static ssize_t
4113sync_min_store(mddev_t *mddev, const char *buf, size_t len) 4113sync_min_store(struct mddev *mddev, const char *buf, size_t len)
4114{ 4114{
4115 int min; 4115 int min;
4116 char *e; 4116 char *e;
@@ -4129,14 +4129,14 @@ static struct md_sysfs_entry md_sync_min =
4129__ATTR(sync_speed_min, S_IRUGO|S_IWUSR, sync_min_show, sync_min_store); 4129__ATTR(sync_speed_min, S_IRUGO|S_IWUSR, sync_min_show, sync_min_store);
4130 4130
4131static ssize_t 4131static ssize_t
4132sync_max_show(mddev_t *mddev, char *page) 4132sync_max_show(struct mddev *mddev, char *page)
4133{ 4133{
4134 return sprintf(page, "%d (%s)\n", speed_max(mddev), 4134 return sprintf(page, "%d (%s)\n", speed_max(mddev),
4135 mddev->sync_speed_max ? "local": "system"); 4135 mddev->sync_speed_max ? "local": "system");
4136} 4136}
4137 4137
4138static ssize_t 4138static ssize_t
4139sync_max_store(mddev_t *mddev, const char *buf, size_t len) 4139sync_max_store(struct mddev *mddev, const char *buf, size_t len)
4140{ 4140{
4141 int max; 4141 int max;
4142 char *e; 4142 char *e;
@@ -4155,20 +4155,20 @@ static struct md_sysfs_entry md_sync_max =
4155__ATTR(sync_speed_max, S_IRUGO|S_IWUSR, sync_max_show, sync_max_store); 4155__ATTR(sync_speed_max, S_IRUGO|S_IWUSR, sync_max_show, sync_max_store);
4156 4156
4157static ssize_t 4157static ssize_t
4158degraded_show(mddev_t *mddev, char *page) 4158degraded_show(struct mddev *mddev, char *page)
4159{ 4159{
4160 return sprintf(page, "%d\n", mddev->degraded); 4160 return sprintf(page, "%d\n", mddev->degraded);
4161} 4161}
4162static struct md_sysfs_entry md_degraded = __ATTR_RO(degraded); 4162static struct md_sysfs_entry md_degraded = __ATTR_RO(degraded);
4163 4163
4164static ssize_t 4164static ssize_t
4165sync_force_parallel_show(mddev_t *mddev, char *page) 4165sync_force_parallel_show(struct mddev *mddev, char *page)
4166{ 4166{
4167 return sprintf(page, "%d\n", mddev->parallel_resync); 4167 return sprintf(page, "%d\n", mddev->parallel_resync);
4168} 4168}
4169 4169
4170static ssize_t 4170static ssize_t
4171sync_force_parallel_store(mddev_t *mddev, const char *buf, size_t len) 4171sync_force_parallel_store(struct mddev *mddev, const char *buf, size_t len)
4172{ 4172{
4173 long n; 4173 long n;
4174 4174
@@ -4192,7 +4192,7 @@ __ATTR(sync_force_parallel, S_IRUGO|S_IWUSR,
4192 sync_force_parallel_show, sync_force_parallel_store); 4192 sync_force_parallel_show, sync_force_parallel_store);
4193 4193
4194static ssize_t 4194static ssize_t
4195sync_speed_show(mddev_t *mddev, char *page) 4195sync_speed_show(struct mddev *mddev, char *page)
4196{ 4196{
4197 unsigned long resync, dt, db; 4197 unsigned long resync, dt, db;
4198 if (mddev->curr_resync == 0) 4198 if (mddev->curr_resync == 0)
@@ -4207,7 +4207,7 @@ sync_speed_show(mddev_t *mddev, char *page)
4207static struct md_sysfs_entry md_sync_speed = __ATTR_RO(sync_speed); 4207static struct md_sysfs_entry md_sync_speed = __ATTR_RO(sync_speed);
4208 4208
4209static ssize_t 4209static ssize_t
4210sync_completed_show(mddev_t *mddev, char *page) 4210sync_completed_show(struct mddev *mddev, char *page)
4211{ 4211{
4212 unsigned long long max_sectors, resync; 4212 unsigned long long max_sectors, resync;
4213 4213
@@ -4226,13 +4226,13 @@ sync_completed_show(mddev_t *mddev, char *page)
4226static struct md_sysfs_entry md_sync_completed = __ATTR_RO(sync_completed); 4226static struct md_sysfs_entry md_sync_completed = __ATTR_RO(sync_completed);
4227 4227
4228static ssize_t 4228static ssize_t
4229min_sync_show(mddev_t *mddev, char *page) 4229min_sync_show(struct mddev *mddev, char *page)
4230{ 4230{
4231 return sprintf(page, "%llu\n", 4231 return sprintf(page, "%llu\n",
4232 (unsigned long long)mddev->resync_min); 4232 (unsigned long long)mddev->resync_min);
4233} 4233}
4234static ssize_t 4234static ssize_t
4235min_sync_store(mddev_t *mddev, const char *buf, size_t len) 4235min_sync_store(struct mddev *mddev, const char *buf, size_t len)
4236{ 4236{
4237 unsigned long long min; 4237 unsigned long long min;
4238 if (strict_strtoull(buf, 10, &min)) 4238 if (strict_strtoull(buf, 10, &min))
@@ -4257,7 +4257,7 @@ static struct md_sysfs_entry md_min_sync =
4257__ATTR(sync_min, S_IRUGO|S_IWUSR, min_sync_show, min_sync_store); 4257__ATTR(sync_min, S_IRUGO|S_IWUSR, min_sync_show, min_sync_store);
4258 4258
4259static ssize_t 4259static ssize_t
4260max_sync_show(mddev_t *mddev, char *page) 4260max_sync_show(struct mddev *mddev, char *page)
4261{ 4261{
4262 if (mddev->resync_max == MaxSector) 4262 if (mddev->resync_max == MaxSector)
4263 return sprintf(page, "max\n"); 4263 return sprintf(page, "max\n");
@@ -4266,7 +4266,7 @@ max_sync_show(mddev_t *mddev, char *page)
4266 (unsigned long long)mddev->resync_max); 4266 (unsigned long long)mddev->resync_max);
4267} 4267}
4268static ssize_t 4268static ssize_t
4269max_sync_store(mddev_t *mddev, const char *buf, size_t len) 4269max_sync_store(struct mddev *mddev, const char *buf, size_t len)
4270{ 4270{
4271 if (strncmp(buf, "max", 3) == 0) 4271 if (strncmp(buf, "max", 3) == 0)
4272 mddev->resync_max = MaxSector; 4272 mddev->resync_max = MaxSector;
@@ -4297,13 +4297,13 @@ static struct md_sysfs_entry md_max_sync =
4297__ATTR(sync_max, S_IRUGO|S_IWUSR, max_sync_show, max_sync_store); 4297__ATTR(sync_max, S_IRUGO|S_IWUSR, max_sync_show, max_sync_store);
4298 4298
4299static ssize_t 4299static ssize_t
4300suspend_lo_show(mddev_t *mddev, char *page) 4300suspend_lo_show(struct mddev *mddev, char *page)
4301{ 4301{
4302 return sprintf(page, "%llu\n", (unsigned long long)mddev->suspend_lo); 4302 return sprintf(page, "%llu\n", (unsigned long long)mddev->suspend_lo);
4303} 4303}
4304 4304
4305static ssize_t 4305static ssize_t
4306suspend_lo_store(mddev_t *mddev, const char *buf, size_t len) 4306suspend_lo_store(struct mddev *mddev, const char *buf, size_t len)
4307{ 4307{
4308 char *e; 4308 char *e;
4309 unsigned long long new = simple_strtoull(buf, &e, 10); 4309 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);
4331 4331
4332 4332
4333static ssize_t 4333static ssize_t
4334suspend_hi_show(mddev_t *mddev, char *page) 4334suspend_hi_show(struct mddev *mddev, char *page)
4335{ 4335{
4336 return sprintf(page, "%llu\n", (unsigned long long)mddev->suspend_hi); 4336 return sprintf(page, "%llu\n", (unsigned long long)mddev->suspend_hi);
4337} 4337}
4338 4338
4339static ssize_t 4339static ssize_t
4340suspend_hi_store(mddev_t *mddev, const char *buf, size_t len) 4340suspend_hi_store(struct mddev *mddev, const char *buf, size_t len)
4341{ 4341{
4342 char *e; 4342 char *e;
4343 unsigned long long new = simple_strtoull(buf, &e, 10); 4343 unsigned long long new = simple_strtoull(buf, &e, 10);
@@ -4364,7 +4364,7 @@ static struct md_sysfs_entry md_suspend_hi =
4364__ATTR(suspend_hi, S_IRUGO|S_IWUSR, suspend_hi_show, suspend_hi_store); 4364__ATTR(suspend_hi, S_IRUGO|S_IWUSR, suspend_hi_show, suspend_hi_store);
4365 4365
4366static ssize_t 4366static ssize_t
4367reshape_position_show(mddev_t *mddev, char *page) 4367reshape_position_show(struct mddev *mddev, char *page)
4368{ 4368{
4369 if (mddev->reshape_position != MaxSector) 4369 if (mddev->reshape_position != MaxSector)
4370 return sprintf(page, "%llu\n", 4370 return sprintf(page, "%llu\n",
@@ -4374,7 +4374,7 @@ reshape_position_show(mddev_t *mddev, char *page)
4374} 4374}
4375 4375
4376static ssize_t 4376static ssize_t
4377reshape_position_store(mddev_t *mddev, const char *buf, size_t len) 4377reshape_position_store(struct mddev *mddev, const char *buf, size_t len)
4378{ 4378{
4379 char *e; 4379 char *e;
4380 unsigned long long new = simple_strtoull(buf, &e, 10); 4380 unsigned long long new = simple_strtoull(buf, &e, 10);
@@ -4395,7 +4395,7 @@ __ATTR(reshape_position, S_IRUGO|S_IWUSR, reshape_position_show,
4395 reshape_position_store); 4395 reshape_position_store);
4396 4396
4397static ssize_t 4397static ssize_t
4398array_size_show(mddev_t *mddev, char *page) 4398array_size_show(struct mddev *mddev, char *page)
4399{ 4399{
4400 if (mddev->external_size) 4400 if (mddev->external_size)
4401 return sprintf(page, "%llu\n", 4401 return sprintf(page, "%llu\n",
@@ -4405,7 +4405,7 @@ array_size_show(mddev_t *mddev, char *page)
4405} 4405}
4406 4406
4407static ssize_t 4407static ssize_t
4408array_size_store(mddev_t *mddev, const char *buf, size_t len) 4408array_size_store(struct mddev *mddev, const char *buf, size_t len)
4409{ 4409{
4410 sector_t sectors; 4410 sector_t sectors;
4411 4411
@@ -4480,7 +4480,7 @@ static ssize_t
4480md_attr_show(struct kobject *kobj, struct attribute *attr, char *page) 4480md_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
4481{ 4481{
4482 struct md_sysfs_entry *entry = container_of(attr, struct md_sysfs_entry, attr); 4482 struct md_sysfs_entry *entry = container_of(attr, struct md_sysfs_entry, attr);
4483 mddev_t *mddev = container_of(kobj, struct mddev_s, kobj); 4483 struct mddev *mddev = container_of(kobj, struct mddev, kobj);
4484 ssize_t rv; 4484 ssize_t rv;
4485 4485
4486 if (!entry->show) 4486 if (!entry->show)
@@ -4498,7 +4498,7 @@ md_attr_store(struct kobject *kobj, struct attribute *attr,
4498 const char *page, size_t length) 4498 const char *page, size_t length)
4499{ 4499{
4500 struct md_sysfs_entry *entry = container_of(attr, struct md_sysfs_entry, attr); 4500 struct md_sysfs_entry *entry = container_of(attr, struct md_sysfs_entry, attr);
4501 mddev_t *mddev = container_of(kobj, struct mddev_s, kobj); 4501 struct mddev *mddev = container_of(kobj, struct mddev, kobj);
4502 ssize_t rv; 4502 ssize_t rv;
4503 4503
4504 if (!entry->store) 4504 if (!entry->store)
@@ -4517,7 +4517,7 @@ md_attr_store(struct kobject *kobj, struct attribute *attr,
4517 4517
4518static void md_free(struct kobject *ko) 4518static void md_free(struct kobject *ko)
4519{ 4519{
4520 mddev_t *mddev = container_of(ko, mddev_t, kobj); 4520 struct mddev *mddev = container_of(ko, struct mddev, kobj);
4521 4521
4522 if (mddev->sysfs_state) 4522 if (mddev->sysfs_state)
4523 sysfs_put(mddev->sysfs_state); 4523 sysfs_put(mddev->sysfs_state);
@@ -4546,7 +4546,7 @@ int mdp_major = 0;
4546 4546
4547static void mddev_delayed_delete(struct work_struct *ws) 4547static void mddev_delayed_delete(struct work_struct *ws)
4548{ 4548{
4549 mddev_t *mddev = container_of(ws, mddev_t, del_work); 4549 struct mddev *mddev = container_of(ws, struct mddev, del_work);
4550 4550
4551 sysfs_remove_group(&mddev->kobj, &md_bitmap_group); 4551 sysfs_remove_group(&mddev->kobj, &md_bitmap_group);
4552 kobject_del(&mddev->kobj); 4552 kobject_del(&mddev->kobj);
@@ -4556,7 +4556,7 @@ static void mddev_delayed_delete(struct work_struct *ws)
4556static int md_alloc(dev_t dev, char *name) 4556static int md_alloc(dev_t dev, char *name)
4557{ 4557{
4558 static DEFINE_MUTEX(disks_mutex); 4558 static DEFINE_MUTEX(disks_mutex);
4559 mddev_t *mddev = mddev_find(dev); 4559 struct mddev *mddev = mddev_find(dev);
4560 struct gendisk *disk; 4560 struct gendisk *disk;
4561 int partitioned; 4561 int partitioned;
4562 int shift; 4562 int shift;
@@ -4583,7 +4583,7 @@ static int md_alloc(dev_t dev, char *name)
4583 if (name) { 4583 if (name) {
4584 /* Need to ensure that 'name' is not a duplicate. 4584 /* Need to ensure that 'name' is not a duplicate.
4585 */ 4585 */
4586 mddev_t *mddev2; 4586 struct mddev *mddev2;
4587 spin_lock(&all_mddevs_lock); 4587 spin_lock(&all_mddevs_lock);
4588 4588
4589 list_for_each_entry(mddev2, &all_mddevs, all_mddevs) 4589 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)
4684 4684
4685static void md_safemode_timeout(unsigned long data) 4685static void md_safemode_timeout(unsigned long data)
4686{ 4686{
4687 mddev_t *mddev = (mddev_t *) data; 4687 struct mddev *mddev = (struct mddev *) data;
4688 4688
4689 if (!atomic_read(&mddev->writes_pending)) { 4689 if (!atomic_read(&mddev->writes_pending)) {
4690 mddev->safemode = 1; 4690 mddev->safemode = 1;
@@ -4696,7 +4696,7 @@ static void md_safemode_timeout(unsigned long data)
4696 4696
4697static int start_dirty_degraded; 4697static int start_dirty_degraded;
4698 4698
4699int md_run(mddev_t *mddev) 4699int md_run(struct mddev *mddev)
4700{ 4700{
4701 int err; 4701 int err;
4702 struct md_rdev *rdev; 4702 struct md_rdev *rdev;
@@ -4764,7 +4764,7 @@ int md_run(mddev_t *mddev)
4764 4764
4765 if (mddev->bio_set == NULL) 4765 if (mddev->bio_set == NULL)
4766 mddev->bio_set = bioset_create(BIO_POOL_SIZE, 4766 mddev->bio_set = bioset_create(BIO_POOL_SIZE,
4767 sizeof(mddev_t *)); 4767 sizeof(struct mddev *));
4768 4768
4769 spin_lock(&pers_lock); 4769 spin_lock(&pers_lock);
4770 pers = find_pers(mddev->level, mddev->clevel); 4770 pers = find_pers(mddev->level, mddev->clevel);
@@ -4898,7 +4898,7 @@ int md_run(mddev_t *mddev)
4898} 4898}
4899EXPORT_SYMBOL_GPL(md_run); 4899EXPORT_SYMBOL_GPL(md_run);
4900 4900
4901static int do_md_run(mddev_t *mddev) 4901static int do_md_run(struct mddev *mddev)
4902{ 4902{
4903 int err; 4903 int err;
4904 4904
@@ -4922,7 +4922,7 @@ out:
4922 return err; 4922 return err;
4923} 4923}
4924 4924
4925static int restart_array(mddev_t *mddev) 4925static int restart_array(struct mddev *mddev)
4926{ 4926{
4927 struct gendisk *disk = mddev->gendisk; 4927 struct gendisk *disk = mddev->gendisk;
4928 4928
@@ -4972,7 +4972,7 @@ void restore_bitmap_write_access(struct file *file)
4972 spin_unlock(&inode->i_lock); 4972 spin_unlock(&inode->i_lock);
4973} 4973}
4974 4974
4975static void md_clean(mddev_t *mddev) 4975static void md_clean(struct mddev *mddev)
4976{ 4976{
4977 mddev->array_sectors = 0; 4977 mddev->array_sectors = 0;
4978 mddev->external_size = 0; 4978 mddev->external_size = 0;
@@ -5015,7 +5015,7 @@ static void md_clean(mddev_t *mddev)
5015 mddev->bitmap_info.max_write_behind = 0; 5015 mddev->bitmap_info.max_write_behind = 0;
5016} 5016}
5017 5017
5018static void __md_stop_writes(mddev_t *mddev) 5018static void __md_stop_writes(struct mddev *mddev)
5019{ 5019{
5020 if (mddev->sync_thread) { 5020 if (mddev->sync_thread) {
5021 set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); 5021 set_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
@@ -5035,7 +5035,7 @@ static void __md_stop_writes(mddev_t *mddev)
5035 } 5035 }
5036} 5036}
5037 5037
5038void md_stop_writes(mddev_t *mddev) 5038void md_stop_writes(struct mddev *mddev)
5039{ 5039{
5040 mddev_lock(mddev); 5040 mddev_lock(mddev);
5041 __md_stop_writes(mddev); 5041 __md_stop_writes(mddev);
@@ -5043,7 +5043,7 @@ void md_stop_writes(mddev_t *mddev)
5043} 5043}
5044EXPORT_SYMBOL_GPL(md_stop_writes); 5044EXPORT_SYMBOL_GPL(md_stop_writes);
5045 5045
5046void md_stop(mddev_t *mddev) 5046void md_stop(struct mddev *mddev)
5047{ 5047{
5048 mddev->ready = 0; 5048 mddev->ready = 0;
5049 mddev->pers->stop(mddev); 5049 mddev->pers->stop(mddev);
@@ -5055,7 +5055,7 @@ void md_stop(mddev_t *mddev)
5055} 5055}
5056EXPORT_SYMBOL_GPL(md_stop); 5056EXPORT_SYMBOL_GPL(md_stop);
5057 5057
5058static int md_set_readonly(mddev_t *mddev, int is_open) 5058static int md_set_readonly(struct mddev *mddev, int is_open)
5059{ 5059{
5060 int err = 0; 5060 int err = 0;
5061 mutex_lock(&mddev->open_mutex); 5061 mutex_lock(&mddev->open_mutex);
@@ -5085,7 +5085,7 @@ out:
5085 * 0 - completely stop and dis-assemble array 5085 * 0 - completely stop and dis-assemble array
5086 * 2 - stop but do not disassemble array 5086 * 2 - stop but do not disassemble array
5087 */ 5087 */
5088static int do_md_stop(mddev_t * mddev, int mode, int is_open) 5088static int do_md_stop(struct mddev * mddev, int mode, int is_open)
5089{ 5089{
5090 struct gendisk *disk = mddev->gendisk; 5090 struct gendisk *disk = mddev->gendisk;
5091 struct md_rdev *rdev; 5091 struct md_rdev *rdev;
@@ -5151,7 +5151,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
5151} 5151}
5152 5152
5153#ifndef MODULE 5153#ifndef MODULE
5154static void autorun_array(mddev_t *mddev) 5154static void autorun_array(struct mddev *mddev)
5155{ 5155{
5156 struct md_rdev *rdev; 5156 struct md_rdev *rdev;
5157 int err; 5157 int err;
@@ -5189,7 +5189,7 @@ static void autorun_array(mddev_t *mddev)
5189static void autorun_devices(int part) 5189static void autorun_devices(int part)
5190{ 5190{
5191 struct md_rdev *rdev0, *rdev, *tmp; 5191 struct md_rdev *rdev0, *rdev, *tmp;
5192 mddev_t *mddev; 5192 struct mddev *mddev;
5193 char b[BDEVNAME_SIZE]; 5193 char b[BDEVNAME_SIZE];
5194 5194
5195 printk(KERN_INFO "md: autorun ...\n"); 5195 printk(KERN_INFO "md: autorun ...\n");
@@ -5284,7 +5284,7 @@ static int get_version(void __user * arg)
5284 return 0; 5284 return 0;
5285} 5285}
5286 5286
5287static int get_array_info(mddev_t * mddev, void __user * arg) 5287static int get_array_info(struct mddev * mddev, void __user * arg)
5288{ 5288{
5289 mdu_array_info_t info; 5289 mdu_array_info_t info;
5290 int nr,working,insync,failed,spare; 5290 int nr,working,insync,failed,spare;
@@ -5337,7 +5337,7 @@ static int get_array_info(mddev_t * mddev, void __user * arg)
5337 return 0; 5337 return 0;
5338} 5338}
5339 5339
5340static int get_bitmap_file(mddev_t * mddev, void __user * arg) 5340static int get_bitmap_file(struct mddev * mddev, void __user * arg)
5341{ 5341{
5342 mdu_bitmap_file_t *file = NULL; /* too big for stack allocation */ 5342 mdu_bitmap_file_t *file = NULL; /* too big for stack allocation */
5343 char *ptr, *buf = NULL; 5343 char *ptr, *buf = NULL;
@@ -5377,7 +5377,7 @@ out:
5377 return err; 5377 return err;
5378} 5378}
5379 5379
5380static int get_disk_info(mddev_t * mddev, void __user * arg) 5380static int get_disk_info(struct mddev * mddev, void __user * arg)
5381{ 5381{
5382 mdu_disk_info_t info; 5382 mdu_disk_info_t info;
5383 struct md_rdev *rdev; 5383 struct md_rdev *rdev;
@@ -5411,7 +5411,7 @@ static int get_disk_info(mddev_t * mddev, void __user * arg)
5411 return 0; 5411 return 0;
5412} 5412}
5413 5413
5414static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) 5414static int add_new_disk(struct mddev * mddev, mdu_disk_info_t *info)
5415{ 5415{
5416 char b[BDEVNAME_SIZE], b2[BDEVNAME_SIZE]; 5416 char b[BDEVNAME_SIZE], b2[BDEVNAME_SIZE];
5417 struct md_rdev *rdev; 5417 struct md_rdev *rdev;
@@ -5583,7 +5583,7 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info)
5583 return 0; 5583 return 0;
5584} 5584}
5585 5585
5586static int hot_remove_disk(mddev_t * mddev, dev_t dev) 5586static int hot_remove_disk(struct mddev * mddev, dev_t dev)
5587{ 5587{
5588 char b[BDEVNAME_SIZE]; 5588 char b[BDEVNAME_SIZE];
5589 struct md_rdev *rdev; 5589 struct md_rdev *rdev;
@@ -5606,7 +5606,7 @@ busy:
5606 return -EBUSY; 5606 return -EBUSY;
5607} 5607}
5608 5608
5609static int hot_add_disk(mddev_t * mddev, dev_t dev) 5609static int hot_add_disk(struct mddev * mddev, dev_t dev)
5610{ 5610{
5611 char b[BDEVNAME_SIZE]; 5611 char b[BDEVNAME_SIZE];
5612 int err; 5612 int err;
@@ -5680,7 +5680,7 @@ abort_export:
5680 return err; 5680 return err;
5681} 5681}
5682 5682
5683static int set_bitmap_file(mddev_t *mddev, int fd) 5683static int set_bitmap_file(struct mddev *mddev, int fd)
5684{ 5684{
5685 int err; 5685 int err;
5686 5686
@@ -5753,7 +5753,7 @@ static int set_bitmap_file(mddev_t *mddev, int fd)
5753 * The minor and patch _version numbers are also kept incase the 5753 * The minor and patch _version numbers are also kept incase the
5754 * super_block handler wishes to interpret them. 5754 * super_block handler wishes to interpret them.
5755 */ 5755 */
5756static int set_array_info(mddev_t * mddev, mdu_array_info_t *info) 5756static int set_array_info(struct mddev * mddev, mdu_array_info_t *info)
5757{ 5757{
5758 5758
5759 if (info->raid_disks == 0) { 5759 if (info->raid_disks == 0) {
@@ -5823,7 +5823,7 @@ static int set_array_info(mddev_t * mddev, mdu_array_info_t *info)
5823 return 0; 5823 return 0;
5824} 5824}
5825 5825
5826void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors) 5826void md_set_array_sectors(struct mddev *mddev, sector_t array_sectors)
5827{ 5827{
5828 WARN(!mddev_is_locked(mddev), "%s: unlocked mddev!\n", __func__); 5828 WARN(!mddev_is_locked(mddev), "%s: unlocked mddev!\n", __func__);
5829 5829
@@ -5834,7 +5834,7 @@ void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors)
5834} 5834}
5835EXPORT_SYMBOL(md_set_array_sectors); 5835EXPORT_SYMBOL(md_set_array_sectors);
5836 5836
5837static int update_size(mddev_t *mddev, sector_t num_sectors) 5837static int update_size(struct mddev *mddev, sector_t num_sectors)
5838{ 5838{
5839 struct md_rdev *rdev; 5839 struct md_rdev *rdev;
5840 int rv; 5840 int rv;
@@ -5872,7 +5872,7 @@ static int update_size(mddev_t *mddev, sector_t num_sectors)
5872 return rv; 5872 return rv;
5873} 5873}
5874 5874
5875static int update_raid_disks(mddev_t *mddev, int raid_disks) 5875static int update_raid_disks(struct mddev *mddev, int raid_disks)
5876{ 5876{
5877 int rv; 5877 int rv;
5878 /* change the number of raid disks */ 5878 /* change the number of raid disks */
@@ -5900,7 +5900,7 @@ static int update_raid_disks(mddev_t *mddev, int raid_disks)
5900 * Any differences that cannot be handled will cause an error. 5900 * Any differences that cannot be handled will cause an error.
5901 * Normally, only one change can be managed at a time. 5901 * Normally, only one change can be managed at a time.
5902 */ 5902 */
5903static int update_array_info(mddev_t *mddev, mdu_array_info_t *info) 5903static int update_array_info(struct mddev *mddev, mdu_array_info_t *info)
5904{ 5904{
5905 int rv = 0; 5905 int rv = 0;
5906 int cnt = 0; 5906 int cnt = 0;
@@ -5993,7 +5993,7 @@ static int update_array_info(mddev_t *mddev, mdu_array_info_t *info)
5993 return rv; 5993 return rv;
5994} 5994}
5995 5995
5996static int set_disk_faulty(mddev_t *mddev, dev_t dev) 5996static int set_disk_faulty(struct mddev *mddev, dev_t dev)
5997{ 5997{
5998 struct md_rdev *rdev; 5998 struct md_rdev *rdev;
5999 5999
@@ -6018,7 +6018,7 @@ static int set_disk_faulty(mddev_t *mddev, dev_t dev)
6018 */ 6018 */
6019static int md_getgeo(struct block_device *bdev, struct hd_geometry *geo) 6019static int md_getgeo(struct block_device *bdev, struct hd_geometry *geo)
6020{ 6020{
6021 mddev_t *mddev = bdev->bd_disk->private_data; 6021 struct mddev *mddev = bdev->bd_disk->private_data;
6022 6022
6023 geo->heads = 2; 6023 geo->heads = 2;
6024 geo->sectors = 4; 6024 geo->sectors = 4;
@@ -6031,7 +6031,7 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode,
6031{ 6031{
6032 int err = 0; 6032 int err = 0;
6033 void __user *argp = (void __user *)arg; 6033 void __user *argp = (void __user *)arg;
6034 mddev_t *mddev = NULL; 6034 struct mddev *mddev = NULL;
6035 int ro; 6035 int ro;
6036 6036
6037 if (!capable(CAP_SYS_ADMIN)) 6037 if (!capable(CAP_SYS_ADMIN))
@@ -6294,7 +6294,7 @@ static int md_open(struct block_device *bdev, fmode_t mode)
6294 * Succeed if we can lock the mddev, which confirms that 6294 * Succeed if we can lock the mddev, which confirms that
6295 * it isn't being stopped right now. 6295 * it isn't being stopped right now.
6296 */ 6296 */
6297 mddev_t *mddev = mddev_find(bdev->bd_dev); 6297 struct mddev *mddev = mddev_find(bdev->bd_dev);
6298 int err; 6298 int err;
6299 6299
6300 if (mddev->gendisk != bdev->bd_disk) { 6300 if (mddev->gendisk != bdev->bd_disk) {
@@ -6323,7 +6323,7 @@ static int md_open(struct block_device *bdev, fmode_t mode)
6323 6323
6324static int md_release(struct gendisk *disk, fmode_t mode) 6324static int md_release(struct gendisk *disk, fmode_t mode)
6325{ 6325{
6326 mddev_t *mddev = disk->private_data; 6326 struct mddev *mddev = disk->private_data;
6327 6327
6328 BUG_ON(!mddev); 6328 BUG_ON(!mddev);
6329 atomic_dec(&mddev->openers); 6329 atomic_dec(&mddev->openers);
@@ -6334,14 +6334,14 @@ static int md_release(struct gendisk *disk, fmode_t mode)
6334 6334
6335static int md_media_changed(struct gendisk *disk) 6335static int md_media_changed(struct gendisk *disk)
6336{ 6336{
6337 mddev_t *mddev = disk->private_data; 6337 struct mddev *mddev = disk->private_data;
6338 6338
6339 return mddev->changed; 6339 return mddev->changed;
6340} 6340}
6341 6341
6342static int md_revalidate(struct gendisk *disk) 6342static int md_revalidate(struct gendisk *disk)
6343{ 6343{
6344 mddev_t *mddev = disk->private_data; 6344 struct mddev *mddev = disk->private_data;
6345 6345
6346 mddev->changed = 0; 6346 mddev->changed = 0;
6347 return 0; 6347 return 0;
@@ -6410,7 +6410,7 @@ void md_wakeup_thread(mdk_thread_t *thread)
6410 } 6410 }
6411} 6411}
6412 6412
6413mdk_thread_t *md_register_thread(void (*run) (mddev_t *), mddev_t *mddev, 6413mdk_thread_t *md_register_thread(void (*run) (struct mddev *), struct mddev *mddev,
6414 const char *name) 6414 const char *name)
6415{ 6415{
6416 mdk_thread_t *thread; 6416 mdk_thread_t *thread;
@@ -6452,7 +6452,7 @@ void md_unregister_thread(mdk_thread_t **threadp)
6452 kfree(thread); 6452 kfree(thread);
6453} 6453}
6454 6454
6455void md_error(mddev_t *mddev, struct md_rdev *rdev) 6455void md_error(struct mddev *mddev, struct md_rdev *rdev)
6456{ 6456{
6457 if (!mddev) { 6457 if (!mddev) {
6458 MD_BUG(); 6458 MD_BUG();
@@ -6498,7 +6498,7 @@ static void status_unused(struct seq_file *seq)
6498} 6498}
6499 6499
6500 6500
6501static void status_resync(struct seq_file *seq, mddev_t * mddev) 6501static void status_resync(struct seq_file *seq, struct mddev * mddev)
6502{ 6502{
6503 sector_t max_sectors, resync, res; 6503 sector_t max_sectors, resync, res;
6504 unsigned long dt, db; 6504 unsigned long dt, db;
@@ -6589,7 +6589,7 @@ static void *md_seq_start(struct seq_file *seq, loff_t *pos)
6589{ 6589{
6590 struct list_head *tmp; 6590 struct list_head *tmp;
6591 loff_t l = *pos; 6591 loff_t l = *pos;
6592 mddev_t *mddev; 6592 struct mddev *mddev;
6593 6593
6594 if (l >= 0x10000) 6594 if (l >= 0x10000)
6595 return NULL; 6595 return NULL;
@@ -6600,7 +6600,7 @@ static void *md_seq_start(struct seq_file *seq, loff_t *pos)
6600 spin_lock(&all_mddevs_lock); 6600 spin_lock(&all_mddevs_lock);
6601 list_for_each(tmp,&all_mddevs) 6601 list_for_each(tmp,&all_mddevs)
6602 if (!l--) { 6602 if (!l--) {
6603 mddev = list_entry(tmp, mddev_t, all_mddevs); 6603 mddev = list_entry(tmp, struct mddev, all_mddevs);
6604 mddev_get(mddev); 6604 mddev_get(mddev);
6605 spin_unlock(&all_mddevs_lock); 6605 spin_unlock(&all_mddevs_lock);
6606 return mddev; 6606 return mddev;
@@ -6614,7 +6614,7 @@ static void *md_seq_start(struct seq_file *seq, loff_t *pos)
6614static void *md_seq_next(struct seq_file *seq, void *v, loff_t *pos) 6614static void *md_seq_next(struct seq_file *seq, void *v, loff_t *pos)
6615{ 6615{
6616 struct list_head *tmp; 6616 struct list_head *tmp;
6617 mddev_t *next_mddev, *mddev = v; 6617 struct mddev *next_mddev, *mddev = v;
6618 6618
6619 ++*pos; 6619 ++*pos;
6620 if (v == (void*)2) 6620 if (v == (void*)2)
@@ -6626,7 +6626,7 @@ static void *md_seq_next(struct seq_file *seq, void *v, loff_t *pos)
6626 else 6626 else
6627 tmp = mddev->all_mddevs.next; 6627 tmp = mddev->all_mddevs.next;
6628 if (tmp != &all_mddevs) 6628 if (tmp != &all_mddevs)
6629 next_mddev = mddev_get(list_entry(tmp,mddev_t,all_mddevs)); 6629 next_mddev = mddev_get(list_entry(tmp,struct mddev,all_mddevs));
6630 else { 6630 else {
6631 next_mddev = (void*)2; 6631 next_mddev = (void*)2;
6632 *pos = 0x10000; 6632 *pos = 0x10000;
@@ -6641,7 +6641,7 @@ static void *md_seq_next(struct seq_file *seq, void *v, loff_t *pos)
6641 6641
6642static void md_seq_stop(struct seq_file *seq, void *v) 6642static void md_seq_stop(struct seq_file *seq, void *v)
6643{ 6643{
6644 mddev_t *mddev = v; 6644 struct mddev *mddev = v;
6645 6645
6646 if (mddev && v != (void*)1 && v != (void*)2) 6646 if (mddev && v != (void*)1 && v != (void*)2)
6647 mddev_put(mddev); 6647 mddev_put(mddev);
@@ -6649,7 +6649,7 @@ static void md_seq_stop(struct seq_file *seq, void *v)
6649 6649
6650static int md_seq_show(struct seq_file *seq, void *v) 6650static int md_seq_show(struct seq_file *seq, void *v)
6651{ 6651{
6652 mddev_t *mddev = v; 6652 struct mddev *mddev = v;
6653 sector_t sectors; 6653 sector_t sectors;
6654 struct md_rdev *rdev; 6654 struct md_rdev *rdev;
6655 struct bitmap *bitmap; 6655 struct bitmap *bitmap;
@@ -6829,7 +6829,7 @@ int unregister_md_personality(struct mdk_personality *p)
6829 return 0; 6829 return 0;
6830} 6830}
6831 6831
6832static int is_mddev_idle(mddev_t *mddev, int init) 6832static int is_mddev_idle(struct mddev *mddev, int init)
6833{ 6833{
6834 struct md_rdev * rdev; 6834 struct md_rdev * rdev;
6835 int idle; 6835 int idle;
@@ -6873,7 +6873,7 @@ static int is_mddev_idle(mddev_t *mddev, int init)
6873 return idle; 6873 return idle;
6874} 6874}
6875 6875
6876void md_done_sync(mddev_t *mddev, int blocks, int ok) 6876void md_done_sync(struct mddev *mddev, int blocks, int ok)
6877{ 6877{
6878 /* another "blocks" (512byte) blocks have been synced */ 6878 /* another "blocks" (512byte) blocks have been synced */
6879 atomic_sub(blocks, &mddev->recovery_active); 6879 atomic_sub(blocks, &mddev->recovery_active);
@@ -6891,7 +6891,7 @@ void md_done_sync(mddev_t *mddev, int blocks, int ok)
6891 * in superblock) before writing, schedule a superblock update 6891 * in superblock) before writing, schedule a superblock update
6892 * and wait for it to complete. 6892 * and wait for it to complete.
6893 */ 6893 */
6894void md_write_start(mddev_t *mddev, struct bio *bi) 6894void md_write_start(struct mddev *mddev, struct bio *bi)
6895{ 6895{
6896 int did_change = 0; 6896 int did_change = 0;
6897 if (bio_data_dir(bi) != WRITE) 6897 if (bio_data_dir(bi) != WRITE)
@@ -6926,7 +6926,7 @@ void md_write_start(mddev_t *mddev, struct bio *bi)
6926 !test_bit(MD_CHANGE_PENDING, &mddev->flags)); 6926 !test_bit(MD_CHANGE_PENDING, &mddev->flags));
6927} 6927}
6928 6928
6929void md_write_end(mddev_t *mddev) 6929void md_write_end(struct mddev *mddev)
6930{ 6930{
6931 if (atomic_dec_and_test(&mddev->writes_pending)) { 6931 if (atomic_dec_and_test(&mddev->writes_pending)) {
6932 if (mddev->safemode == 2) 6932 if (mddev->safemode == 2)
@@ -6945,7 +6945,7 @@ void md_write_end(mddev_t *mddev)
6945 * In the ->external case MD_CHANGE_CLEAN can not be cleared until mddev->lock 6945 * In the ->external case MD_CHANGE_CLEAN can not be cleared until mddev->lock
6946 * is dropped, so return -EAGAIN after notifying userspace. 6946 * is dropped, so return -EAGAIN after notifying userspace.
6947 */ 6947 */
6948int md_allow_write(mddev_t *mddev) 6948int md_allow_write(struct mddev *mddev)
6949{ 6949{
6950 if (!mddev->pers) 6950 if (!mddev->pers)
6951 return 0; 6951 return 0;
@@ -6977,9 +6977,9 @@ EXPORT_SYMBOL_GPL(md_allow_write);
6977 6977
6978#define SYNC_MARKS 10 6978#define SYNC_MARKS 10
6979#define SYNC_MARK_STEP (3*HZ) 6979#define SYNC_MARK_STEP (3*HZ)
6980void md_do_sync(mddev_t *mddev) 6980void md_do_sync(struct mddev *mddev)
6981{ 6981{
6982 mddev_t *mddev2; 6982 struct mddev *mddev2;
6983 unsigned int currspeed = 0, 6983 unsigned int currspeed = 0,
6984 window; 6984 window;
6985 sector_t max_sectors,j, io_sectors; 6985 sector_t max_sectors,j, io_sectors;
@@ -7304,7 +7304,7 @@ void md_do_sync(mddev_t *mddev)
7304} 7304}
7305EXPORT_SYMBOL_GPL(md_do_sync); 7305EXPORT_SYMBOL_GPL(md_do_sync);
7306 7306
7307static int remove_and_add_spares(mddev_t *mddev) 7307static int remove_and_add_spares(struct mddev *mddev)
7308{ 7308{
7309 struct md_rdev *rdev; 7309 struct md_rdev *rdev;
7310 int spares = 0; 7310 int spares = 0;
@@ -7348,7 +7348,7 @@ static int remove_and_add_spares(mddev_t *mddev)
7348 return spares; 7348 return spares;
7349} 7349}
7350 7350
7351static void reap_sync_thread(mddev_t *mddev) 7351static void reap_sync_thread(struct mddev *mddev)
7352{ 7352{
7353 struct md_rdev *rdev; 7353 struct md_rdev *rdev;
7354 7354
@@ -7409,7 +7409,7 @@ static void reap_sync_thread(mddev_t *mddev)
7409 * 5/ If array is degraded, try to add spares devices 7409 * 5/ If array is degraded, try to add spares devices
7410 * 6/ If array has spares or is not in-sync, start a resync thread. 7410 * 6/ If array has spares or is not in-sync, start a resync thread.
7411 */ 7411 */
7412void md_check_recovery(mddev_t *mddev) 7412void md_check_recovery(struct mddev *mddev)
7413{ 7413{
7414 if (mddev->suspended) 7414 if (mddev->suspended)
7415 return; 7415 return;
@@ -7569,7 +7569,7 @@ void md_check_recovery(mddev_t *mddev)
7569 } 7569 }
7570} 7570}
7571 7571
7572void md_wait_for_blocked_rdev(struct md_rdev *rdev, mddev_t *mddev) 7572void md_wait_for_blocked_rdev(struct md_rdev *rdev, struct mddev *mddev)
7573{ 7573{
7574 sysfs_notify_dirent_safe(rdev->sysfs_state); 7574 sysfs_notify_dirent_safe(rdev->sysfs_state);
7575 wait_event_timeout(rdev->blocked_wait, 7575 wait_event_timeout(rdev->blocked_wait,
@@ -8070,7 +8070,7 @@ static int md_notify_reboot(struct notifier_block *this,
8070 unsigned long code, void *x) 8070 unsigned long code, void *x)
8071{ 8071{
8072 struct list_head *tmp; 8072 struct list_head *tmp;
8073 mddev_t *mddev; 8073 struct mddev *mddev;
8074 int need_delay = 0; 8074 int need_delay = 0;
8075 8075
8076 if ((code == SYS_DOWN) || (code == SYS_HALT) || (code == SYS_POWER_OFF)) { 8076 if ((code == SYS_DOWN) || (code == SYS_HALT) || (code == SYS_POWER_OFF)) {
@@ -8223,7 +8223,7 @@ static void autostart_arrays(int part)
8223 8223
8224static __exit void md_exit(void) 8224static __exit void md_exit(void)
8225{ 8225{
8226 mddev_t *mddev; 8226 struct mddev *mddev;
8227 struct list_head *tmp; 8227 struct list_head *tmp;
8228 8228
8229 blk_unregister_region(MKDEV(MD_MAJOR,0), 1U << MINORBITS); 8229 blk_unregister_region(MKDEV(MD_MAJOR,0), 1U << MINORBITS);