aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/virtio_blk.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2010-07-08 04:18:46 -0400
committerJens Axboe <jaxboe@fusionio.com>2010-08-07 12:25:00 -0400
commit8a6cfeb6deca3a8fefd639d898b0d163c0b5d368 (patch)
tree9a633ad48c3b1ada0519ee7bade0602f940037f6 /drivers/block/virtio_blk.c
parent34484062445fe905bf02c72f87ddda21881acda3 (diff)
block: push down BKL into .locked_ioctl
As a preparation for the removal of the big kernel lock in the block layer, this removes the BKL from the common ioctl handling code, moving it into every single driver still using it. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers/block/virtio_blk.c')
-rw-r--r--drivers/block/virtio_blk.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 0a3222fd4442..7b0f7b624adf 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -2,6 +2,7 @@
2#include <linux/spinlock.h> 2#include <linux/spinlock.h>
3#include <linux/slab.h> 3#include <linux/slab.h>
4#include <linux/blkdev.h> 4#include <linux/blkdev.h>
5#include <linux/smp_lock.h>
5#include <linux/hdreg.h> 6#include <linux/hdreg.h>
6#include <linux/virtio.h> 7#include <linux/virtio.h>
7#include <linux/virtio_blk.h> 8#include <linux/virtio_blk.h>
@@ -217,7 +218,7 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str)
217 return blk_execute_rq(vblk->disk->queue, vblk->disk, req, false); 218 return blk_execute_rq(vblk->disk->queue, vblk->disk, req, false);
218} 219}
219 220
220static int virtblk_ioctl(struct block_device *bdev, fmode_t mode, 221static int virtblk_locked_ioctl(struct block_device *bdev, fmode_t mode,
221 unsigned cmd, unsigned long data) 222 unsigned cmd, unsigned long data)
222{ 223{
223 struct gendisk *disk = bdev->bd_disk; 224 struct gendisk *disk = bdev->bd_disk;
@@ -243,6 +244,18 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t mode,
243 (void __user *)data); 244 (void __user *)data);
244} 245}
245 246
247static int virtblk_ioctl(struct block_device *bdev, fmode_t mode,
248 unsigned int cmd, unsigned long param)
249{
250 int ret;
251
252 lock_kernel();
253 ret = virtblk_locked_ioctl(bdev, mode, cmd, param);
254 unlock_kernel();
255
256 return ret;
257}
258
246/* We provide getgeo only to please some old bootloader/partitioning tools */ 259/* We provide getgeo only to please some old bootloader/partitioning tools */
247static int virtblk_getgeo(struct block_device *bd, struct hd_geometry *geo) 260static int virtblk_getgeo(struct block_device *bd, struct hd_geometry *geo)
248{ 261{
@@ -269,7 +282,7 @@ static int virtblk_getgeo(struct block_device *bd, struct hd_geometry *geo)
269} 282}
270 283
271static const struct block_device_operations virtblk_fops = { 284static const struct block_device_operations virtblk_fops = {
272 .locked_ioctl = virtblk_ioctl, 285 .ioctl = virtblk_ioctl,
273 .owner = THIS_MODULE, 286 .owner = THIS_MODULE,
274 .getgeo = virtblk_getgeo, 287 .getgeo = virtblk_getgeo,
275}; 288};