Deleted Added
full compact
ctl_backend_block.c (258871) ctl_backend_block.c (261538)
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 258871 2013-12-03 18:04:14Z trasz $");
43__FBSDID("$FreeBSD: head/sys/cam/ctl/ctl_backend_block.c 261538 2014-02-06 03:54:58Z 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>

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

505}
506
507static void
508ctl_be_block_biodone(struct bio *bio)
509{
510 struct ctl_be_block_io *beio;
511 struct ctl_be_block_lun *be_lun;
512 union ctl_io *io;
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>

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

505}
506
507static void
508ctl_be_block_biodone(struct bio *bio)
509{
510 struct ctl_be_block_io *beio;
511 struct ctl_be_block_lun *be_lun;
512 union ctl_io *io;
513 int error;
513
514 beio = bio->bio_caller1;
515 be_lun = beio->lun;
516 io = beio->io;
517
518 DPRINTF("entered\n");
519
514
515 beio = bio->bio_caller1;
516 be_lun = beio->lun;
517 io = beio->io;
518
519 DPRINTF("entered\n");
520
521 error = bio->bio_error;
520 mtx_lock(&be_lun->lock);
522 mtx_lock(&be_lun->lock);
521 if (bio->bio_error != 0)
523 if (error != 0)
522 beio->num_errors++;
523
524 beio->num_bios_done++;
525
526 /*
527 * XXX KDM will this cause WITNESS to complain? Holding a lock
528 * during the free might cause it to complain.
529 */

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

545 */
546 mtx_unlock(&be_lun->lock);
547
548 /*
549 * If there are any errors from the backing device, we fail the
550 * entire I/O with a medium error.
551 */
552 if (beio->num_errors > 0) {
524 beio->num_errors++;
525
526 beio->num_bios_done++;
527
528 /*
529 * XXX KDM will this cause WITNESS to complain? Holding a lock
530 * during the free might cause it to complain.
531 */

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

547 */
548 mtx_unlock(&be_lun->lock);
549
550 /*
551 * If there are any errors from the backing device, we fail the
552 * entire I/O with a medium error.
553 */
554 if (beio->num_errors > 0) {
553 if (beio->bio_cmd == BIO_FLUSH) {
555 if (error == EOPNOTSUPP) {
556 ctl_set_invalid_opcode(&io->scsiio);
557 } else if (beio->bio_cmd == BIO_FLUSH) {
554 /* XXX KDM is there is a better error here? */
555 ctl_set_internal_failure(&io->scsiio,
556 /*sks_valid*/ 1,
557 /*retry_count*/ 0xbad2);
558 } else
559 ctl_set_medium_error(&io->scsiio);
560 ctl_complete_beio(beio);
561 return;

--- 1786 unchanged lines hidden ---
558 /* XXX KDM is there is a better error here? */
559 ctl_set_internal_failure(&io->scsiio,
560 /*sks_valid*/ 1,
561 /*retry_count*/ 0xbad2);
562 } else
563 ctl_set_medium_error(&io->scsiio);
564 ctl_complete_beio(beio);
565 return;

--- 1786 unchanged lines hidden ---