aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2010-07-07 10:51:26 -0400
committerJens Axboe <jaxboe@fusionio.com>2010-08-07 12:26:08 -0400
commit62c2a7d969f30163f733c81158254b3095b23e72 (patch)
tree3e5dd79d874b996757814562b874a18415599a61 /block
parent6e9624b8caec290d28b4c6d9ec75749df6372b87 (diff)
block: push BKL into blktrace ioctls
The blktrace driver currently needs the BKL, but we should not need to take that in the block layer, so just push it down into the driver itself. It is quite likely that the BKL is not actually required in blktrace code and could be removed in a follow-on patch. 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 'block')
-rw-r--r--block/compat_ioctl.c56
-rw-r--r--block/ioctl.c2
2 files changed, 0 insertions, 58 deletions
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c
index f26051f44681..d53085637731 100644
--- a/block/compat_ioctl.c
+++ b/block/compat_ioctl.c
@@ -535,56 +535,6 @@ out:
535 return err; 535 return err;
536} 536}
537 537
538struct compat_blk_user_trace_setup {
539 char name[32];
540 u16 act_mask;
541 u32 buf_size;
542 u32 buf_nr;
543 compat_u64 start_lba;
544 compat_u64 end_lba;
545 u32 pid;
546};
547#define BLKTRACESETUP32 _IOWR(0x12, 115, struct compat_blk_user_trace_setup)
548
549static int compat_blk_trace_setup(struct block_device *bdev, char __user *arg)
550{
551 struct blk_user_trace_setup buts;
552 struct compat_blk_user_trace_setup cbuts;
553 struct request_queue *q;
554 char b[BDEVNAME_SIZE];
555 int ret;
556
557 q = bdev_get_queue(bdev);
558 if (!q)
559 return -ENXIO;
560
561 if (copy_from_user(&cbuts, arg, sizeof(cbuts)))
562 return -EFAULT;
563
564 bdevname(bdev, b);
565
566 buts = (struct blk_user_trace_setup) {
567 .act_mask = cbuts.act_mask,
568 .buf_size = cbuts.buf_size,
569 .buf_nr = cbuts.buf_nr,
570 .start_lba = cbuts.start_lba,
571 .end_lba = cbuts.end_lba,
572 .pid = cbuts.pid,
573 };
574 memcpy(&buts.name, &cbuts.name, 32);
575
576 mutex_lock(&bdev->bd_mutex);
577 ret = do_blk_trace_setup(q, b, bdev->bd_dev, bdev, &buts);
578 mutex_unlock(&bdev->bd_mutex);
579 if (ret)
580 return ret;
581
582 if (copy_to_user(arg, &buts.name, 32))
583 return -EFAULT;
584
585 return 0;
586}
587
588static int compat_blkdev_driver_ioctl(struct block_device *bdev, fmode_t mode, 538static int compat_blkdev_driver_ioctl(struct block_device *bdev, fmode_t mode,
589 unsigned cmd, unsigned long arg) 539 unsigned cmd, unsigned long arg)
590{ 540{
@@ -802,16 +752,10 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
802 return compat_put_u64(arg, bdev->bd_inode->i_size); 752 return compat_put_u64(arg, bdev->bd_inode->i_size);
803 753
804 case BLKTRACESETUP32: 754 case BLKTRACESETUP32:
805 lock_kernel();
806 ret = compat_blk_trace_setup(bdev, compat_ptr(arg));
807 unlock_kernel();
808 return ret;
809 case BLKTRACESTART: /* compatible */ 755 case BLKTRACESTART: /* compatible */
810 case BLKTRACESTOP: /* compatible */ 756 case BLKTRACESTOP: /* compatible */
811 case BLKTRACETEARDOWN: /* compatible */ 757 case BLKTRACETEARDOWN: /* compatible */
812 lock_kernel();
813 ret = blk_trace_ioctl(bdev, cmd, compat_ptr(arg)); 758 ret = blk_trace_ioctl(bdev, cmd, compat_ptr(arg));
814 unlock_kernel();
815 return ret; 759 return ret;
816 default: 760 default:
817 if (disk->fops->compat_ioctl) 761 if (disk->fops->compat_ioctl)
diff --git a/block/ioctl.c b/block/ioctl.c
index 1cfa8d449d90..9d91e830b320 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -320,9 +320,7 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
320 case BLKTRACESTOP: 320 case BLKTRACESTOP:
321 case BLKTRACESETUP: 321 case BLKTRACESETUP:
322 case BLKTRACETEARDOWN: 322 case BLKTRACETEARDOWN:
323 lock_kernel();
324 ret = blk_trace_ioctl(bdev, cmd, (char __user *) arg); 323 ret = blk_trace_ioctl(bdev, cmd, (char __user *) arg);
325 unlock_kernel();
326 break; 324 break;
327 default: 325 default:
328 ret = __blkdev_driver_ioctl(bdev, mode, cmd, arg); 326 ret = __blkdev_driver_ioctl(bdev, mode, cmd, arg);