diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-23 13:23:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-23 13:23:07 -0400 |
commit | 22484856402bfa1ff3defe47f6029ab0418240d9 (patch) | |
tree | 140c67bf59674da350a7b51765d6ff7eb101b597 /drivers/md/dm.c | |
parent | 5ed487bc2c44ca4e9668ef9cb54c830e2a9fac47 (diff) | |
parent | 56b26add02b4bdea81d5e0ebda60db1fe3311ad4 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/viro/bdev
* git://git.kernel.org/pub/scm/linux/kernel/git/viro/bdev: (66 commits)
[PATCH] kill the rest of struct file propagation in block ioctls
[PATCH] get rid of struct file use in blkdev_ioctl() BLKBSZSET
[PATCH] get rid of blkdev_locked_ioctl()
[PATCH] get rid of blkdev_driver_ioctl()
[PATCH] sanitize blkdev_get() and friends
[PATCH] remember mode of reiserfs journal
[PATCH] propagate mode through swsusp_close()
[PATCH] propagate mode through open_bdev_excl/close_bdev_excl
[PATCH] pass fmode_t to blkdev_put()
[PATCH] kill the unused bsize on the send side of /dev/loop
[PATCH] trim file propagation in block/compat_ioctl.c
[PATCH] end of methods switch: remove the old ones
[PATCH] switch sr
[PATCH] switch sd
[PATCH] switch ide-scsi
[PATCH] switch tape_block
[PATCH] switch dcssblk
[PATCH] switch dasd
[PATCH] switch mtd_blkdevs
[PATCH] switch mmc
...
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r-- | drivers/md/dm.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index d1d0cd0f5750..6963ad148408 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 | ||
@@ -248,13 +247,13 @@ static void __exit dm_exit(void) | |||
248 | /* | 247 | /* |
249 | * Block device functions | 248 | * Block device functions |
250 | */ | 249 | */ |
251 | static int dm_blk_open(struct inode *inode, struct file *file) | 250 | static int dm_blk_open(struct block_device *bdev, fmode_t mode) |
252 | { | 251 | { |
253 | struct mapped_device *md; | 252 | struct mapped_device *md; |
254 | 253 | ||
255 | spin_lock(&_minor_lock); | 254 | spin_lock(&_minor_lock); |
256 | 255 | ||
257 | md = inode->i_bdev->bd_disk->private_data; | 256 | md = bdev->bd_disk->private_data; |
258 | if (!md) | 257 | if (!md) |
259 | goto out; | 258 | goto out; |
260 | 259 | ||
@@ -273,11 +272,9 @@ out: | |||
273 | return md ? 0 : -ENXIO; | 272 | return md ? 0 : -ENXIO; |
274 | } | 273 | } |
275 | 274 | ||
276 | static int dm_blk_close(struct inode *inode, struct file *file) | 275 | static int dm_blk_close(struct gendisk *disk, fmode_t mode) |
277 | { | 276 | { |
278 | struct mapped_device *md; | 277 | struct mapped_device *md = disk->private_data; |
279 | |||
280 | md = inode->i_bdev->bd_disk->private_data; | ||
281 | atomic_dec(&md->open_count); | 278 | atomic_dec(&md->open_count); |
282 | dm_put(md); | 279 | dm_put(md); |
283 | return 0; | 280 | return 0; |
@@ -314,21 +311,14 @@ static int dm_blk_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
314 | return dm_get_geometry(md, geo); | 311 | return dm_get_geometry(md, geo); |
315 | } | 312 | } |
316 | 313 | ||
317 | static int dm_blk_ioctl(struct inode *inode, struct file *file, | 314 | static int dm_blk_ioctl(struct block_device *bdev, fmode_t mode, |
318 | unsigned int cmd, unsigned long arg) | 315 | unsigned int cmd, unsigned long arg) |
319 | { | 316 | { |
320 | struct mapped_device *md; | 317 | struct mapped_device *md = bdev->bd_disk->private_data; |
321 | struct dm_table *map; | 318 | struct dm_table *map = dm_get_table(md); |
322 | struct dm_target *tgt; | 319 | struct dm_target *tgt; |
323 | int r = -ENOTTY; | 320 | int r = -ENOTTY; |
324 | 321 | ||
325 | /* We don't really need this lock, but we do need 'inode'. */ | ||
326 | unlock_kernel(); | ||
327 | |||
328 | md = inode->i_bdev->bd_disk->private_data; | ||
329 | |||
330 | map = dm_get_table(md); | ||
331 | |||
332 | if (!map || !dm_table_get_size(map)) | 322 | if (!map || !dm_table_get_size(map)) |
333 | goto out; | 323 | goto out; |
334 | 324 | ||
@@ -344,12 +334,11 @@ static int dm_blk_ioctl(struct inode *inode, struct file *file, | |||
344 | } | 334 | } |
345 | 335 | ||
346 | if (tgt->type->ioctl) | 336 | if (tgt->type->ioctl) |
347 | r = tgt->type->ioctl(tgt, inode, file, cmd, arg); | 337 | r = tgt->type->ioctl(tgt, cmd, arg); |
348 | 338 | ||
349 | out: | 339 | out: |
350 | dm_table_put(map); | 340 | dm_table_put(map); |
351 | 341 | ||
352 | lock_kernel(); | ||
353 | return r; | 342 | return r; |
354 | } | 343 | } |
355 | 344 | ||