* Re: Isn't sd_major() broken ?
[not found] <mailman.1049998202.18407.linux-kernel2news@redhat.com>
@ 2003-04-10 20:39 ` Pete Zaitcev
0 siblings, 0 replies; 3+ messages in thread
From: Pete Zaitcev @ 2003-04-10 20:39 UTC (permalink / raw)
To: Badari Pulavarty; +Cc: linux-kernel, linux-scsi
> --- drivers/scsi/sd.c.org Wed Apr 9 13:12:38 2003
> +++ drivers/scsi/sd.c Thu Apr 10 11:01:45 2003
> @@ -123,7 +123,7 @@ static int sd_major(int major_idx)
> case 1 ... 7:
> return SCSI_DISK1_MAJOR + major_idx - 1;
> case 8 ... 15:
> - return SCSI_DISK8_MAJOR + major_idx;
> + return SCSI_DISK8_MAJOR + major_idx - 8;
> default:
> BUG();
> return 0; /* shut up gcc */
>
Yes this seems good.
One is left to wonder, however, why 2.5 version is not using
a little array of majors here.
-- Pete
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Isn't sd_major() broken ?
@ 2003-04-10 20:46 Andries.Brouwer
0 siblings, 0 replies; 3+ messages in thread
From: Andries.Brouwer @ 2003-04-10 20:46 UTC (permalink / raw)
To: linux-kernel, linux-scsi, pbadari
From: Badari Pulavarty <pbadari@us.ibm.com>
I am little confused about the correctness of sd_major()
in drivers/scsi/sd.c.
Isn't sd_major() broken ? Here is the patch to fix it.
--- drivers/scsi/sd.c.org Wed Apr 9 13:12:38 2003
+++ drivers/scsi/sd.c Thu Apr 10 11:01:45 2003
@@ -123,7 +123,7 @@ static int sd_major(int major_idx)
case 1 ... 7:
return SCSI_DISK1_MAJOR + major_idx - 1;
case 8 ... 15:
- return SCSI_DISK8_MAJOR + major_idx;
+ return SCSI_DISK8_MAJOR + major_idx - 8;
default:
BUG();
return 0; /* shut up gcc */
Yes.
The sd_major() patch was from hch in 2.5.51 - maybe you are
the first to use more than 8 majors.
Andries
^ permalink raw reply [flat|nested] 3+ messages in thread
* Isn't sd_major() broken ?
@ 2003-04-10 18:01 Badari Pulavarty
0 siblings, 0 replies; 3+ messages in thread
From: Badari Pulavarty @ 2003-04-10 18:01 UTC (permalink / raw)
To: linux-kernel, linux-scsi
[-- Attachment #1: Type: text/plain, Size: 1207 bytes --]
Hi,
I am little confused about the correctness of sd_major() in drivers/scsi/sd.c.
static int sd_major(int major_idx)
{
switch (major_idx) {
case 0:
return SCSI_DISK0_MAJOR;
case 1 ... 7:
return SCSI_DISK1_MAJOR + major_idx - 1;
case 8 ... 15:
return SCSI_DISK8_MAJOR + major_idx;
default:
BUG();
return 0; /* shut up gcc */
}
}
So, if major_idx = 8, It returns 143.
But according to major.h, scsi has 128-135 reserved
majors. But it is registering 136 - 143 as its majors.
#define SCSI_DISK8_MAJOR 128
#define SCSI_DISK9_MAJOR 129
#define SCSI_DISK10_MAJOR 130
#define SCSI_DISK11_MAJOR 131
#define SCSI_DISK12_MAJOR 132
#define SCSI_DISK13_MAJOR 133
#define SCSI_DISK14_MAJOR 134
#define SCSI_DISK15_MAJOR 135
Isn't sd_major() broken ? Here is the patch to fix it.
Thanks,
Badari
# cat /proc/devices
...
Block devices:
2 fd
3 ide0
8 sd
11 sr
65 sd
66 sd
67 sd
68 sd
69 sd
70 sd
71 sd
136 sd
137 sd
138 sd
139 sd
140 sd
141 sd
142 sd
143 sd
[-- Attachment #2: major --]
[-- Type: text/x-diff, Size: 366 bytes --]
--- drivers/scsi/sd.c.org Wed Apr 9 13:12:38 2003
+++ drivers/scsi/sd.c Thu Apr 10 11:01:45 2003
@@ -123,7 +123,7 @@ static int sd_major(int major_idx)
case 1 ... 7:
return SCSI_DISK1_MAJOR + major_idx - 1;
case 8 ... 15:
- return SCSI_DISK8_MAJOR + major_idx;
+ return SCSI_DISK8_MAJOR + major_idx - 8;
default:
BUG();
return 0; /* shut up gcc */
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-04-10 20:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <mailman.1049998202.18407.linux-kernel2news@redhat.com>
2003-04-10 20:39 ` Isn't sd_major() broken ? Pete Zaitcev
2003-04-10 20:46 Andries.Brouwer
-- strict thread matches above, loose matches on Subject: below --
2003-04-10 18:01 Badari Pulavarty
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).