From 6da127ad0918f93ea93678dad62ce15ffed18797 Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Fri, 11 Jan 2008 10:09:43 +0100 Subject: blktrace: Add blktrace ioctls to SCSI generic devices Since the SCSI layer uses the request queues from the block layer, blktrace can also be used to trace the requests to all SCSI devices (like SCSI tape drives), not only disks. The only missing part is the ioctl interface to start and stop tracing. This patch adds the SETUP, START, STOP and TEARDOWN ioctls from blktrace to the sg device files. With this change, blktrace can be used for SCSI devices like for disks, e.g.: blktrace -d /dev/sg1 -o - | blkparse -i - Signed-off-by: Christof Schmitt Signed-off-by: Jens Axboe --- block/compat_ioctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'block/compat_ioctl.c') diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c index cae0a852619e..b73373216b0e 100644 --- a/block/compat_ioctl.c +++ b/block/compat_ioctl.c @@ -545,6 +545,7 @@ static int compat_blk_trace_setup(struct block_device *bdev, char __user *arg) struct blk_user_trace_setup buts; struct compat_blk_user_trace_setup cbuts; struct request_queue *q; + char b[BDEVNAME_SIZE]; int ret; q = bdev_get_queue(bdev); @@ -554,6 +555,8 @@ static int compat_blk_trace_setup(struct block_device *bdev, char __user *arg) if (copy_from_user(&cbuts, arg, sizeof(cbuts))) return -EFAULT; + strcpy(b, bdevname(bdev, b)); + buts = (struct blk_user_trace_setup) { .act_mask = cbuts.act_mask, .buf_size = cbuts.buf_size, @@ -565,7 +568,7 @@ static int compat_blk_trace_setup(struct block_device *bdev, char __user *arg) memcpy(&buts.name, &cbuts.name, 32); mutex_lock(&bdev->bd_mutex); - ret = do_blk_trace_setup(q, bdev, &buts); + ret = do_blk_trace_setup(q, b, bdev->bd_dev, &buts); mutex_unlock(&bdev->bd_mutex); if (ret) return ret; -- cgit v1.2.3