diff options
author | 2015-07-19 17:04:31 +0000 | |
---|---|---|
committer | 2015-07-19 17:04:31 +0000 | |
commit | bd56a12f18f70c29777b73da12c832fa17cfcd09 (patch) | |
tree | 4d30cc032e41214dc6c517fab8b43efa515bdb80 | |
parent | Add proper kernel locking in the fpe_branch_emulate() function, to (diff) | |
download | wireguard-openbsd-bd56a12f18f70c29777b73da12c832fa17cfcd09.tar.xz wireguard-openbsd-bd56a12f18f70c29777b73da12c832fa17cfcd09.zip |
Stop adding and subtracting data offset. Just keep to chunk relative
block offsets until actual i/o is constructed and needs the physical
offset. Eliminate a number of <<DEV_BSIZE shifts as a bonus.
No intentional functional change.
Fixed and ok jsing@
-rw-r--r-- | sys/dev/softraid.c | 4 | ||||
-rw-r--r-- | sys/dev/softraid_concat.c | 3 | ||||
-rw-r--r-- | sys/dev/softraid_raid0.c | 5 | ||||
-rw-r--r-- | sys/dev/softraid_raid1.c | 5 | ||||
-rw-r--r-- | sys/dev/softraid_raid5.c | 11 | ||||
-rw-r--r-- | sys/dev/softraid_raid6.c | 5 |
6 files changed, 12 insertions, 21 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index 21d56c17c58..ec2a5939aad 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.355 2015/07/19 16:12:10 krw Exp $ */ +/* $OpenBSD: softraid.c,v 1.356 2015/07/19 17:04:31 krw Exp $ */ /* * Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org> @@ -2025,7 +2025,7 @@ sr_ccb_rw(struct sr_discipline *sd, int chunk, daddr_t blkno, else ccb->ccb_buf.b_flags |= B_WRITE; - ccb->ccb_buf.b_blkno = blkno; + ccb->ccb_buf.b_blkno = blkno + sd->sd_meta->ssd_data_offset; ccb->ccb_buf.b_bcount = len; ccb->ccb_buf.b_bufsize = len; ccb->ccb_buf.b_resid = len; diff --git a/sys/dev/softraid_concat.c b/sys/dev/softraid_concat.c index 5ca40cad47e..eeeade12cf1 100644 --- a/sys/dev/softraid_concat.c +++ b/sys/dev/softraid_concat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_concat.c,v 1.21 2013/11/22 03:47:07 krw Exp $ */ +/* $OpenBSD: softraid_concat.c,v 1.22 2015/07/19 17:04:31 krw Exp $ */ /* * Copyright (c) 2008 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2011 Joel Sing <jsing@openbsd.org> @@ -134,7 +134,6 @@ sr_concat_rw(struct sr_workunit *wu) goto bad; length = MIN(MIN(leftover, chunkend - lbaoffs), MAXPHYS); - physoffs += sd->sd_meta->ssd_data_offset << DEV_BSHIFT; /* make sure chunk is online */ scp = sd->sd_vol.sv_chunks[chunk]; diff --git a/sys/dev/softraid_raid0.c b/sys/dev/softraid_raid0.c index 510fa443b50..974eb1c347c 100644 --- a/sys/dev/softraid_raid0.c +++ b/sys/dev/softraid_raid0.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_raid0.c,v 1.47 2014/11/18 02:37:30 tedu Exp $ */ +/* $OpenBSD: softraid_raid0.c,v 1.48 2015/07/19 17:04:31 krw Exp $ */ /* * Copyright (c) 2008 Marco Peereboom <marco@peereboom.us> * @@ -144,8 +144,7 @@ sr_raid0_rw(struct sr_workunit *wu) chunk = strip_no % no_chunk; stripoffs = lbaoffs & (strip_size - 1); chunkoffs = (strip_no / no_chunk) << strip_bits; - physoffs = chunkoffs + stripoffs + - (sd->sd_meta->ssd_data_offset << DEV_BSHIFT); + physoffs = chunkoffs + stripoffs; length = MIN(xs->datalen, strip_size - stripoffs); leftover = xs->datalen; data = xs->data; diff --git a/sys/dev/softraid_raid1.c b/sys/dev/softraid_raid1.c index b88d1411f94..d1bc6e776f7 100644 --- a/sys/dev/softraid_raid1.c +++ b/sys/dev/softraid_raid1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_raid1.c,v 1.60 2015/01/27 10:12:45 dlg Exp $ */ +/* $OpenBSD: softraid_raid1.c,v 1.61 2015/07/19 17:04:31 krw Exp $ */ /* * Copyright (c) 2007 Marco Peereboom <marco@peereboom.us> * @@ -336,9 +336,6 @@ sr_raid1_rw(struct sr_workunit *wu) if (sr_validate_io(wu, &blk, "sr_raid1_rw")) goto bad; - /* calculate physical block */ - blk += sd->sd_meta->ssd_data_offset; - if (xs->flags & SCSI_DATA_IN) ios = 1; else diff --git a/sys/dev/softraid_raid5.c b/sys/dev/softraid_raid5.c index 1229a1e8353..cf55cd79e32 100644 --- a/sys/dev/softraid_raid5.c +++ b/sys/dev/softraid_raid5.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_raid5.c,v 1.19 2015/05/29 13:48:45 krw Exp $ */ +/* $OpenBSD: softraid_raid5.c,v 1.20 2015/07/19 17:04:31 krw Exp $ */ /* * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> * Copyright (c) 2009 Marco Peereboom <marco@peereboom.us> @@ -414,8 +414,7 @@ sr_raid5_rw(struct sr_workunit *wu) strip_no = lbaoffs >> strip_bits; strip_offs = lbaoffs & (strip_size - 1); chunk_offs = (strip_no / no_chunk) << strip_bits; - phys_offs = chunk_offs + strip_offs + - (sd->sd_meta->ssd_data_offset << DEV_BSHIFT); + phys_offs = chunk_offs + strip_offs; /* get size remaining in this stripe */ length = MIN(strip_size - strip_offs, datalen); @@ -814,8 +813,7 @@ sr_raid5_rebuild(struct sr_discipline *sd) } for (strip_no = restart; strip_no < chunk_strips; strip_no++) { - chunk_lba = (strip_size >> DEV_BSHIFT) * strip_no + - sd->sd_meta->ssd_data_offset; + chunk_lba = (strip_size >> DEV_BSHIFT) * strip_no; DNPRINTF(SR_D_REBUILD, "%s: %s rebuild strip %lld, " "chunk lba = %lld\n", DEVNAME(sd->sd_sc), @@ -867,8 +865,7 @@ sr_raid5_rebuild(struct sr_discipline *sd) sr_scsi_wu_put(sd, wu_r); sr_scsi_wu_put(sd, wu_w); - sd->sd_meta->ssd_rebuild = - (chunk_lba - sd->sd_meta->ssd_data_offset) * chunk_count; + sd->sd_meta->ssd_rebuild = chunk_lba * chunk_count; psz = sd->sd_meta->ssdi.ssd_size; rb = sd->sd_meta->ssd_rebuild; diff --git a/sys/dev/softraid_raid6.c b/sys/dev/softraid_raid6.c index 5234a11ecd7..0ba663bfa4f 100644 --- a/sys/dev/softraid_raid6.c +++ b/sys/dev/softraid_raid6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_raid6.c,v 1.65 2015/05/29 13:48:45 krw Exp $ */ +/* $OpenBSD: softraid_raid6.c,v 1.66 2015/07/19 17:04:31 krw Exp $ */ /* * Copyright (c) 2009 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2009 Jordan Hargrave <jordan@openbsd.org> @@ -411,8 +411,7 @@ sr_raid6_rw(struct sr_workunit *wu) strip_no = lbaoffs >> strip_bits; strip_offs = lbaoffs & (strip_size - 1); chunk_offs = (strip_no / no_chunk) << strip_bits; - phys_offs = chunk_offs + strip_offs + - (sd->sd_meta->ssd_data_offset << DEV_BSHIFT); + phys_offs = chunk_offs + strip_offs; /* get size remaining in this stripe */ length = MIN(strip_size - strip_offs, datalen); |