diff options
| author | Neil Brown <neilb@cse.unsw.edu.au> | 2002-06-18 04:16:49 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-06-18 04:16:49 -0700 |
| commit | 932db78f92b35676e1ff4ab90a1c046cbb940294 (patch) | |
| tree | 49de61f59275e99142c03e1fcb706161c6b1ee00 | |
| parent | 8892097cf216b110819a427a9bc639c2b7437eb9 (diff) | |
[PATCH] md 12 of 22 - Remove "data" from dev_mapping and tidy up
The mapping from minor number to mddev structure allows for a
'data' that is never used. This patch removes that and explicitly
inlines some inline functions that become trivial.
mddev_map also becomes completely local to md.c
| -rw-r--r-- | drivers/md/md.c | 52 | ||||
| -rw-r--r-- | include/linux/raid/md.h | 2 | ||||
| -rw-r--r-- | include/linux/raid/md_k.h | 18 |
3 files changed, 8 insertions, 64 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 081f7202600f..31f5a24081f8 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -130,43 +130,13 @@ static struct gendisk md_gendisk= */ static LIST_HEAD(all_mddevs); -/* - * The mapping between kdev and mddev is not necessary a simple - * one! Eg. HSM uses several sub-devices to implement Logical - * Volumes. All these sub-devices map to the same mddev. - */ -dev_mapping_t mddev_map[MAX_MD_DEVS]; +static mddev_t *mddev_map[MAX_MD_DEVS]; -void add_mddev_mapping(mddev_t * mddev, kdev_t dev, void *data) +static inline mddev_t * kdev_to_mddev (kdev_t dev) { - unsigned int minor = minor(dev); - - if (major(dev) != MD_MAJOR) { - MD_BUG(); - return; - } - if (mddev_map[minor].mddev) { - MD_BUG(); - return; - } - mddev_map[minor].mddev = mddev; - mddev_map[minor].data = data; -} - -void del_mddev_mapping(mddev_t * mddev, kdev_t dev) -{ - unsigned int minor = minor(dev); - - if (major(dev) != MD_MAJOR) { - MD_BUG(); - return; - } - if (mddev_map[minor].mddev != mddev) { - MD_BUG(); - return; - } - mddev_map[minor].mddev = NULL; - mddev_map[minor].data = NULL; + if (major(dev) != MD_MAJOR) + BUG(); + return mddev_map[minor(dev)]; } static int md_fail_request (request_queue_t *q, struct bio *bio) @@ -197,12 +167,7 @@ static mddev_t * alloc_mddev(kdev_t dev) INIT_LIST_HEAD(&mddev->all_mddevs); atomic_set(&mddev->active, 0); - /* - * The 'base' mddev is the one with data NULL. - * personalities can create additional mddevs - * if necessary. - */ - add_mddev_mapping(mddev, dev, 0); + mddev_map[mdidx(mddev)] = mddev; list_add(&mddev->all_mddevs, &all_mddevs); MOD_INC_USE_COUNT; @@ -667,7 +632,7 @@ static void free_mddev(mddev_t *mddev) while (atomic_read(&mddev->recovery_sem.count) != 1) schedule(); - del_mddev_mapping(mddev, mk_kdev(MD_MAJOR, mdidx(mddev))); + mddev_map[mdidx(mddev)] = NULL; list_del(&mddev->all_mddevs); kfree(mddev); MOD_DEC_USE_COUNT; @@ -3723,7 +3688,7 @@ void __init md_setup_drive(void) if (!md_setup_args.device_set[minor]) continue; - if (mddev_map[minor].mddev) { + if (mddev_map[minor]) { printk(KERN_WARNING "md: Ignoring md=%d, already autodetected. (Use raid=noautodetect)\n", minor); @@ -3882,6 +3847,5 @@ EXPORT_SYMBOL(md_wakeup_thread); EXPORT_SYMBOL(md_print_devices); EXPORT_SYMBOL(find_rdev_nr); EXPORT_SYMBOL(md_interrupt_thread); -EXPORT_SYMBOL(mddev_map); EXPORT_SYMBOL(get_spare); MODULE_LICENSE("GPL"); diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h index c5516ee0c732..5d450aaf13d1 100644 --- a/include/linux/raid/md.h +++ b/include/linux/raid/md.h @@ -63,8 +63,6 @@ extern int md_size[MAX_MD_DEVS]; extern struct hd_struct md_hd_struct[MAX_MD_DEVS]; -extern void add_mddev_mapping (mddev_t *mddev, kdev_t dev, void *data); -extern void del_mddev_mapping (mddev_t *mddev, kdev_t dev); extern char * partition_name (kdev_t dev); extern inline char * bdev_partition_name (struct block_device *bdev) { diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index 69466cd714e7..d29630ebec43 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h @@ -65,24 +65,6 @@ typedef struct mdk_rdev_s mdk_rdev_t; #define MAX_MD_DEVS (1<<MINORBITS) /* Max number of md dev */ /* - * Maps a kdev to an mddev/subdev. How 'data' is handled is up to - * the personality. (eg. HSM uses this to identify individual LVs) - */ -typedef struct dev_mapping_s { - mddev_t *mddev; - void *data; -} dev_mapping_t; - -extern dev_mapping_t mddev_map [MAX_MD_DEVS]; - -static inline mddev_t * kdev_to_mddev (kdev_t dev) -{ - if (major(dev) != MD_MAJOR) - BUG(); - return mddev_map[minor(dev)].mddev; -} - -/* * options passed in raidrun: */ |
