patch-2.2.8 linux/drivers/scsi/sd.c

Next file: linux/drivers/scsi/sg.c
Previous file: linux/drivers/scsi/scsi_ioctl.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.7/linux/drivers/scsi/sd.c linux/drivers/scsi/sd.c
@@ -719,6 +719,12 @@
  	    SCpnt = end_scsi_request(SCpnt, 0, SCpnt->request.nr_sectors);
  	    goto repeat;
  	}
+    if (rscsi_disks[dev].sector_size == 4096) 
+	if((block & 7) || (SCpnt->request.nr_sectors & 7)) {
+	    printk("sd.cBad block number/count requested");
+	    SCpnt = end_scsi_request(SCpnt, 0, SCpnt->request.nr_sectors);
+	    goto repeat;
+	}
      
     switch (SCpnt->request.cmd)
     {
@@ -984,6 +990,13 @@
 
     cmd[1] = (SCpnt->lun << 5) & 0xe0;
 
+     if (rscsi_disks[dev].sector_size == 4096){
+	if(block & 7) panic("sd.c:Bad block number requested");
+	if(this_count & 7) panic("sd.c:Bad block number requested");
+	block = block >> 3;
+	this_count = block >> 3;
+     }
+
      if (rscsi_disks[dev].sector_size == 2048){
  	if(block & 3) panic("sd.c:Bad block number requested");
  	if(this_count & 3) panic("sd.c:Bad block number requested");
@@ -1335,6 +1348,7 @@
 	if (rscsi_disks[i].sector_size != 512 &&
 	    rscsi_disks[i].sector_size != 1024 &&
 	    rscsi_disks[i].sector_size != 2048 &&
+	    rscsi_disks[i].sector_size != 4096 &&
 	    rscsi_disks[i].sector_size != 256)
 	{
 	    printk ("%s : unsupported sector size %d.\n",
@@ -1394,6 +1408,8 @@
 		nbuff, hard_sector, rscsi_disks[i].capacity,
                 mb, sz_quot, sz_rem);
     }
+	if(rscsi_disks[i].sector_size == 4096)
+	    rscsi_disks[i].capacity <<= 3;
 	if(rscsi_disks[i].sector_size == 2048)
 	    rscsi_disks[i].capacity <<= 2;  /* Change into 512 byte sectors */
 	if(rscsi_disks[i].sector_size == 1024)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)