]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Martin Peschke <mpeschke@linux.vnet.ibm.com> |
2 | Subject: [Patch] sg: fix device number in blktrace data | |
3 | Date: 2009-01-30 14:46:23 | |
4 | References: bnc#473537 | |
5 | ||
6 | Description: blktrace: scsi generic devices have no device number set | |
7 | Symptom: Start btrace on a SCSI generic device like in the sample output: | |
8 | [root@t6315030 ~]# lsscsi -g | grep "sda " | |
9 | [0:0:10:1075855393]disk IBM 2107900 1.50 /dev/sda /dev/sg0 | |
10 | [root@t6315030 ~]# ls -la /dev/sda /dev/sg0 | |
11 | brw-rw---- 1 root disk 8, 0 2009-02-03 08:04 /dev/sda | |
12 | crw-r----- 1 root disk 21, 0 2009-02-03 08:04 /dev/sg0 | |
13 | [root@t6315030 ~]# btrace /dev/sg0 | head | |
14 | 8,0 0 1 0.000000000 7700 A R 6742 + 8 <- (8,1) 6680 | |
15 | 0,0 0 2 0.000000235 7700 Q R 6742 + 8 [ls] | |
16 | 0,0 0 3 0.000006860 7700 G R 6742 + 8 [ls] | |
17 | 0,0 0 4 0.000010250 7700 P N [ls] | |
18 | 0,0 0 5 0.000013172 7700 I R 6742 + 8 [ls] | |
19 | 0,0 0 6 0.000017266 7700 U N [ls] 1 | |
20 | 0,0 0 7 0.000023078 7700 D R 6742 + 8 [ls] | |
21 | 0,0 1 2 0.000446668 0 C R 6742 + 8 [0] | |
22 | 8,0 1 3 0.000624106 7700 A R 9699406 + 8 <- (8,1) | |
23 | 0,0 1 4 0.000624403 7700 Q R 9699406 + 8 [ls] | |
24 | Note that in the first column, the device number for the named | |
25 | device (8:0) is reported correctly, while the device number for | |
26 | the scsi generic device is reported as 0:0 instead of 21:0. | |
27 | Problem: The device number for the scsi generic device is not correctly | |
28 | set during initialization of blktrace. | |
29 | Solution: Initialize with the correct device number, see | |
30 | s390-sles11-fix-device-number-in-blktrace.patch | |
31 | ||
32 | Acked-by: Jan Blunck <jblunck@suse.de> | |
33 | --- | |
34 | drivers/scsi/sg.c | 2 +- | |
35 | 1 file changed, 1 insertion(+), 1 deletion(-) | |
36 | ||
37 | Index: b/drivers/scsi/sg.c | |
38 | =================================================================== | |
39 | --- a/drivers/scsi/sg.c | |
40 | +++ b/drivers/scsi/sg.c | |
41 | @@ -1097,7 +1097,7 @@ sg_ioctl(struct inode *inode, struct fil | |
42 | case BLKTRACESETUP: | |
43 | return blk_trace_setup(sdp->device->request_queue, | |
44 | sdp->disk->disk_name, | |
45 | - sdp->device->sdev_gendev.devt, | |
46 | + MKDEV(SCSI_GENERIC_MAJOR, sdp->index), | |
47 | (char *)arg); | |
48 | case BLKTRACESTART: | |
49 | return blk_trace_startstop(sdp->device->request_queue, 1); |