ctl_backend_block.c (278619) | ctl_backend_block.c (278625) |
---|---|
1/*- 2 * Copyright (c) 2003 Silicon Graphics International Corp. 3 * Copyright (c) 2009-2011 Spectra Logic Corporation 4 * Copyright (c) 2012 The FreeBSD Foundation 5 * All rights reserved. 6 * 7 * Portions of this software were developed by Edward Tomasz Napierala 8 * under sponsorship from the FreeBSD Foundation. --- 26 unchanged lines hidden (view full) --- 35 * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_backend_block.c#5 $ 36 */ 37/* 38 * CAM Target Layer driver backend for block devices. 39 * 40 * Author: Ken Merry <ken@FreeBSD.org> 41 */ 42#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2003 Silicon Graphics International Corp. 3 * Copyright (c) 2009-2011 Spectra Logic Corporation 4 * Copyright (c) 2012 The FreeBSD Foundation 5 * All rights reserved. 6 * 7 * Portions of this software were developed by Edward Tomasz Napierala 8 * under sponsorship from the FreeBSD Foundation. --- 26 unchanged lines hidden (view full) --- 35 * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_backend_block.c#5 $ 36 */ 37/* 38 * CAM Target Layer driver backend for block devices. 39 * 40 * Author: Ken Merry <ken@FreeBSD.org> 41 */ 42#include <sys/cdefs.h> |
43__FBSDID("$FreeBSD: head/sys/cam/ctl/ctl_backend_block.c 278619 2015-02-12 10:28:45Z mav $"); | 43__FBSDID("$FreeBSD: head/sys/cam/ctl/ctl_backend_block.c 278625 2015-02-12 15:46:44Z mav $"); |
44 45#include <sys/param.h> 46#include <sys/systm.h> 47#include <sys/kernel.h> 48#include <sys/types.h> 49#include <sys/kthread.h> 50#include <sys/bio.h> 51#include <sys/fcntl.h> --- 1130 unchanged lines hidden (view full) --- 1182 1183static void 1184ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *be_lun, 1185 union ctl_io *io) 1186{ 1187 struct ctl_be_block_io *beio; 1188 struct ctl_be_block_softc *softc; 1189 struct ctl_lba_len_flags *lbalen; | 44 45#include <sys/param.h> 46#include <sys/systm.h> 47#include <sys/kernel.h> 48#include <sys/types.h> 49#include <sys/kthread.h> 50#include <sys/bio.h> 51#include <sys/fcntl.h> --- 1130 unchanged lines hidden (view full) --- 1182 1183static void 1184ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *be_lun, 1185 union ctl_io *io) 1186{ 1187 struct ctl_be_block_io *beio; 1188 struct ctl_be_block_softc *softc; 1189 struct ctl_lba_len_flags *lbalen; |
1190 uint64_t len_left, lba, pb, pbo, adj; | 1190 uint64_t len_left, lba; 1191 uint32_t pb, pbo, adj; |
1191 int i, seglen; 1192 uint8_t *buf, *end; 1193 1194 DPRINTF("entered\n"); 1195 1196 beio = (struct ctl_be_block_io *)PRIV(io)->ptr; 1197 softc = be_lun->softc; 1198 lbalen = ARGS(beio->io); --- 37 unchanged lines hidden (view full) --- 1236 } 1237 1238 beio->bio_cmd = BIO_WRITE; 1239 beio->ds_trans_type = DEVSTAT_WRITE; 1240 1241 DPRINTF("WRITE SAME at LBA %jx len %u\n", 1242 (uintmax_t)lbalen->lba, lbalen->len); 1243 | 1192 int i, seglen; 1193 uint8_t *buf, *end; 1194 1195 DPRINTF("entered\n"); 1196 1197 beio = (struct ctl_be_block_io *)PRIV(io)->ptr; 1198 softc = be_lun->softc; 1199 lbalen = ARGS(beio->io); --- 37 unchanged lines hidden (view full) --- 1237 } 1238 1239 beio->bio_cmd = BIO_WRITE; 1240 beio->ds_trans_type = DEVSTAT_WRITE; 1241 1242 DPRINTF("WRITE SAME at LBA %jx len %u\n", 1243 (uintmax_t)lbalen->lba, lbalen->len); 1244 |
1244 pb = (uint64_t)be_lun->blocksize << be_lun->pblockexp; 1245 pbo = pb - (uint64_t)be_lun->blocksize * be_lun->pblockoff; | 1245 pb = be_lun->blocksize << be_lun->pblockexp; 1246 if (be_lun->pblockoff > 0) 1247 pbo = pb - be_lun->blocksize * be_lun->pblockoff; 1248 else 1249 pbo = 0; |
1246 len_left = (uint64_t)lbalen->len * be_lun->blocksize; 1247 for (i = 0, lba = 0; i < CTLBLK_MAX_SEGS && len_left > 0; i++) { 1248 1249 /* 1250 * Setup the S/G entry for this chunk. 1251 */ 1252 seglen = MIN(CTLBLK_MAX_SEG, len_left); 1253 if (pb > be_lun->blocksize) { --- 1675 unchanged lines hidden --- | 1250 len_left = (uint64_t)lbalen->len * be_lun->blocksize; 1251 for (i = 0, lba = 0; i < CTLBLK_MAX_SEGS && len_left > 0; i++) { 1252 1253 /* 1254 * Setup the S/G entry for this chunk. 1255 */ 1256 seglen = MIN(CTLBLK_MAX_SEG, len_left); 1257 if (pb > be_lun->blocksize) { --- 1675 unchanged lines hidden --- |