diff options
Diffstat (limited to 'drivers/block/brd.c')
-rw-r--r-- | drivers/block/brd.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/block/brd.c b/drivers/block/brd.c index f1bf79d9bc0a..1c7f63792ff8 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/blkdev.h> | 15 | #include <linux/blkdev.h> |
16 | #include <linux/bio.h> | 16 | #include <linux/bio.h> |
17 | #include <linux/highmem.h> | 17 | #include <linux/highmem.h> |
18 | #include <linux/smp_lock.h> | ||
18 | #include <linux/radix-tree.h> | 19 | #include <linux/radix-tree.h> |
19 | #include <linux/buffer_head.h> /* invalidate_bh_lrus() */ | 20 | #include <linux/buffer_head.h> /* invalidate_bh_lrus() */ |
20 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
@@ -340,7 +341,7 @@ static int brd_make_request(struct request_queue *q, struct bio *bio) | |||
340 | get_capacity(bdev->bd_disk)) | 341 | get_capacity(bdev->bd_disk)) |
341 | goto out; | 342 | goto out; |
342 | 343 | ||
343 | if (unlikely(bio_rw_flagged(bio, BIO_RW_DISCARD))) { | 344 | if (unlikely(bio->bi_rw & REQ_DISCARD)) { |
344 | err = 0; | 345 | err = 0; |
345 | discard_from_brd(brd, sector, bio->bi_size); | 346 | discard_from_brd(brd, sector, bio->bi_size); |
346 | goto out; | 347 | goto out; |
@@ -401,6 +402,7 @@ static int brd_ioctl(struct block_device *bdev, fmode_t mode, | |||
401 | * ram device BLKFLSBUF has special semantics, we want to actually | 402 | * ram device BLKFLSBUF has special semantics, we want to actually |
402 | * release and destroy the ramdisk data. | 403 | * release and destroy the ramdisk data. |
403 | */ | 404 | */ |
405 | lock_kernel(); | ||
404 | mutex_lock(&bdev->bd_mutex); | 406 | mutex_lock(&bdev->bd_mutex); |
405 | error = -EBUSY; | 407 | error = -EBUSY; |
406 | if (bdev->bd_openers <= 1) { | 408 | if (bdev->bd_openers <= 1) { |
@@ -417,13 +419,14 @@ static int brd_ioctl(struct block_device *bdev, fmode_t mode, | |||
417 | error = 0; | 419 | error = 0; |
418 | } | 420 | } |
419 | mutex_unlock(&bdev->bd_mutex); | 421 | mutex_unlock(&bdev->bd_mutex); |
422 | unlock_kernel(); | ||
420 | 423 | ||
421 | return error; | 424 | return error; |
422 | } | 425 | } |
423 | 426 | ||
424 | static const struct block_device_operations brd_fops = { | 427 | static const struct block_device_operations brd_fops = { |
425 | .owner = THIS_MODULE, | 428 | .owner = THIS_MODULE, |
426 | .locked_ioctl = brd_ioctl, | 429 | .ioctl = brd_ioctl, |
427 | #ifdef CONFIG_BLK_DEV_XIP | 430 | #ifdef CONFIG_BLK_DEV_XIP |
428 | .direct_access = brd_direct_access, | 431 | .direct_access = brd_direct_access, |
429 | #endif | 432 | #endif |
@@ -479,7 +482,7 @@ static struct brd_device *brd_alloc(int i) | |||
479 | if (!brd->brd_queue) | 482 | if (!brd->brd_queue) |
480 | goto out_free_dev; | 483 | goto out_free_dev; |
481 | blk_queue_make_request(brd->brd_queue, brd_make_request); | 484 | blk_queue_make_request(brd->brd_queue, brd_make_request); |
482 | blk_queue_ordered(brd->brd_queue, QUEUE_ORDERED_TAG, NULL); | 485 | blk_queue_ordered(brd->brd_queue, QUEUE_ORDERED_TAG); |
483 | blk_queue_max_hw_sectors(brd->brd_queue, 1024); | 486 | blk_queue_max_hw_sectors(brd->brd_queue, 1024); |
484 | blk_queue_bounce_limit(brd->brd_queue, BLK_BOUNCE_ANY); | 487 | blk_queue_bounce_limit(brd->brd_queue, BLK_BOUNCE_ANY); |
485 | 488 | ||