Skip to contentSkip to conversation

sd terabyte disk fix

PATCH In review Brian King 2 participants 2 messages May 28, 2004 SCSI

lore
Share & tools
lore

Brian King

author
#0 lore raw

PATCH 1/1 sd terabyte disk fix

James,

The following bug was hit when creating a hardware RAID array > 1 TB. Please apply.

Thanks

Signature · 3 lines
Brian King
eServer Storage I/O
IBM Linux Technology Center

This patch fixes a signed/unsigned bug that prevented > 1TB scsi disks from working.

---

 linux-2.4.26-bjking1/drivers/scsi/sd.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
drivers/scsi/sd.c renamed from drivers/scsi/sd.c~sd_terabyte_disk +4 -3
diff -puN drivers/scsi/sd.c~sd_terabyte_disk drivers/scsi/sd.c
@@ -294,7 +294,8 @@ static request_queue_t *sd_find_queue(kd
 
 static int sd_init_command(Scsi_Cmnd * SCpnt)
 {
-	int dev, block, this_count;
+	int dev, this_count;
+	unsigned int block;
 	struct hd_struct *ppnt;
 	Scsi_Disk *dpnt;
 #if CONFIG_SCSI_LOGGING
@@ -307,7 +308,7 @@ static int sd_init_command(Scsi_Cmnd * S
 	block = SCpnt->request.sector;
 	this_count = SCpnt->request_bufflen >> 9;
 
-	SCSI_LOG_HLQUEUE(1, printk("Doing sd request, dev = 0x%x, block = %d\n",
+	SCSI_LOG_HLQUEUE(1, printk("Doing sd request, dev = 0x%x, block = %u\n",
 	    SCpnt->request.rq_dev, block));
 
 	dpnt = &rscsi_disks[dev];
@@ -329,7 +330,7 @@ static int sd_init_command(Scsi_Cmnd * S
 		return 0;
 	}
 	SCSI_LOG_HLQUEUE(2, sd_devname(dev, nbuff));
-	SCSI_LOG_HLQUEUE(2, printk("%s : real dev = /dev/%d, block = %d\n",
+	SCSI_LOG_HLQUEUE(2, printk("%s : real dev = /dev/%d, block = %u\n",
 				   nbuff, dev, block));
 
 	/*

_

#1 lore raw
Quoted 2 lines · Brian King

The following bug was hit when creating a hardware RAID array > 1 TB. Please apply.

Well, this is a known failing of 2.4; It's not safe to promote block to unsigned since there are many places in the filesystem and block code where it gets used as a signed quantity.

If you want to use arrays >1TB, either use vanilla 2.6 with LBD support enabled, or one of the vendor kernels with it backported.

James