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>
This commit is contained in:

committed by
Jens Axboe

vanhempi
3448406244
commit
8a6cfeb6de
@@ -31,6 +31,7 @@
|
||||
#include <linux/delay.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/errno.h>
|
||||
@@ -1654,7 +1655,7 @@ static int idecd_get_spindown(struct cdrom_device_info *cdi, unsigned long arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int idecd_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
static int idecd_locked_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
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,
|
||||
return err;
|
||||
}
|
||||
|
||||
static int idecd_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
lock_kernel();
|
||||
ret = idecd_locked_ioctl(bdev, mode, cmd, arg);
|
||||
unlock_kernel();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int idecd_media_changed(struct gendisk *disk)
|
||||
{
|
||||
struct cdrom_info *info = ide_drv_g(disk, cdrom_info);
|
||||
@@ -1696,7 +1710,7 @@ static const struct block_device_operations idecd_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = idecd_open,
|
||||
.release = idecd_release,
|
||||
.locked_ioctl = idecd_ioctl,
|
||||
.ioctl = idecd_ioctl,
|
||||
.media_changed = idecd_media_changed,
|
||||
.revalidate_disk = idecd_revalidate_disk
|
||||
};
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/ide.h>
|
||||
#include <linux/hdreg.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include "ide-disk.h"
|
||||
|
||||
@@ -18,9 +19,13 @@ int ide_disk_ioctl(ide_drive_t *drive, struct block_device *bdev, fmode_t mode,
|
||||
{
|
||||
int err;
|
||||
|
||||
lock_kernel();
|
||||
err = ide_setting_ioctl(drive, bdev, cmd, arg, ide_disk_ioctl_settings);
|
||||
if (err != -EOPNOTSUPP)
|
||||
return err;
|
||||
goto out;
|
||||
|
||||
return generic_ide_ioctl(drive, bdev, cmd, arg);
|
||||
err = generic_ide_ioctl(drive, bdev, cmd, arg);
|
||||
out:
|
||||
unlock_kernel();
|
||||
return err;
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/ide.h>
|
||||
#include <linux/cdrom.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include <asm/unaligned.h>
|
||||
|
||||
@@ -275,12 +276,15 @@ int ide_floppy_ioctl(ide_drive_t *drive, struct block_device *bdev,
|
||||
void __user *argp = (void __user *)arg;
|
||||
int err;
|
||||
|
||||
if (cmd == CDROMEJECT || cmd == CDROM_LOCKDOOR)
|
||||
return ide_floppy_lockdoor(drive, &pc, arg, cmd);
|
||||
lock_kernel();
|
||||
if (cmd == CDROMEJECT || cmd == CDROM_LOCKDOOR) {
|
||||
err = ide_floppy_lockdoor(drive, &pc, arg, cmd);
|
||||
goto out;
|
||||
}
|
||||
|
||||
err = ide_floppy_format_ioctl(drive, &pc, mode, cmd, argp);
|
||||
if (err != -ENOTTY)
|
||||
return err;
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* skip SCSI_IOCTL_SEND_COMMAND (deprecated)
|
||||
@@ -293,5 +297,7 @@ int ide_floppy_ioctl(ide_drive_t *drive, struct block_device *bdev,
|
||||
if (err == -ENOTTY)
|
||||
err = generic_ide_ioctl(drive, bdev, cmd, arg);
|
||||
|
||||
out:
|
||||
unlock_kernel();
|
||||
return err;
|
||||
}
|
||||
|
@@ -323,7 +323,7 @@ static const struct block_device_operations ide_gd_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = ide_gd_open,
|
||||
.release = ide_gd_release,
|
||||
.locked_ioctl = ide_gd_ioctl,
|
||||
.ioctl = ide_gd_ioctl,
|
||||
.getgeo = ide_gd_getgeo,
|
||||
.media_changed = ide_gd_media_changed,
|
||||
.unlock_native_capacity = ide_gd_unlock_native_capacity,
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include <linux/errno.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/ide.h>
|
||||
@@ -1927,9 +1928,14 @@ static int idetape_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
{
|
||||
struct ide_tape_obj *tape = ide_drv_g(bdev->bd_disk, ide_tape_obj);
|
||||
ide_drive_t *drive = tape->drive;
|
||||
int err = generic_ide_ioctl(drive, bdev, cmd, arg);
|
||||
int err;
|
||||
|
||||
lock_kernel();
|
||||
err = generic_ide_ioctl(drive, bdev, cmd, arg);
|
||||
if (err == -EINVAL)
|
||||
err = idetape_blkdev_ioctl(drive, cmd, arg);
|
||||
unlock_kernel();
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -1937,7 +1943,7 @@ static const struct block_device_operations idetape_block_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = idetape_open,
|
||||
.release = idetape_release,
|
||||
.locked_ioctl = idetape_ioctl,
|
||||
.ioctl = idetape_ioctl,
|
||||
};
|
||||
|
||||
static int ide_tape_probe(ide_drive_t *drive)
|
||||
|
Viittaa uudesa ongelmassa
Block a user