aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-ioctl.c30
-rw-r--r--drivers/md/dm.c2
-rw-r--r--drivers/md/md.c30
3 files changed, 4 insertions, 58 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index 3edb3477f987..d13bb15a8a02 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -13,7 +13,6 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/wait.h> 14#include <linux/wait.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/devfs_fs_kernel.h>
17#include <linux/dm-ioctl.h> 16#include <linux/dm-ioctl.h>
18#include <linux/hdreg.h> 17#include <linux/hdreg.h>
19 18
@@ -68,14 +67,12 @@ static int dm_hash_init(void)
68{ 67{
69 init_buckets(_name_buckets); 68 init_buckets(_name_buckets);
70 init_buckets(_uuid_buckets); 69 init_buckets(_uuid_buckets);
71 devfs_mk_dir(DM_DIR);
72 return 0; 70 return 0;
73} 71}
74 72
75static void dm_hash_exit(void) 73static void dm_hash_exit(void)
76{ 74{
77 dm_hash_remove_all(0); 75 dm_hash_remove_all(0);
78 devfs_remove(DM_DIR);
79} 76}
80 77
81/*----------------------------------------------------------------- 78/*-----------------------------------------------------------------
@@ -172,25 +169,6 @@ static void free_cell(struct hash_cell *hc)
172} 169}
173 170
174/* 171/*
175 * devfs stuff.
176 */
177static int register_with_devfs(struct hash_cell *hc)
178{
179 struct gendisk *disk = dm_disk(hc->md);
180
181 devfs_mk_bdev(MKDEV(disk->major, disk->first_minor),
182 S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP,
183 DM_DIR "/%s", hc->name);
184 return 0;
185}
186
187static int unregister_with_devfs(struct hash_cell *hc)
188{
189 devfs_remove(DM_DIR"/%s", hc->name);
190 return 0;
191}
192
193/*
194 * The kdev_t and uuid of a device can never change once it is 172 * The kdev_t and uuid of a device can never change once it is
195 * initially inserted. 173 * initially inserted.
196 */ 174 */
@@ -226,7 +204,6 @@ static int dm_hash_insert(const char *name, const char *uuid, struct mapped_devi
226 } 204 }
227 list_add(&cell->uuid_list, _uuid_buckets + hash_str(uuid)); 205 list_add(&cell->uuid_list, _uuid_buckets + hash_str(uuid));
228 } 206 }
229 register_with_devfs(cell);
230 dm_get(md); 207 dm_get(md);
231 dm_set_mdptr(md, cell); 208 dm_set_mdptr(md, cell);
232 up_write(&_hash_lock); 209 up_write(&_hash_lock);
@@ -246,7 +223,6 @@ static void __hash_remove(struct hash_cell *hc)
246 /* remove from the dev hash */ 223 /* remove from the dev hash */
247 list_del(&hc->uuid_list); 224 list_del(&hc->uuid_list);
248 list_del(&hc->name_list); 225 list_del(&hc->name_list);
249 unregister_with_devfs(hc);
250 dm_set_mdptr(hc->md, NULL); 226 dm_set_mdptr(hc->md, NULL);
251 227
252 table = dm_get_table(hc->md); 228 table = dm_get_table(hc->md);
@@ -342,16 +318,11 @@ static int dm_hash_rename(const char *old, const char *new)
342 /* 318 /*
343 * rename and move the name cell. 319 * rename and move the name cell.
344 */ 320 */
345 unregister_with_devfs(hc);
346
347 list_del(&hc->name_list); 321 list_del(&hc->name_list);
348 old_name = hc->name; 322 old_name = hc->name;
349 hc->name = new_name; 323 hc->name = new_name;
350 list_add(&hc->name_list, _name_buckets + hash_str(new_name)); 324 list_add(&hc->name_list, _name_buckets + hash_str(new_name));
351 325
352 /* rename the device node in devfs */
353 register_with_devfs(hc);
354
355 /* 326 /*
356 * Wake up any dm event waiters. 327 * Wake up any dm event waiters.
357 */ 328 */
@@ -1501,7 +1472,6 @@ static struct file_operations _ctl_fops = {
1501static struct miscdevice _dm_misc = { 1472static struct miscdevice _dm_misc = {
1502 .minor = MISC_DYNAMIC_MINOR, 1473 .minor = MISC_DYNAMIC_MINOR,
1503 .name = DM_NAME, 1474 .name = DM_NAME,
1504 .devfs_name = "mapper/control",
1505 .fops = &_ctl_fops 1475 .fops = &_ctl_fops
1506}; 1476};
1507 1477
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 3ed2e53b9eb6..c99bf9f01759 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -167,7 +167,7 @@ static void local_exit(void)
167 bioset_free(dm_set); 167 bioset_free(dm_set);
168 168
169 if (unregister_blkdev(_major, _name) < 0) 169 if (unregister_blkdev(_major, _name) < 0)
170 DMERR("devfs_unregister_blkdev failed"); 170 DMERR("unregister_blkdev failed");
171 171
172 _major = 0; 172 _major = 0;
173 173
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 306268ec99ff..2ec1b3520a0b 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -39,7 +39,6 @@
39#include <linux/raid/md.h> 39#include <linux/raid/md.h>
40#include <linux/raid/bitmap.h> 40#include <linux/raid/bitmap.h>
41#include <linux/sysctl.h> 41#include <linux/sysctl.h>
42#include <linux/devfs_fs_kernel.h>
43#include <linux/buffer_head.h> /* for invalidate_bdev */ 42#include <linux/buffer_head.h> /* for invalidate_bdev */
44#include <linux/suspend.h> 43#include <linux/suspend.h>
45#include <linux/poll.h> 44#include <linux/poll.h>
@@ -2911,13 +2910,10 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data)
2911 } 2910 }
2912 disk->major = MAJOR(dev); 2911 disk->major = MAJOR(dev);
2913 disk->first_minor = unit << shift; 2912 disk->first_minor = unit << shift;
2914 if (partitioned) { 2913 if (partitioned)
2915 sprintf(disk->disk_name, "md_d%d", unit); 2914 sprintf(disk->disk_name, "md_d%d", unit);
2916 sprintf(disk->devfs_name, "md/d%d", unit); 2915 else
2917 } else {
2918 sprintf(disk->disk_name, "md%d", unit); 2916 sprintf(disk->disk_name, "md%d", unit);
2919 sprintf(disk->devfs_name, "md/%d", unit);
2920 }
2921 disk->fops = &md_fops; 2917 disk->fops = &md_fops;
2922 disk->private_data = mddev; 2918 disk->private_data = mddev;
2923 disk->queue = mddev->queue; 2919 disk->queue = mddev->queue;
@@ -5538,8 +5534,6 @@ static void md_geninit(void)
5538 5534
5539static int __init md_init(void) 5535static int __init md_init(void)
5540{ 5536{
5541 int minor;
5542
5543 printk(KERN_INFO "md: md driver %d.%d.%d MAX_MD_DEVS=%d," 5537 printk(KERN_INFO "md: md driver %d.%d.%d MAX_MD_DEVS=%d,"
5544 " MD_SB_DISKS=%d\n", 5538 " MD_SB_DISKS=%d\n",
5545 MD_MAJOR_VERSION, MD_MINOR_VERSION, 5539 MD_MAJOR_VERSION, MD_MINOR_VERSION,
@@ -5553,23 +5547,11 @@ static int __init md_init(void)
5553 unregister_blkdev(MAJOR_NR, "md"); 5547 unregister_blkdev(MAJOR_NR, "md");
5554 return -1; 5548 return -1;
5555 } 5549 }
5556 devfs_mk_dir("md");
5557 blk_register_region(MKDEV(MAJOR_NR, 0), MAX_MD_DEVS, THIS_MODULE, 5550 blk_register_region(MKDEV(MAJOR_NR, 0), MAX_MD_DEVS, THIS_MODULE,
5558 md_probe, NULL, NULL); 5551 md_probe, NULL, NULL);
5559 blk_register_region(MKDEV(mdp_major, 0), MAX_MD_DEVS<<MdpMinorShift, THIS_MODULE, 5552 blk_register_region(MKDEV(mdp_major, 0), MAX_MD_DEVS<<MdpMinorShift, THIS_MODULE,
5560 md_probe, NULL, NULL); 5553 md_probe, NULL, NULL);
5561 5554
5562 for (minor=0; minor < MAX_MD_DEVS; ++minor)
5563 devfs_mk_bdev(MKDEV(MAJOR_NR, minor),
5564 S_IFBLK|S_IRUSR|S_IWUSR,
5565 "md/%d", minor);
5566
5567 for (minor=0; minor < MAX_MD_DEVS; ++minor)
5568 devfs_mk_bdev(MKDEV(mdp_major, minor<<MdpMinorShift),
5569 S_IFBLK|S_IRUSR|S_IWUSR,
5570 "md/mdp%d", minor);
5571
5572
5573 register_reboot_notifier(&md_notifier); 5555 register_reboot_notifier(&md_notifier);
5574 raid_table_header = register_sysctl_table(raid_root_table, 1); 5556 raid_table_header = register_sysctl_table(raid_root_table, 1);
5575 5557
@@ -5625,15 +5607,9 @@ static __exit void md_exit(void)
5625{ 5607{
5626 mddev_t *mddev; 5608 mddev_t *mddev;
5627 struct list_head *tmp; 5609 struct list_head *tmp;
5628 int i; 5610
5629 blk_unregister_region(MKDEV(MAJOR_NR,0), MAX_MD_DEVS); 5611 blk_unregister_region(MKDEV(MAJOR_NR,0), MAX_MD_DEVS);
5630 blk_unregister_region(MKDEV(mdp_major,0), MAX_MD_DEVS << MdpMinorShift); 5612 blk_unregister_region(MKDEV(mdp_major,0), MAX_MD_DEVS << MdpMinorShift);
5631 for (i=0; i < MAX_MD_DEVS; i++)
5632 devfs_remove("md/%d", i);
5633 for (i=0; i < MAX_MD_DEVS; i++)
5634 devfs_remove("md/d%d", i);
5635
5636 devfs_remove("md");
5637 5613
5638 unregister_blkdev(MAJOR_NR,"md"); 5614 unregister_blkdev(MAJOR_NR,"md");
5639 unregister_blkdev(mdp_major, "mdp"); 5615 unregister_blkdev(mdp_major, "mdp");