aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.h
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-10-11 01:47:53 -0400
committerNeilBrown <neilb@suse.de>2011-10-11 01:47:53 -0400
commitfd01b88c75a718020ff77e7f560d33835e9b58de (patch)
treec455d5adefd58f3263dcf265bb8ba2024523b106 /drivers/md/md.h
parent3cb03002000f133f9f97269edefd73611eafc873 (diff)
md: remove typedefs: mddev_t -> struct mddev
Having mddev_t and 'struct mddev_s' is ugly and not preferred Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.h')
-rw-r--r--drivers/md/md.h115
1 files changed, 56 insertions, 59 deletions
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 @@
26 26
27#define MaxSector (~(sector_t)0) 27#define MaxSector (~(sector_t)0)
28 28
29typedef struct mddev_s mddev_t;
30
31/* Bad block numbers are stored sorted in a single page. 29/* Bad block numbers are stored sorted in a single page.
32 * 64bits is used for each block or extent. 30 * 64bits is used for each block or extent.
33 * 54 bits are sector number, 9 bits are extent size, 31 * 54 bits are sector number, 9 bits are extent size,
@@ -42,7 +40,7 @@ struct md_rdev {
42 struct list_head same_set; /* RAID devices within the same set */ 40 struct list_head same_set; /* RAID devices within the same set */
43 41
44 sector_t sectors; /* Device size (in 512bytes sectors) */ 42 sector_t sectors; /* Device size (in 512bytes sectors) */
45 mddev_t *mddev; /* RAID array if running */ 43 struct mddev *mddev; /* RAID array if running */
46 int last_events; /* IO event timestamp */ 44 int last_events; /* IO event timestamp */
47 45
48 /* 46 /*
@@ -184,8 +182,7 @@ extern int rdev_set_badblocks(struct md_rdev *rdev, sector_t s, int sectors,
184extern int rdev_clear_badblocks(struct md_rdev *rdev, sector_t s, int sectors); 182extern int rdev_clear_badblocks(struct md_rdev *rdev, sector_t s, int sectors);
185extern void md_ack_all_badblocks(struct badblocks *bb); 183extern void md_ack_all_badblocks(struct badblocks *bb);
186 184
187struct mddev_s 185struct mddev {
188{
189 void *private; 186 void *private;
190 struct mdk_personality *pers; 187 struct mdk_personality *pers;
191 dev_t unit; 188 dev_t unit;
@@ -400,11 +397,11 @@ struct mddev_s
400 atomic_t flush_pending; 397 atomic_t flush_pending;
401 struct work_struct flush_work; 398 struct work_struct flush_work;
402 struct work_struct event_work; /* used by dm to report failure event */ 399 struct work_struct event_work; /* used by dm to report failure event */
403 void (*sync_super)(mddev_t *mddev, struct md_rdev *rdev); 400 void (*sync_super)(struct mddev *mddev, struct md_rdev *rdev);
404}; 401};
405 402
406 403
407static inline void rdev_dec_pending(struct md_rdev *rdev, mddev_t *mddev) 404static inline void rdev_dec_pending(struct md_rdev *rdev, struct mddev *mddev)
408{ 405{
409 int faulty = test_bit(Faulty, &rdev->flags); 406 int faulty = test_bit(Faulty, &rdev->flags);
410 if (atomic_dec_and_test(&rdev->nr_pending) && faulty) 407 if (atomic_dec_and_test(&rdev->nr_pending) && faulty)
@@ -422,29 +419,29 @@ struct mdk_personality
422 int level; 419 int level;
423 struct list_head list; 420 struct list_head list;
424 struct module *owner; 421 struct module *owner;
425 int (*make_request)(mddev_t *mddev, struct bio *bio); 422 int (*make_request)(struct mddev *mddev, struct bio *bio);
426 int (*run)(mddev_t *mddev); 423 int (*run)(struct mddev *mddev);
427 int (*stop)(mddev_t *mddev); 424 int (*stop)(struct mddev *mddev);
428 void (*status)(struct seq_file *seq, mddev_t *mddev); 425 void (*status)(struct seq_file *seq, struct mddev *mddev);
429 /* error_handler must set ->faulty and clear ->in_sync 426 /* error_handler must set ->faulty and clear ->in_sync
430 * if appropriate, and should abort recovery if needed 427 * if appropriate, and should abort recovery if needed
431 */ 428 */
432 void (*error_handler)(mddev_t *mddev, struct md_rdev *rdev); 429 void (*error_handler)(struct mddev *mddev, struct md_rdev *rdev);
433 int (*hot_add_disk) (mddev_t *mddev, struct md_rdev *rdev); 430 int (*hot_add_disk) (struct mddev *mddev, struct md_rdev *rdev);
434 int (*hot_remove_disk) (mddev_t *mddev, int number); 431 int (*hot_remove_disk) (struct mddev *mddev, int number);
435 int (*spare_active) (mddev_t *mddev); 432 int (*spare_active) (struct mddev *mddev);
436 sector_t (*sync_request)(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster); 433 sector_t (*sync_request)(struct mddev *mddev, sector_t sector_nr, int *skipped, int go_faster);
437 int (*resize) (mddev_t *mddev, sector_t sectors); 434 int (*resize) (struct mddev *mddev, sector_t sectors);
438 sector_t (*size) (mddev_t *mddev, sector_t sectors, int raid_disks); 435 sector_t (*size) (struct mddev *mddev, sector_t sectors, int raid_disks);
439 int (*check_reshape) (mddev_t *mddev); 436 int (*check_reshape) (struct mddev *mddev);
440 int (*start_reshape) (mddev_t *mddev); 437 int (*start_reshape) (struct mddev *mddev);
441 void (*finish_reshape) (mddev_t *mddev); 438 void (*finish_reshape) (struct mddev *mddev);
442 /* quiesce moves between quiescence states 439 /* quiesce moves between quiescence states
443 * 0 - fully active 440 * 0 - fully active
444 * 1 - no new requests allowed 441 * 1 - no new requests allowed
445 * others - reserved 442 * others - reserved
446 */ 443 */
447 void (*quiesce) (mddev_t *mddev, int state); 444 void (*quiesce) (struct mddev *mddev, int state);
448 /* takeover is used to transition an array from one 445 /* takeover is used to transition an array from one
449 * personality to another. The new personality must be able 446 * personality to another. The new personality must be able
450 * to handle the data in the current layout. 447 * to handle the data in the current layout.
@@ -454,14 +451,14 @@ struct mdk_personality
454 * This needs to be installed and then ->run used to activate the 451 * This needs to be installed and then ->run used to activate the
455 * array. 452 * array.
456 */ 453 */
457 void *(*takeover) (mddev_t *mddev); 454 void *(*takeover) (struct mddev *mddev);
458}; 455};
459 456
460 457
461struct md_sysfs_entry { 458struct md_sysfs_entry {
462 struct attribute attr; 459 struct attribute attr;
463 ssize_t (*show)(mddev_t *, char *); 460 ssize_t (*show)(struct mddev *, char *);
464 ssize_t (*store)(mddev_t *, const char *, size_t); 461 ssize_t (*store)(struct mddev *, const char *, size_t);
465}; 462};
466extern struct attribute_group md_bitmap_group; 463extern struct attribute_group md_bitmap_group;
467 464
@@ -477,19 +474,19 @@ static inline void sysfs_notify_dirent_safe(struct sysfs_dirent *sd)
477 sysfs_notify_dirent(sd); 474 sysfs_notify_dirent(sd);
478} 475}
479 476
480static inline char * mdname (mddev_t * mddev) 477static inline char * mdname (struct mddev * mddev)
481{ 478{
482 return mddev->gendisk ? mddev->gendisk->disk_name : "mdX"; 479 return mddev->gendisk ? mddev->gendisk->disk_name : "mdX";
483} 480}
484 481
485static inline int sysfs_link_rdev(mddev_t *mddev, struct md_rdev *rdev) 482static inline int sysfs_link_rdev(struct mddev *mddev, struct md_rdev *rdev)
486{ 483{
487 char nm[20]; 484 char nm[20];
488 sprintf(nm, "rd%d", rdev->raid_disk); 485 sprintf(nm, "rd%d", rdev->raid_disk);
489 return sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); 486 return sysfs_create_link(&mddev->kobj, &rdev->kobj, nm);
490} 487}
491 488
492static inline void sysfs_unlink_rdev(mddev_t *mddev, struct md_rdev *rdev) 489static inline void sysfs_unlink_rdev(struct mddev *mddev, struct md_rdev *rdev)
493{ 490{
494 char nm[20]; 491 char nm[20];
495 sprintf(nm, "rd%d", rdev->raid_disk); 492 sprintf(nm, "rd%d", rdev->raid_disk);
@@ -513,8 +510,8 @@ static inline void sysfs_unlink_rdev(mddev_t *mddev, struct md_rdev *rdev)
513 list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set) 510 list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set)
514 511
515typedef struct mdk_thread_s { 512typedef struct mdk_thread_s {
516 void (*run) (mddev_t *mddev); 513 void (*run) (struct mddev *mddev);
517 mddev_t *mddev; 514 struct mddev *mddev;
518 wait_queue_head_t wqueue; 515 wait_queue_head_t wqueue;
519 unsigned long flags; 516 unsigned long flags;
520 struct task_struct *tsk; 517 struct task_struct *tsk;
@@ -556,46 +553,46 @@ static inline void safe_put_page(struct page *p)
556 553
557extern int register_md_personality(struct mdk_personality *p); 554extern int register_md_personality(struct mdk_personality *p);
558extern int unregister_md_personality(struct mdk_personality *p); 555extern int unregister_md_personality(struct mdk_personality *p);
559extern mdk_thread_t * md_register_thread(void (*run) (mddev_t *mddev), 556extern mdk_thread_t * md_register_thread(void (*run) (struct mddev *mddev),
560 mddev_t *mddev, const char *name); 557 struct mddev *mddev, const char *name);
561extern void md_unregister_thread(mdk_thread_t **threadp); 558extern void md_unregister_thread(mdk_thread_t **threadp);
562extern void md_wakeup_thread(mdk_thread_t *thread); 559extern void md_wakeup_thread(mdk_thread_t *thread);
563extern void md_check_recovery(mddev_t *mddev); 560extern void md_check_recovery(struct mddev *mddev);
564extern void md_write_start(mddev_t *mddev, struct bio *bi); 561extern void md_write_start(struct mddev *mddev, struct bio *bi);
565extern void md_write_end(mddev_t *mddev); 562extern void md_write_end(struct mddev *mddev);
566extern void md_done_sync(mddev_t *mddev, int blocks, int ok); 563extern void md_done_sync(struct mddev *mddev, int blocks, int ok);
567extern void md_error(mddev_t *mddev, struct md_rdev *rdev); 564extern void md_error(struct mddev *mddev, struct md_rdev *rdev);
568 565
569extern int mddev_congested(mddev_t *mddev, int bits); 566extern int mddev_congested(struct mddev *mddev, int bits);
570extern void md_flush_request(mddev_t *mddev, struct bio *bio); 567extern void md_flush_request(struct mddev *mddev, struct bio *bio);
571extern void md_super_write(mddev_t *mddev, struct md_rdev *rdev, 568extern void md_super_write(struct mddev *mddev, struct md_rdev *rdev,
572 sector_t sector, int size, struct page *page); 569 sector_t sector, int size, struct page *page);
573extern void md_super_wait(mddev_t *mddev); 570extern void md_super_wait(struct mddev *mddev);
574extern int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, 571extern int sync_page_io(struct md_rdev *rdev, sector_t sector, int size,
575 struct page *page, int rw, bool metadata_op); 572 struct page *page, int rw, bool metadata_op);
576extern void md_do_sync(mddev_t *mddev); 573extern void md_do_sync(struct mddev *mddev);
577extern void md_new_event(mddev_t *mddev); 574extern void md_new_event(struct mddev *mddev);
578extern int md_allow_write(mddev_t *mddev); 575extern int md_allow_write(struct mddev *mddev);
579extern void md_wait_for_blocked_rdev(struct md_rdev *rdev, mddev_t *mddev); 576extern void md_wait_for_blocked_rdev(struct md_rdev *rdev, struct mddev *mddev);
580extern void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors); 577extern void md_set_array_sectors(struct mddev *mddev, sector_t array_sectors);
581extern int md_check_no_bitmap(mddev_t *mddev); 578extern int md_check_no_bitmap(struct mddev *mddev);
582extern int md_integrity_register(mddev_t *mddev); 579extern int md_integrity_register(struct mddev *mddev);
583extern void md_integrity_add_rdev(struct md_rdev *rdev, mddev_t *mddev); 580extern void md_integrity_add_rdev(struct md_rdev *rdev, struct mddev *mddev);
584extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale); 581extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale);
585extern void restore_bitmap_write_access(struct file *file); 582extern void restore_bitmap_write_access(struct file *file);
586 583
587extern void mddev_init(mddev_t *mddev); 584extern void mddev_init(struct mddev *mddev);
588extern int md_run(mddev_t *mddev); 585extern int md_run(struct mddev *mddev);
589extern void md_stop(mddev_t *mddev); 586extern void md_stop(struct mddev *mddev);
590extern void md_stop_writes(mddev_t *mddev); 587extern void md_stop_writes(struct mddev *mddev);
591extern int md_rdev_init(struct md_rdev *rdev); 588extern int md_rdev_init(struct md_rdev *rdev);
592 589
593extern void mddev_suspend(mddev_t *mddev); 590extern void mddev_suspend(struct mddev *mddev);
594extern void mddev_resume(mddev_t *mddev); 591extern void mddev_resume(struct mddev *mddev);
595extern struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask, 592extern struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask,
596 mddev_t *mddev); 593 struct mddev *mddev);
597extern struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, 594extern struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs,
598 mddev_t *mddev); 595 struct mddev *mddev);
599extern int mddev_check_plugged(mddev_t *mddev); 596extern int mddev_check_plugged(struct mddev *mddev);
600extern void md_trim_bio(struct bio *bio, int offset, int size); 597extern void md_trim_bio(struct bio *bio, int offset, int size);
601#endif /* _MD_MD_H */ 598#endif /* _MD_MD_H */