aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/ctl/ctl_backend_block.c
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2015-02-12 15:46:44 +0000
committerAlexander Motin <mav@FreeBSD.org>2015-02-12 15:46:44 +0000
commitfee04ef7a9de857888c87bbc024fdc902ba283f1 (patch)
tree051ff532d725914ce51c524f47a7ef29068318d4 /sys/cam/ctl/ctl_backend_block.c
parent66525b2d162286e927cb0db832627aa96e49b3e0 (diff)
downloadsrc-fee04ef7a9de857888c87bbc024fdc902ba283f1.tar.gz
src-fee04ef7a9de857888c87bbc024fdc902ba283f1.zip
Make XCOPY and WUT commands respect physical block size/offset.
This change by 2-3 times improves performance of misaligned XCOPY and WUT commands by avoiding unneeded read-modify-write cycles inside ZFS. MFC after: 1 week
Notes
Notes: svn path=/head/; revision=278625
Diffstat (limited to 'sys/cam/ctl/ctl_backend_block.c')
-rw-r--r--sys/cam/ctl/ctl_backend_block.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c
index 6b5f703a5bff..37ba5a8f481e 100644
--- a/sys/cam/ctl/ctl_backend_block.c
+++ b/sys/cam/ctl/ctl_backend_block.c
@@ -1187,7 +1187,8 @@ ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *be_lun,
struct ctl_be_block_io *beio;
struct ctl_be_block_softc *softc;
struct ctl_lba_len_flags *lbalen;
- uint64_t len_left, lba, pb, pbo, adj;
+ uint64_t len_left, lba;
+ uint32_t pb, pbo, adj;
int i, seglen;
uint8_t *buf, *end;
@@ -1241,8 +1242,11 @@ ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *be_lun,
DPRINTF("WRITE SAME at LBA %jx len %u\n",
(uintmax_t)lbalen->lba, lbalen->len);
- pb = (uint64_t)be_lun->blocksize << be_lun->pblockexp;
- pbo = pb - (uint64_t)be_lun->blocksize * be_lun->pblockoff;
+ pb = be_lun->blocksize << be_lun->pblockexp;
+ if (be_lun->pblockoff > 0)
+ pbo = pb - be_lun->blocksize * be_lun->pblockoff;
+ else
+ pbo = 0;
len_left = (uint64_t)lbalen->len * be_lun->blocksize;
for (i = 0, lba = 0; i < CTLBLK_MAX_SEGS && len_left > 0; i++) {