On Mon, Dec 20, 2010 at 08:06:33AM -0500, Kenneth R Westerback wrote:
quoted text > On Mon, Dec 20, 2010 at 06:24:17PM +1000, David Gwynne wrote:
> > On Mon, Dec 20, 2010 at 04:26:59PM +1000, David Gwynne wrote:
> > > im pretty sure scsi reports the last addressable sector, as opposed to the
> > > total number of sectors. will have a diff shortly.
> >
> > compiles. can someone test?
>
> 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;
>
If anyone can test some rebuilds with this or dlg@'s diff, at least
some RAID 1 rebuilds, that would be very appreciated confirmation
that this doesn't affect any internal logic of softraid.
.... Ken