diff options
author | Christof Schmitt <christof.schmitt@de.ibm.com> | 2008-01-11 09:09:43 (GMT) |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-01-28 09:04:46 (GMT) |
commit | 6da127ad0918f93ea93678dad62ce15ffed18797 (patch) | |
tree | b2bf9ad228f18c643342ad376136d2f6b4be4137 /drivers/scsi | |
parent | 91525300baf162e83e923b09ca286f9205e21522 (diff) | |
download | linux-fsl-qoriq-6da127ad0918f93ea93678dad62ce15ffed18797.tar.xz |
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 <christof.schmitt@de.ibm.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/sg.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 17216b7..aba28f3 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -48,6 +48,7 @@ static int sg_version_num = 30534; /* 2 digits for each component */ #include <linux/blkdev.h> #include <linux/delay.h> #include <linux/scatterlist.h> +#include <linux/blktrace_api.h> #include "scsi.h" #include <scsi/scsi_dbg.h> @@ -1067,6 +1068,17 @@ sg_ioctl(struct inode *inode, struct file *filp, case BLKSECTGET: return put_user(sdp->device->request_queue->max_sectors * 512, ip); + case BLKTRACESETUP: + return blk_trace_setup(sdp->device->request_queue, + sdp->disk->disk_name, + sdp->device->sdev_gendev.devt, + (char *)arg); + case BLKTRACESTART: + return blk_trace_startstop(sdp->device->request_queue, 1); + case BLKTRACESTOP: + return blk_trace_startstop(sdp->device->request_queue, 0); + case BLKTRACETEARDOWN: + return blk_trace_remove(sdp->device->request_queue); default: if (read_only) return -EPERM; /* don't know so take safe approach */ |