aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
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/ide
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/ide')
-rw-r--r--drivers/ide/ide-cd.c18
-rw-r--r--drivers/ide/ide-disk_ioctl.c9
-rw-r--r--drivers/ide/ide-floppy_ioctl.c12
-rw-r--r--drivers/ide/ide-gd.c2
-rw-r--r--drivers/ide/ide-tape.c10
5 files changed, 41 insertions, 10 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index ef7e3a9bee51..bf9f61a5c2f8 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -31,6 +31,7 @@
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/timer.h> 32#include <linux/timer.h>
33#include <linux/seq_file.h> 33#include <linux/seq_file.h>
34#include <linux/smp_lock.h>
34#include <linux/slab.h> 35#include <linux/slab.h>
35#include <linux/interrupt.h> 36#include <linux/interrupt.h>
36#include <linux/errno.h> 37#include <linux/errno.h>
@@ -1654,7 +1655,7 @@ static int idecd_get_spindown(struct cdrom_device_info *cdi, unsigned long arg)
1654 return 0; 1655 return 0;
1655} 1656}
1656 1657
1657static int idecd_ioctl(struct block_device *bdev, fmode_t mode, 1658static int idecd_locked_ioctl(struct block_device *bdev, fmode_t mode,
1658 unsigned int cmd, unsigned long arg) 1659 unsigned int cmd, unsigned long arg)
1659{ 1660{
1660 struct cdrom_info *info = ide_drv_g(bdev->bd_disk, cdrom_info); 1661 struct cdrom_info *info = ide_drv_g(bdev->bd_disk, cdrom_info);
@@ -1676,6 +1677,19 @@ static int idecd_ioctl(struct block_device *bdev, fmode_t mode,
1676 return err; 1677 return err;
1677} 1678}
1678 1679
1680static int idecd_ioctl(struct block_device *bdev, fmode_t mode,
1681 unsigned int cmd, unsigned long arg)
1682{
1683 int ret;
1684
1685 lock_kernel();
1686 ret = idecd_locked_ioctl(bdev, mode, cmd, arg);
1687 unlock_kernel();
1688
1689 return ret;
1690}
1691
1692
1679static int idecd_media_changed(struct gendisk *disk) 1693static int idecd_media_changed(struct gendisk *disk)
1680{ 1694{
1681 struct cdrom_info *info = ide_drv_g(disk, cdrom_info); 1695 struct cdrom_info *info = ide_drv_g(disk, cdrom_info);
@@ -1696,7 +1710,7 @@ static const struct block_device_operations idecd_ops = {
1696 .owner = THIS_MODULE, 1710 .owner = THIS_MODULE,
1697 .open = idecd_open, 1711 .open = idecd_open,
1698 .release = idecd_release, 1712 .release = idecd_release,
1699 .locked_ioctl = idecd_ioctl, 1713 .ioctl = idecd_ioctl,
1700 .media_changed = idecd_media_changed, 1714 .media_changed = idecd_media_changed,
1701 .revalidate_disk = idecd_revalidate_disk 1715 .revalidate_disk = idecd_revalidate_disk
1702}; 1716};
diff --git a/drivers/ide/ide-disk_ioctl.c b/drivers/ide/ide-disk_ioctl.c
index 7b783dd7c0be..ec94c66918f6 100644
--- a/drivers/ide/ide-disk_ioctl.c
+++ b/drivers/ide/ide-disk_ioctl.c
@@ -1,6 +1,7 @@
1#include <linux/kernel.h> 1#include <linux/kernel.h>
2#include <linux/ide.h> 2#include <linux/ide.h>
3#include <linux/hdreg.h> 3#include <linux/hdreg.h>
4#include <linux/smp_lock.h>
4 5
5#include "ide-disk.h" 6#include "ide-disk.h"
6 7
@@ -18,9 +19,13 @@ int ide_disk_ioctl(ide_drive_t *drive, struct block_device *bdev, fmode_t mode,
18{ 19{
19 int err; 20 int err;
20 21
22 lock_kernel();
21 err = ide_setting_ioctl(drive, bdev, cmd, arg, ide_disk_ioctl_settings); 23 err = ide_setting_ioctl(drive, bdev, cmd, arg, ide_disk_ioctl_settings);
22 if (err != -EOPNOTSUPP) 24 if (err != -EOPNOTSUPP)
23 return err; 25 goto out;
24 26
25 return generic_ide_ioctl(drive, bdev, cmd, arg); 27 err = generic_ide_ioctl(drive, bdev, cmd, arg);
28out:
29 unlock_kernel();
30 return err;
26} 31}
diff --git a/drivers/ide/ide-floppy_ioctl.c b/drivers/ide/ide-floppy_ioctl.c
index 9c2288234dea..fd3d05ab3417 100644
--- a/drivers/ide/ide-floppy_ioctl.c
+++ b/drivers/ide/ide-floppy_ioctl.c
@@ -5,6 +5,7 @@
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/ide.h> 6#include <linux/ide.h>
7#include <linux/cdrom.h> 7#include <linux/cdrom.h>
8#include <linux/smp_lock.h>
8 9
9#include <asm/unaligned.h> 10#include <asm/unaligned.h>
10 11
@@ -275,12 +276,15 @@ int ide_floppy_ioctl(ide_drive_t *drive, struct block_device *bdev,
275 void __user *argp = (void __user *)arg; 276 void __user *argp = (void __user *)arg;
276 int err; 277 int err;
277 278
278 if (cmd == CDROMEJECT || cmd == CDROM_LOCKDOOR) 279 lock_kernel();
279 return ide_floppy_lockdoor(drive, &pc, arg, cmd); 280 if (cmd == CDROMEJECT || cmd == CDROM_LOCKDOOR) {
281 err = ide_floppy_lockdoor(drive, &pc, arg, cmd);
282 goto out;
283 }
280 284
281 err = ide_floppy_format_ioctl(drive, &pc, mode, cmd, argp); 285 err = ide_floppy_format_ioctl(drive, &pc, mode, cmd, argp);
282 if (err != -ENOTTY) 286 if (err != -ENOTTY)
283 return err; 287 goto out;
284 288
285 /* 289 /*
286 * skip SCSI_IOCTL_SEND_COMMAND (deprecated) 290 * skip SCSI_IOCTL_SEND_COMMAND (deprecated)
@@ -293,5 +297,7 @@ int ide_floppy_ioctl(ide_drive_t *drive, struct block_device *bdev,
293 if (err == -ENOTTY) 297 if (err == -ENOTTY)
294 err = generic_ide_ioctl(drive, bdev, cmd, arg); 298 err = generic_ide_ioctl(drive, bdev, cmd, arg);
295 299
300out:
301 unlock_kernel();
296 return err; 302 return err;
297} 303}
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c
index c102d23d9b38..883f0c979c9f 100644
--- a/drivers/ide/ide-gd.c
+++ b/drivers/ide/ide-gd.c
@@ -323,7 +323,7 @@ static const struct block_device_operations ide_gd_ops = {
323 .owner = THIS_MODULE, 323 .owner = THIS_MODULE,
324 .open = ide_gd_open, 324 .open = ide_gd_open,
325 .release = ide_gd_release, 325 .release = ide_gd_release,
326 .locked_ioctl = ide_gd_ioctl, 326 .ioctl = ide_gd_ioctl,
327 .getgeo = ide_gd_getgeo, 327 .getgeo = ide_gd_getgeo,
328 .media_changed = ide_gd_media_changed, 328 .media_changed = ide_gd_media_changed,
329 .unlock_native_capacity = ide_gd_unlock_native_capacity, 329 .unlock_native_capacity = ide_gd_unlock_native_capacity,
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 635fd72d4728..39b0a5c45f07 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -32,6 +32,7 @@
32#include <linux/errno.h> 32#include <linux/errno.h>
33#include <linux/genhd.h> 33#include <linux/genhd.h>
34#include <linux/seq_file.h> 34#include <linux/seq_file.h>
35#include <linux/smp_lock.h>
35#include <linux/slab.h> 36#include <linux/slab.h>
36#include <linux/pci.h> 37#include <linux/pci.h>
37#include <linux/ide.h> 38#include <linux/ide.h>
@@ -1927,9 +1928,14 @@ static int idetape_ioctl(struct block_device *bdev, fmode_t mode,
1927{ 1928{
1928 struct ide_tape_obj *tape = ide_drv_g(bdev->bd_disk, ide_tape_obj); 1929 struct ide_tape_obj *tape = ide_drv_g(bdev->bd_disk, ide_tape_obj);
1929 ide_drive_t *drive = tape->drive; 1930 ide_drive_t *drive = tape->drive;
1930 int err = generic_ide_ioctl(drive, bdev, cmd, arg); 1931 int err;
1932
1933 lock_kernel();
1934 err = generic_ide_ioctl(drive, bdev, cmd, arg);
1931 if (err == -EINVAL) 1935 if (err == -EINVAL)
1932 err = idetape_blkdev_ioctl(drive, cmd, arg); 1936 err = idetape_blkdev_ioctl(drive, cmd, arg);
1937 unlock_kernel();
1938
1933 return err; 1939 return err;
1934} 1940}
1935 1941
@@ -1937,7 +1943,7 @@ static const struct block_device_operations idetape_block_ops = {
1937 .owner = THIS_MODULE, 1943 .owner = THIS_MODULE,
1938 .open = idetape_open, 1944 .open = idetape_open,
1939 .release = idetape_release, 1945 .release = idetape_release,
1940 .locked_ioctl = idetape_ioctl, 1946 .ioctl = idetape_ioctl,
1941}; 1947};
1942 1948
1943static int ide_tape_probe(ide_drive_t *drive) 1949static int ide_tape_probe(ide_drive_t *drive)