* [PATCH] fix read capacity for large disks when CONFIG_LBD=n (updated)
@ 2005-01-04 16:59 Tony Battersby
2005-01-04 17:45 ` James Bottomley
0 siblings, 1 reply; 4+ messages in thread
From: Tony Battersby @ 2005-01-04 16:59 UTC (permalink / raw)
To: 'James Bottomley'; +Cc: linux-scsi
(updated - this patch is correct for the case that sdkp->fix_capacity is set)
If CONFIG_LBD=n, then sd_read_capacity computes the capacity of a large
disk on a 32-bit platform as 1 + 0xffffffff = 0. Make it 0xffffffff
instead.
Anthony J. Battersby
Cybernetics
--- linux-2.6.10/drivers/scsi/sd.c.orig Fri Dec 24 16:35:23 2004
+++ linux-2.6.10/drivers/scsi/sd.c Tue Jan 4 11:52:01 2005
@@ -1082,9 +1082,13 @@ repeat:
" READ CAPACITY(16).\n", diskname);
longrc = 1;
goto repeat;
- } else {
- printk(KERN_ERR "%s: too big for kernel. Assuming maximum 2Tb\n", diskname);
}
+ printk(KERN_ERR "%s: too big for kernel. Assuming "
+ "maximum 2TB\n", diskname);
+ /* Don't add 1 as is normally done to avoid
+ * overflow. */
+ sdkp->capacity = 0xffffffff;
+ goto got_data;
}
sdkp->capacity = 1 + (((sector_t)buffer[0] << 24) |
(buffer[1] << 16) |
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] fix read capacity for large disks when CONFIG_LBD=n (updated) 2005-01-04 16:59 [PATCH] fix read capacity for large disks when CONFIG_LBD=n (updated) Tony Battersby @ 2005-01-04 17:45 ` James Bottomley 2005-01-04 17:56 ` [PATCH] fix read capacity for large disks when CONFIG_LBD=n(updated) Tony Battersby 2005-01-04 18:11 ` Tony Battersby 0 siblings, 2 replies; 4+ messages in thread From: James Bottomley @ 2005-01-04 17:45 UTC (permalink / raw) To: tonyb; +Cc: SCSI Mailing List On Tue, 2005-01-04 at 11:59 -0500, Tony Battersby wrote: > If CONFIG_LBD=n, then sd_read_capacity computes the capacity of a large > disk on a 32-bit platform as 1 + 0xffffffff = 0. Make it 0xffffffff > instead. Actually, I don't think this is at all a good idea. Not allowing a LBD device to be configured if the user hasn't enabled LBD (which is accidentally what the current code does) seems better to me. Imagine a 4TB fs. Plug it in to a system like this and you're going to corrupt it because you can't see half the disc. James ^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] fix read capacity for large disks when CONFIG_LBD=n(updated) 2005-01-04 17:45 ` James Bottomley @ 2005-01-04 17:56 ` Tony Battersby 2005-01-04 18:11 ` Tony Battersby 1 sibling, 0 replies; 4+ messages in thread From: Tony Battersby @ 2005-01-04 17:56 UTC (permalink / raw) To: 'James Bottomley'; +Cc: 'SCSI Mailing List' > Actually, I don't think this is at all a good idea. Not > allowing a LBD > device to be configured if the user hasn't enabled LBD (which is > accidentally what the current code does) seems better to me. That's fine with me. Anthony J. Battersby Cybernetics ^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] fix read capacity for large disks when CONFIG_LBD=n(updated) 2005-01-04 17:45 ` James Bottomley 2005-01-04 17:56 ` [PATCH] fix read capacity for large disks when CONFIG_LBD=n(updated) Tony Battersby @ 2005-01-04 18:11 ` Tony Battersby 1 sibling, 0 replies; 4+ messages in thread From: Tony Battersby @ 2005-01-04 18:11 UTC (permalink / raw) To: 'James Bottomley'; +Cc: 'SCSI Mailing List' Here's an alternate patch that corrects the kernel message and sets the capacity to 0 explicitly. Anthony J. Battersby Cybernetics --- linux-2.6.10/drivers/scsi/sd.c.orig Fri Dec 24 16:35:23 2004 +++ linux-2.6.10/drivers/scsi/sd.c Tue Jan 4 13:03:59 2005 @@ -1082,9 +1082,12 @@ repeat: " READ CAPACITY(16).\n", diskname); longrc = 1; goto repeat; - } else { - printk(KERN_ERR "%s: too big for kernel. Assuming maximum 2Tb\n", diskname); } + printk(KERN_ERR "%s: too big for this kernel. Use a " + "kernel compiled with support for large block " + "devices.\n", diskname); + sdkp->capacity = 0; + goto got_data; } sdkp->capacity = 1 + (((sector_t)buffer[0] << 24) | (buffer[1] << 16) | ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-01-04 18:15 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2005-01-04 16:59 [PATCH] fix read capacity for large disks when CONFIG_LBD=n (updated) Tony Battersby 2005-01-04 17:45 ` James Bottomley 2005-01-04 17:56 ` [PATCH] fix read capacity for large disks when CONFIG_LBD=n(updated) Tony Battersby 2005-01-04 18:11 ` Tony Battersby
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).