All of lore.kernel.org
 help / color / mirror / Atom feed
* PATCH: Bogus disk geometry on large disks
@ 2006-05-26 16:29 Alan Cox
  2006-05-26 17:57 ` Matthew Wilcox
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Cox @ 2006-05-26 16:29 UTC (permalink / raw)
  To: akpm, linux-scsi

We currently stuff a truncated size into the geometry logic and return
the result which can produce bizarre reports for a 4Tb array. Since that
mapping logic isn't useful for disks that big don't try and map this way
at all.

Signed-off-by: Alan Cox <alan@redhat.com>

--- libata-ref/drivers/scsi/scsicam.c	2006-05-23 13:05:45.000000000 +0100
+++ libata-dev/drivers/scsi/scsicam.c	2006-05-24 01:07:57.541182984 +0100
@@ -68,7 +68,7 @@
 			       (unsigned int *)ip + 0, (unsigned int *)ip + 1);
 	kfree(p);
 
-	if (ret == -1) {
+	if (ret == -1 && capacity < (1ULL << 32)) {
 		/* pick some standard mapping with at most 1024 cylinders,
 		   and at most 62 sectors per track - this works up to
 		   7905 MB */


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: Bogus disk geometry on large disks
  2006-05-26 16:29 PATCH: Bogus disk geometry on large disks Alan Cox
@ 2006-05-26 17:57 ` Matthew Wilcox
  2006-05-26 18:22   ` Alan Cox
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew Wilcox @ 2006-05-26 17:57 UTC (permalink / raw)
  To: Alan Cox; +Cc: akpm, linux-scsi

On Fri, May 26, 2006 at 05:29:25PM +0100, Alan Cox wrote:
>  
> -	if (ret == -1) {
> +	if (ret == -1 && capacity < (1ULL << 32)) {
>  		/* pick some standard mapping with at most 1024 cylinders,

won't that provoke a gcc warning when sector_t is 32-bit?  how about ...

+	if (ret == -1 && ((capacity >> 16) >> 16) > 0)

instead?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: Bogus disk geometry on large disks
  2006-05-26 18:22   ` Alan Cox
@ 2006-05-26 18:20     ` Matthew Wilcox
  2006-05-26 19:57       ` Doug Maxey
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew Wilcox @ 2006-05-26 18:20 UTC (permalink / raw)
  To: Alan Cox; +Cc: akpm, linux-scsi

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=unknown-8bit, Size: 1328 bytes --]

On Fri, May 26, 2006 at 07:22:18PM +0100, Alan Cox wrote:
> On Gwe, 2006-05-26 at 11:57 -0600, Matthew Wilcox wrote:
> > On Fri, May 26, 2006 at 05:29:25PM +0100, Alan Cox wrote:
> > >  
> > > -	if (ret == -1) {
> > > +	if (ret == -1 && capacity < (1ULL << 32)) {
> > >  		/* pick some standard mapping with at most 1024 cylinders,
> > 
> > won't that provoke a gcc warning when sector_t is 32-bit?  how about ...
> 
> I don't believe it will as the type is forced to "1ULL"

gcc disagrees with you ;-)

$ cat test.c 
unsigned int y;

int main(void)
{
        if (y < (1ULL << 32))
                return 0;
        return 1;
}
$ gcc -O2 -W -Wall -o test test.c
test.c: In function ‘main’:
test.c:5: warning: comparison is always true due to limited range of data type

$ cat test.c 
unsigned int y;

int main(void)
{
        if (((y >> 16) >> 16) > 0)
                return 0;
        return 1;
}
$ gcc -O2 -W -Wall -o test test.c

(anyone know how you turn off that fucking UTF8 crap that gcc insists
on putting into its warning/error messages?  Who thought that was a
good idea?)

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: Bogus disk geometry on large disks
  2006-05-26 17:57 ` Matthew Wilcox
@ 2006-05-26 18:22   ` Alan Cox
  2006-05-26 18:20     ` Matthew Wilcox
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Cox @ 2006-05-26 18:22 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: akpm, linux-scsi

On Gwe, 2006-05-26 at 11:57 -0600, Matthew Wilcox wrote:
> On Fri, May 26, 2006 at 05:29:25PM +0100, Alan Cox wrote:
> >  
> > -	if (ret == -1) {
> > +	if (ret == -1 && capacity < (1ULL << 32)) {
> >  		/* pick some standard mapping with at most 1024 cylinders,
> 
> won't that provoke a gcc warning when sector_t is 32-bit?  how about ...

I don't believe it will as the type is forced to "1ULL"

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: Bogus disk geometry on large disks
  2006-05-26 18:20     ` Matthew Wilcox
@ 2006-05-26 19:57       ` Doug Maxey
  0 siblings, 0 replies; 5+ messages in thread
From: Doug Maxey @ 2006-05-26 19:57 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: Alan Cox, akpm, linux-scsi


On Fri, 26 May 2006 12:20:02 MDT, Matthew Wilcox wrote:
...
>(anyone know how you turn off that fucking UTF8 crap that gcc insists
>on putting into its warning/error messages?  Who thought that was a
>good idea?)

LANG=C works here, and inside emacs.

However, when run from gterm in FC5, looks ok on the screen.

$ gcc -O2 -W -Wall -o test test.c
x.c: In function \u2018main\u2019:
x.c:5: warning: comparison is always true due to limited range of data type
$ echo $LANG
en_US.UTF-8


$ LANG=C gcc -O2 -W -Wall -o test x.c
x.c: In function 'main':
x.c:5: warning: comparison is always true due to limited range of data type
$

So it appears to fix.

++doug


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-05-26 19:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-26 16:29 PATCH: Bogus disk geometry on large disks Alan Cox
2006-05-26 17:57 ` Matthew Wilcox
2006-05-26 18:22   ` Alan Cox
2006-05-26 18:20     ` Matthew Wilcox
2006-05-26 19:57       ` Doug Maxey

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.