aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2008-01-11 04:09:43 -0500
committerJens Axboe <jens.axboe@oracle.com>2008-01-28 04:04:46 -0500
commit6da127ad0918f93ea93678dad62ce15ffed18797 (patch)
treeb2bf9ad228f18c643342ad376136d2f6b4be4137 /drivers/scsi
parent91525300baf162e83e923b09ca286f9205e21522 (diff)
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.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 17216b76efdc..aba28f335b88 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 */
48#include <linux/blkdev.h> 48#include <linux/blkdev.h>
49#include <linux/delay.h> 49#include <linux/delay.h>
50#include <linux/scatterlist.h> 50#include <linux/scatterlist.h>
51#include <linux/blktrace_api.h>
51 52
52#include "scsi.h" 53#include "scsi.h"
53#include <scsi/scsi_dbg.h> 54#include <scsi/scsi_dbg.h>
@@ -1067,6 +1068,17 @@ sg_ioctl(struct inode *inode, struct file *filp,
1067 case BLKSECTGET: 1068 case BLKSECTGET:
1068 return put_user(sdp->device->request_queue->max_sectors * 512, 1069 return put_user(sdp->device->request_queue->max_sectors * 512,
1069 ip); 1070 ip);
1071 case BLKTRACESETUP:
1072 return blk_trace_setup(sdp->device->request_queue,
1073 sdp->disk->disk_name,
1074 sdp->device->sdev_gendev.devt,
1075 (char *)arg);
1076 case BLKTRACESTART:
1077 return blk_trace_startstop(sdp->device->request_queue, 1);
1078 case BLKTRACESTOP:
1079 return blk_trace_startstop(sdp->device->request_queue, 0);
1080 case BLKTRACETEARDOWN:
1081 return blk_trace_remove(sdp->device->request_queue);
1070 default: 1082 default:
1071 if (read_only) 1083 if (read_only)
1072 return -EPERM; /* don't know so take safe approach */ 1084 return -EPERM; /* don't know so take safe approach */