Re: softraid(4) disks are of wrong size

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Kenneth R Westerback
Date: Monday, December 20, 2010 - 6:06 am

On Mon, Dec 20, 2010 at 06:24:17PM +1000, David Gwynne wrote:

Pretty much identical to the one I sent directly out to marco, Andreas
and tedu. Andreas has reported it worked for him. Mine is below for
completeness. I like my variable name better, but int64_t may be the
better type to use.

.... Ken

Index: softraid.c
===================================================================
RCS file: /cvs/src/sys/dev/softraid.c,v
retrieving revision 1.216
diff -u -p -r1.216 softraid.c
--- softraid.c	6 Nov 2010 23:01:56 -0000	1.216
+++ softraid.c	19 Dec 2010 21:37:17 -0000
@@ -3506,22 +3506,24 @@ sr_raid_read_cap(struct sr_workunit *wu)
 	struct scsi_xfer	*xs = wu->swu_xs;
 	struct scsi_read_cap_data rcd;
 	struct scsi_read_cap_data_16 rcd16;
+	daddr64_t		addr;
 	int			rv = 1;
 
 	DNPRINTF(SR_D_DIS, "%s: sr_raid_read_cap\n", DEVNAME(sd->sd_sc));
 
+	addr = sd->sd_meta->ssdi.ssd_size - 1;
 	if (xs->cmd->opcode == READ_CAPACITY) {
 		bzero(&rcd, sizeof(rcd));
-		if (sd->sd_meta->ssdi.ssd_size > 0xffffffffllu)
+		if (addr > 0xffffffffllu)
 			_lto4b(0xffffffff, rcd.addr);
 		else
-			_lto4b(sd->sd_meta->ssdi.ssd_size, rcd.addr);
+			_lto4b(addr, rcd.addr);
 		_lto4b(512, rcd.length);
 		sr_copy_internal_data(xs, &rcd, sizeof(rcd));
 		rv = 0;
 	} else if (xs->cmd->opcode == READ_CAPACITY_16) {
 		bzero(&rcd16, sizeof(rcd16));
-		_lto8b(sd->sd_meta->ssdi.ssd_size, rcd16.addr);
+		_lto8b(addr, rcd16.addr);
 		_lto4b(512, rcd16.length);
 		sr_copy_internal_data(xs, &rcd16, sizeof(rcd16));
 		rv = 0;
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
softraid(4) disks are of wrong size, Andreas Bartelt, (Sun Dec 19, 6:17 am)
Re: softraid(4) disks are of wrong size, Marco Peereboom, (Sun Dec 19, 9:15 am)
Re: softraid(4) disks are of wrong size, Andreas Bartelt, (Sun Dec 19, 9:47 am)
Re: softraid(4) disks are of wrong size, Nick Holland, (Sun Dec 19, 9:51 am)
Re: softraid(4) disks are of wrong size, Otto Moerbeek, (Sun Dec 19, 10:16 am)
Re: softraid(4) disks are of wrong size, Kenneth R Westerback, (Sun Dec 19, 2:28 pm)
Re: softraid(4) disks are of wrong size, Ted Unangst, (Sun Dec 19, 3:32 pm)
Re: softraid(4) disks are of wrong size, David Gwynne, (Sun Dec 19, 11:26 pm)
Re: softraid(4) disks are of wrong size, David Gwynne, (Mon Dec 20, 1:24 am)
Re: softraid(4) disks are of wrong size, Andreas Bartelt, (Mon Dec 20, 3:50 am)
Re: softraid(4) disks are of wrong size, Kenneth R Westerback, (Mon Dec 20, 6:06 am)
Re: softraid(4) disks are of wrong size, Kenneth R Westerback, (Mon Dec 20, 6:09 am)
Re: softraid(4) disks are of wrong size, Kenneth R Westerback, (Mon Dec 20, 8:02 am)
Re: softraid(4) disks are of wrong size, Kenneth R Westerback, (Mon Dec 20, 10:26 am)
Re: softraid(4) disks are of wrong size, Andreas Bartelt, (Mon Dec 20, 10:59 am)
Re: softraid(4) disks are of wrong size, Marco Peereboom, (Mon Dec 20, 12:18 pm)