aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-03-02 10:29:31 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2008-10-21 07:48:29 -0400
commitfe5f9f2cd57c2ce56f36c66e87a10d4b7a158505 (patch)
tree76bfbf4e634fcd043f4764cfff45ce6ea12171f8 /drivers/md
parenta4600f81393d685043fe2d485cf2b123301f467d (diff)
[PATCH] switch dm
ioctl() doesn't need BKL here Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 8b4c92b1b6db..dc48c2585feb 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -21,7 +21,6 @@
21#include <linux/idr.h> 21#include <linux/idr.h>
22#include <linux/hdreg.h> 22#include <linux/hdreg.h>
23#include <linux/blktrace_api.h> 23#include <linux/blktrace_api.h>
24#include <linux/smp_lock.h>
25 24
26#define DM_MSG_PREFIX "core" 25#define DM_MSG_PREFIX "core"
27 26
@@ -249,13 +248,13 @@ static void __exit dm_exit(void)
249/* 248/*
250 * Block device functions 249 * Block device functions
251 */ 250 */
252static int dm_blk_open(struct inode *inode, struct file *file) 251static int dm_blk_open(struct block_device *bdev, fmode_t mode)
253{ 252{
254 struct mapped_device *md; 253 struct mapped_device *md;
255 254
256 spin_lock(&_minor_lock); 255 spin_lock(&_minor_lock);
257 256
258 md = inode->i_bdev->bd_disk->private_data; 257 md = bdev->bd_disk->private_data;
259 if (!md) 258 if (!md)
260 goto out; 259 goto out;
261 260
@@ -274,11 +273,9 @@ out:
274 return md ? 0 : -ENXIO; 273 return md ? 0 : -ENXIO;
275} 274}
276 275
277static int dm_blk_close(struct inode *inode, struct file *file) 276static int dm_blk_close(struct gendisk *disk, fmode_t mode)
278{ 277{
279 struct mapped_device *md; 278 struct mapped_device *md = disk->private_data;
280
281 md = inode->i_bdev->bd_disk->private_data;
282 atomic_dec(&md->open_count); 279 atomic_dec(&md->open_count);
283 dm_put(md); 280 dm_put(md);
284 return 0; 281 return 0;
@@ -315,21 +312,14 @@ static int dm_blk_getgeo(struct block_device *bdev, struct hd_geometry *geo)
315 return dm_get_geometry(md, geo); 312 return dm_get_geometry(md, geo);
316} 313}
317 314
318static int dm_blk_ioctl(struct inode *inode, struct file *file, 315static int dm_blk_ioctl(struct block_device *bdev, fmode_t mode,
319 unsigned int cmd, unsigned long arg) 316 unsigned int cmd, unsigned long arg)
320{ 317{
321 struct mapped_device *md; 318 struct mapped_device *md = bdev->bd_disk->private_data;
322 struct dm_table *map; 319 struct dm_table *map = dm_get_table(md);
323 struct dm_target *tgt; 320 struct dm_target *tgt;
324 int r = -ENOTTY; 321 int r = -ENOTTY;
325 322
326 /* We don't really need this lock, but we do need 'inode'. */
327 unlock_kernel();
328
329 md = inode->i_bdev->bd_disk->private_data;
330
331 map = dm_get_table(md);
332
333 if (!map || !dm_table_get_size(map)) 323 if (!map || !dm_table_get_size(map))
334 goto out; 324 goto out;
335 325
@@ -350,7 +340,6 @@ static int dm_blk_ioctl(struct inode *inode, struct file *file,
350out: 340out:
351 dm_table_put(map); 341 dm_table_put(map);
352 342
353 lock_kernel();
354 return r; 343 return r;
355} 344}
356 345
@@ -1698,9 +1687,9 @@ int dm_noflush_suspending(struct dm_target *ti)
1698EXPORT_SYMBOL_GPL(dm_noflush_suspending); 1687EXPORT_SYMBOL_GPL(dm_noflush_suspending);
1699 1688
1700static struct block_device_operations dm_blk_dops = { 1689static struct block_device_operations dm_blk_dops = {
1701 .__open = dm_blk_open, 1690 .open = dm_blk_open,
1702 .__release = dm_blk_close, 1691 .release = dm_blk_close,
1703 .__ioctl = dm_blk_ioctl, 1692 .ioctl = dm_blk_ioctl,
1704 .getgeo = dm_blk_getgeo, 1693 .getgeo = dm_blk_getgeo,
1705 .owner = THIS_MODULE 1694 .owner = THIS_MODULE
1706}; 1695};