aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/md.h')
-rw-r--r--drivers/md/md.h34
1 files changed, 16 insertions, 18 deletions
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 @@
27#define MaxSector (~(sector_t)0) 27#define MaxSector (~(sector_t)0)
28 28
29typedef struct mddev_s mddev_t; 29typedef struct mddev_s mddev_t;
30typedef struct mdk_rdev_s mdk_rdev_t;
31 30
32/* Bad block numbers are stored sorted in a single page. 31/* Bad block numbers are stored sorted in a single page.
33 * 64bits is used for each block or extent. 32 * 64bits is used for each block or extent.
@@ -39,8 +38,7 @@ typedef struct mdk_rdev_s mdk_rdev_t;
39/* 38/*
40 * MD's 'extended' device 39 * MD's 'extended' device
41 */ 40 */
42struct mdk_rdev_s 41struct md_rdev {
43{
44 struct list_head same_set; /* RAID devices within the same set */ 42 struct list_head same_set; /* RAID devices within the same set */
45 43
46 sector_t sectors; /* Device size (in 512bytes sectors) */ 44 sector_t sectors; /* Device size (in 512bytes sectors) */
@@ -168,7 +166,7 @@ struct mdk_rdev_s
168 166
169extern int md_is_badblock(struct badblocks *bb, sector_t s, int sectors, 167extern int md_is_badblock(struct badblocks *bb, sector_t s, int sectors,
170 sector_t *first_bad, int *bad_sectors); 168 sector_t *first_bad, int *bad_sectors);
171static inline int is_badblock(mdk_rdev_t *rdev, sector_t s, int sectors, 169static inline int is_badblock(struct md_rdev *rdev, sector_t s, int sectors,
172 sector_t *first_bad, int *bad_sectors) 170 sector_t *first_bad, int *bad_sectors)
173{ 171{
174 if (unlikely(rdev->badblocks.count)) { 172 if (unlikely(rdev->badblocks.count)) {
@@ -181,9 +179,9 @@ static inline int is_badblock(mdk_rdev_t *rdev, sector_t s, int sectors,
181 } 179 }
182 return 0; 180 return 0;
183} 181}
184extern int rdev_set_badblocks(mdk_rdev_t *rdev, sector_t s, int sectors, 182extern int rdev_set_badblocks(struct md_rdev *rdev, sector_t s, int sectors,
185 int acknowledged); 183 int acknowledged);
186extern int rdev_clear_badblocks(mdk_rdev_t *rdev, sector_t s, int sectors); 184extern int rdev_clear_badblocks(struct md_rdev *rdev, sector_t s, int sectors);
187extern void md_ack_all_badblocks(struct badblocks *bb); 185extern void md_ack_all_badblocks(struct badblocks *bb);
188 186
189struct mddev_s 187struct mddev_s
@@ -402,11 +400,11 @@ struct mddev_s
402 atomic_t flush_pending; 400 atomic_t flush_pending;
403 struct work_struct flush_work; 401 struct work_struct flush_work;
404 struct work_struct event_work; /* used by dm to report failure event */ 402 struct work_struct event_work; /* used by dm to report failure event */
405 void (*sync_super)(mddev_t *mddev, mdk_rdev_t *rdev); 403 void (*sync_super)(mddev_t *mddev, struct md_rdev *rdev);
406}; 404};
407 405
408 406
409static inline void rdev_dec_pending(mdk_rdev_t *rdev, mddev_t *mddev) 407static inline void rdev_dec_pending(struct md_rdev *rdev, mddev_t *mddev)
410{ 408{
411 int faulty = test_bit(Faulty, &rdev->flags); 409 int faulty = test_bit(Faulty, &rdev->flags);
412 if (atomic_dec_and_test(&rdev->nr_pending) && faulty) 410 if (atomic_dec_and_test(&rdev->nr_pending) && faulty)
@@ -431,8 +429,8 @@ struct mdk_personality
431 /* error_handler must set ->faulty and clear ->in_sync 429 /* error_handler must set ->faulty and clear ->in_sync
432 * if appropriate, and should abort recovery if needed 430 * if appropriate, and should abort recovery if needed
433 */ 431 */
434 void (*error_handler)(mddev_t *mddev, mdk_rdev_t *rdev); 432 void (*error_handler)(mddev_t *mddev, struct md_rdev *rdev);
435 int (*hot_add_disk) (mddev_t *mddev, mdk_rdev_t *rdev); 433 int (*hot_add_disk) (mddev_t *mddev, struct md_rdev *rdev);
436 int (*hot_remove_disk) (mddev_t *mddev, int number); 434 int (*hot_remove_disk) (mddev_t *mddev, int number);
437 int (*spare_active) (mddev_t *mddev); 435 int (*spare_active) (mddev_t *mddev);
438 sector_t (*sync_request)(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster); 436 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)
484 return mddev->gendisk ? mddev->gendisk->disk_name : "mdX"; 482 return mddev->gendisk ? mddev->gendisk->disk_name : "mdX";
485} 483}
486 484
487static inline int sysfs_link_rdev(mddev_t *mddev, mdk_rdev_t *rdev) 485static inline int sysfs_link_rdev(mddev_t *mddev, struct md_rdev *rdev)
488{ 486{
489 char nm[20]; 487 char nm[20];
490 sprintf(nm, "rd%d", rdev->raid_disk); 488 sprintf(nm, "rd%d", rdev->raid_disk);
491 return sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); 489 return sysfs_create_link(&mddev->kobj, &rdev->kobj, nm);
492} 490}
493 491
494static inline void sysfs_unlink_rdev(mddev_t *mddev, mdk_rdev_t *rdev) 492static inline void sysfs_unlink_rdev(mddev_t *mddev, struct md_rdev *rdev)
495{ 493{
496 char nm[20]; 494 char nm[20];
497 sprintf(nm, "rd%d", rdev->raid_disk); 495 sprintf(nm, "rd%d", rdev->raid_disk);
@@ -566,23 +564,23 @@ extern void md_check_recovery(mddev_t *mddev);
566extern void md_write_start(mddev_t *mddev, struct bio *bi); 564extern void md_write_start(mddev_t *mddev, struct bio *bi);
567extern void md_write_end(mddev_t *mddev); 565extern void md_write_end(mddev_t *mddev);
568extern void md_done_sync(mddev_t *mddev, int blocks, int ok); 566extern void md_done_sync(mddev_t *mddev, int blocks, int ok);
569extern void md_error(mddev_t *mddev, mdk_rdev_t *rdev); 567extern void md_error(mddev_t *mddev, struct md_rdev *rdev);
570 568
571extern int mddev_congested(mddev_t *mddev, int bits); 569extern int mddev_congested(mddev_t *mddev, int bits);
572extern void md_flush_request(mddev_t *mddev, struct bio *bio); 570extern void md_flush_request(mddev_t *mddev, struct bio *bio);
573extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, 571extern void md_super_write(mddev_t *mddev, struct md_rdev *rdev,
574 sector_t sector, int size, struct page *page); 572 sector_t sector, int size, struct page *page);
575extern void md_super_wait(mddev_t *mddev); 573extern void md_super_wait(mddev_t *mddev);
576extern int sync_page_io(mdk_rdev_t *rdev, sector_t sector, int size, 574extern int sync_page_io(struct md_rdev *rdev, sector_t sector, int size,
577 struct page *page, int rw, bool metadata_op); 575 struct page *page, int rw, bool metadata_op);
578extern void md_do_sync(mddev_t *mddev); 576extern void md_do_sync(mddev_t *mddev);
579extern void md_new_event(mddev_t *mddev); 577extern void md_new_event(mddev_t *mddev);
580extern int md_allow_write(mddev_t *mddev); 578extern int md_allow_write(mddev_t *mddev);
581extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev); 579extern void md_wait_for_blocked_rdev(struct md_rdev *rdev, mddev_t *mddev);
582extern void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors); 580extern void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors);
583extern int md_check_no_bitmap(mddev_t *mddev); 581extern int md_check_no_bitmap(mddev_t *mddev);
584extern int md_integrity_register(mddev_t *mddev); 582extern int md_integrity_register(mddev_t *mddev);
585extern void md_integrity_add_rdev(mdk_rdev_t *rdev, mddev_t *mddev); 583extern void md_integrity_add_rdev(struct md_rdev *rdev, mddev_t *mddev);
586extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale); 584extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale);
587extern void restore_bitmap_write_access(struct file *file); 585extern void restore_bitmap_write_access(struct file *file);
588 586
@@ -590,7 +588,7 @@ extern void mddev_init(mddev_t *mddev);
590extern int md_run(mddev_t *mddev); 588extern int md_run(mddev_t *mddev);
591extern void md_stop(mddev_t *mddev); 589extern void md_stop(mddev_t *mddev);
592extern void md_stop_writes(mddev_t *mddev); 590extern void md_stop_writes(mddev_t *mddev);
593extern int md_rdev_init(mdk_rdev_t *rdev); 591extern int md_rdev_init(struct md_rdev *rdev);
594 592
595extern void mddev_suspend(mddev_t *mddev); 593extern void mddev_suspend(mddev_t *mddev);
596extern void mddev_resume(mddev_t *mddev); 594extern void mddev_resume(mddev_t *mddev);