Deleted Added
full compact
ctl_backend_ramdisk.c (275879) ctl_backend_ramdisk.c (275881)
1/*-
2 * Copyright (c) 2003, 2008 Silicon Graphics International Corp.
3 * Copyright (c) 2012 The FreeBSD Foundation
4 * All rights reserved.
5 *
6 * Portions of this software were developed by Edward Tomasz Napierala
7 * under sponsorship from the FreeBSD Foundation.
8 *

--- 26 unchanged lines hidden (view full) ---

35 */
36/*
37 * CAM Target Layer backend for a "fake" ramdisk.
38 *
39 * Author: Ken Merry <ken@FreeBSD.org>
40 */
41
42#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003, 2008 Silicon Graphics International Corp.
3 * Copyright (c) 2012 The FreeBSD Foundation
4 * All rights reserved.
5 *
6 * Portions of this software were developed by Edward Tomasz Napierala
7 * under sponsorship from the FreeBSD Foundation.
8 *

--- 26 unchanged lines hidden (view full) ---

35 */
36/*
37 * CAM Target Layer backend for a "fake" ramdisk.
38 *
39 * Author: Ken Merry <ken@FreeBSD.org>
40 */
41
42#include <sys/cdefs.h>
43__FBSDID("$FreeBSD: stable/10/sys/cam/ctl/ctl_backend_ramdisk.c 275879 2014-12-18 08:23:04Z mav $");
43__FBSDID("$FreeBSD: stable/10/sys/cam/ctl/ctl_backend_ramdisk.c 275881 2014-12-18 08:25:00Z mav $");
44
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/kernel.h>
48#include <sys/condvar.h>
49#include <sys/types.h>
50#include <sys/lock.h>
51#include <sys/mutex.h>

--- 181 unchanged lines hidden (view full) ---

233 getbintime(&cur_bt);
234 bintime_sub(&cur_bt, &io->io_hdr.dma_start_bt);
235 bintime_add(&io->io_hdr.dma_bt, &cur_bt);
236 io->io_hdr.num_dmas++;
237#endif
238 if (io->scsiio.kern_sg_entries > 0)
239 free(io->scsiio.kern_data_ptr, M_RAMDISK);
240 io->scsiio.kern_rel_offset += io->scsiio.kern_data_len;
44
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/kernel.h>
48#include <sys/condvar.h>
49#include <sys/types.h>
50#include <sys/lock.h>
51#include <sys/mutex.h>

--- 181 unchanged lines hidden (view full) ---

233 getbintime(&cur_bt);
234 bintime_sub(&cur_bt, &io->io_hdr.dma_start_bt);
235 bintime_add(&io->io_hdr.dma_bt, &cur_bt);
236 io->io_hdr.num_dmas++;
237#endif
238 if (io->scsiio.kern_sg_entries > 0)
239 free(io->scsiio.kern_data_ptr, M_RAMDISK);
240 io->scsiio.kern_rel_offset += io->scsiio.kern_data_len;
241 if ((io->io_hdr.port_status == 0)
242 && ((io->io_hdr.flags & CTL_FLAG_ABORT) == 0)
243 && ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)) {
241 if (io->io_hdr.flags & CTL_FLAG_ABORT) {
242 ;
243 } else if ((io->io_hdr.port_status == 0) &&
244 ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)) {
244 if (io->io_hdr.ctl_private[CTL_PRIV_BACKEND].integer > 0) {
245 mtx_lock(&be_lun->queue_lock);
246 STAILQ_INSERT_TAIL(&be_lun->cont_queue,
247 &io->io_hdr, links);
248 mtx_unlock(&be_lun->queue_lock);
249 taskqueue_enqueue(be_lun->io_taskqueue,
250 &be_lun->io_task);
251 return (0);
252 }
253 ctl_set_success(&io->scsiio);
245 if (io->io_hdr.ctl_private[CTL_PRIV_BACKEND].integer > 0) {
246 mtx_lock(&be_lun->queue_lock);
247 STAILQ_INSERT_TAIL(&be_lun->cont_queue,
248 &io->io_hdr, links);
249 mtx_unlock(&be_lun->queue_lock);
250 taskqueue_enqueue(be_lun->io_taskqueue,
251 &be_lun->io_task);
252 return (0);
253 }
254 ctl_set_success(&io->scsiio);
254 } else if ((io->io_hdr.port_status != 0)
255 && ((io->io_hdr.flags & CTL_FLAG_ABORT) == 0)
256 && ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)){
255 } else if ((io->io_hdr.port_status != 0) &&
256 ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE ||
257 (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) {
257 /*
258 * For hardware error sense keys, the sense key
259 * specific value is defined to be a retry count,
260 * but we use it to pass back an internal FETD
261 * error code. XXX KDM Hopefully the FETD is only
262 * using 16 bits for an error code, since that's
263 * all the space we have in the sks field.
264 */

--- 709 unchanged lines hidden ---
258 /*
259 * For hardware error sense keys, the sense key
260 * specific value is defined to be a retry count,
261 * but we use it to pass back an internal FETD
262 * error code. XXX KDM Hopefully the FETD is only
263 * using 16 bits for an error code, since that's
264 * all the space we have in the sks field.
265 */

--- 709 unchanged lines hidden ---