aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sd.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/scsi/sd.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/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 1d0c4b7c3b69..633ac32b25c1 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -46,6 +46,7 @@
46#include <linux/blkdev.h> 46#include <linux/blkdev.h>
47#include <linux/blkpg.h> 47#include <linux/blkpg.h>
48#include <linux/delay.h> 48#include <linux/delay.h>
49#include <linux/smp_lock.h>
49#include <linux/mutex.h> 50#include <linux/mutex.h>
50#include <linux/string_helpers.h> 51#include <linux/string_helpers.h>
51#include <linux/async.h> 52#include <linux/async.h>
@@ -924,6 +925,7 @@ static int sd_ioctl(struct block_device *bdev, fmode_t mode,
924 SCSI_LOG_IOCTL(1, printk("sd_ioctl: disk=%s, cmd=0x%x\n", 925 SCSI_LOG_IOCTL(1, printk("sd_ioctl: disk=%s, cmd=0x%x\n",
925 disk->disk_name, cmd)); 926 disk->disk_name, cmd));
926 927
928 lock_kernel();
927 /* 929 /*
928 * If we are in the middle of error recovery, don't let anyone 930 * If we are in the middle of error recovery, don't let anyone
929 * else try and use this device. Also, if error recovery fails, it 931 * else try and use this device. Also, if error recovery fails, it
@@ -933,7 +935,7 @@ static int sd_ioctl(struct block_device *bdev, fmode_t mode,
933 error = scsi_nonblockable_ioctl(sdp, cmd, p, 935 error = scsi_nonblockable_ioctl(sdp, cmd, p,
934 (mode & FMODE_NDELAY) != 0); 936 (mode & FMODE_NDELAY) != 0);
935 if (!scsi_block_when_processing_errors(sdp) || !error) 937 if (!scsi_block_when_processing_errors(sdp) || !error)
936 return error; 938 goto out;
937 939
938 /* 940 /*
939 * Send SCSI addressing ioctls directly to mid level, send other 941 * Send SCSI addressing ioctls directly to mid level, send other
@@ -943,13 +945,18 @@ static int sd_ioctl(struct block_device *bdev, fmode_t mode,
943 switch (cmd) { 945 switch (cmd) {
944 case SCSI_IOCTL_GET_IDLUN: 946 case SCSI_IOCTL_GET_IDLUN:
945 case SCSI_IOCTL_GET_BUS_NUMBER: 947 case SCSI_IOCTL_GET_BUS_NUMBER:
946 return scsi_ioctl(sdp, cmd, p); 948 error = scsi_ioctl(sdp, cmd, p);
949 break;
947 default: 950 default:
948 error = scsi_cmd_ioctl(disk->queue, disk, mode, cmd, p); 951 error = scsi_cmd_ioctl(disk->queue, disk, mode, cmd, p);
949 if (error != -ENOTTY) 952 if (error != -ENOTTY)
950 return error; 953 break;
954 error = scsi_ioctl(sdp, cmd, p);
955 break;
951 } 956 }
952 return scsi_ioctl(sdp, cmd, p); 957out:
958 unlock_kernel();
959 return error;
953} 960}
954 961
955static void set_media_not_present(struct scsi_disk *sdkp) 962static void set_media_not_present(struct scsi_disk *sdkp)
@@ -1123,7 +1130,7 @@ static const struct block_device_operations sd_fops = {
1123 .owner = THIS_MODULE, 1130 .owner = THIS_MODULE,
1124 .open = sd_open, 1131 .open = sd_open,
1125 .release = sd_release, 1132 .release = sd_release,
1126 .locked_ioctl = sd_ioctl, 1133 .ioctl = sd_ioctl,
1127 .getgeo = sd_getgeo, 1134 .getgeo = sd_getgeo,
1128#ifdef CONFIG_COMPAT 1135#ifdef CONFIG_COMPAT
1129 .compat_ioctl = sd_compat_ioctl, 1136 .compat_ioctl = sd_compat_ioctl,