ctl_backend_block.c (274732) | ctl_backend_block.c (275881) |
---|---|
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: stable/10/sys/cam/ctl/ctl_backend_block.c 274732 2014-11-20 01:55:12Z mav $"); | 43__FBSDID("$FreeBSD: stable/10/sys/cam/ctl/ctl_backend_block.c 275881 2014-12-18 08:25:00Z mav $"); |
44 45#include <opt_kdtrace.h> 46 47#include <sys/param.h> 48#include <sys/systm.h> 49#include <sys/kernel.h> 50#include <sys/types.h> 51#include <sys/kthread.h> --- 327 unchanged lines hidden (view full) --- 379 io->io_hdr.num_dmas++; 380#endif 381 io->scsiio.kern_rel_offset += io->scsiio.kern_data_len; 382 383 /* 384 * We set status at this point for read commands, and write 385 * commands with errors. 386 */ | 44 45#include <opt_kdtrace.h> 46 47#include <sys/param.h> 48#include <sys/systm.h> 49#include <sys/kernel.h> 50#include <sys/types.h> 51#include <sys/kthread.h> --- 327 unchanged lines hidden (view full) --- 379 io->io_hdr.num_dmas++; 380#endif 381 io->scsiio.kern_rel_offset += io->scsiio.kern_data_len; 382 383 /* 384 * We set status at this point for read commands, and write 385 * commands with errors. 386 */ |
387 if ((io->io_hdr.port_status == 0) && 388 ((io->io_hdr.flags & CTL_FLAG_ABORT) == 0) && | 387 if (io->io_hdr.flags & CTL_FLAG_ABORT) { 388 ; 389 } else if ((io->io_hdr.port_status == 0) && |
389 ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)) { 390 lbalen = ARGS(beio->io); 391 if (lbalen->flags & CTL_LLF_READ) { 392 ctl_set_success(&io->scsiio); 393 } else if (lbalen->flags & CTL_LLF_COMPARE) { 394 /* We have two data blocks ready for comparison. */ 395 for (i = 0; i < beio->num_segs; i++) { 396 if (memcmp(beio->sg_segs[i].addr, --- 6 unchanged lines hidden (view full) --- 403 /*current_error*/ 1, 404 /*sense_key*/ SSD_KEY_MISCOMPARE, 405 /*asc*/ 0x1D, 406 /*ascq*/ 0x00, 407 SSD_ELEM_NONE); 408 else 409 ctl_set_success(&io->scsiio); 410 } | 390 ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)) { 391 lbalen = ARGS(beio->io); 392 if (lbalen->flags & CTL_LLF_READ) { 393 ctl_set_success(&io->scsiio); 394 } else if (lbalen->flags & CTL_LLF_COMPARE) { 395 /* We have two data blocks ready for comparison. */ 396 for (i = 0; i < beio->num_segs; i++) { 397 if (memcmp(beio->sg_segs[i].addr, --- 6 unchanged lines hidden (view full) --- 404 /*current_error*/ 1, 405 /*sense_key*/ SSD_KEY_MISCOMPARE, 406 /*asc*/ 0x1D, 407 /*ascq*/ 0x00, 408 SSD_ELEM_NONE); 409 else 410 ctl_set_success(&io->scsiio); 411 } |
411 } 412 else if ((io->io_hdr.port_status != 0) 413 && ((io->io_hdr.flags & CTL_FLAG_ABORT) == 0) 414 && ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)) { | 412 } else if ((io->io_hdr.port_status != 0) && 413 ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || 414 (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { |
415 /* 416 * For hardware error sense keys, the sense key 417 * specific value is defined to be a retry count, 418 * but we use it to pass back an internal FETD 419 * error code. XXX KDM Hopefully the FETD is only 420 * using 16 bits for an error code, since that's 421 * all the space we have in the sks field. 422 */ --- 107 unchanged lines hidden (view full) --- 530 */ 531 if ((beio->bio_cmd == BIO_WRITE) 532 || (beio->bio_cmd == BIO_FLUSH) 533 || (beio->bio_cmd == BIO_DELETE) 534 || (ARGS(io)->flags & CTL_LLF_VERIFY)) { 535 ctl_set_success(&io->scsiio); 536 ctl_complete_beio(beio); 537 } else { | 415 /* 416 * For hardware error sense keys, the sense key 417 * specific value is defined to be a retry count, 418 * but we use it to pass back an internal FETD 419 * error code. XXX KDM Hopefully the FETD is only 420 * using 16 bits for an error code, since that's 421 * all the space we have in the sks field. 422 */ --- 107 unchanged lines hidden (view full) --- 530 */ 531 if ((beio->bio_cmd == BIO_WRITE) 532 || (beio->bio_cmd == BIO_FLUSH) 533 || (beio->bio_cmd == BIO_DELETE) 534 || (ARGS(io)->flags & CTL_LLF_VERIFY)) { 535 ctl_set_success(&io->scsiio); 536 ctl_complete_beio(beio); 537 } else { |
538 if ((ARGS(io)->flags & CTL_LLF_READ) && 539 beio->beio_cont == NULL) 540 ctl_set_success(&io->scsiio); |
|
538#ifdef CTL_TIME_IO 539 getbintime(&io->io_hdr.dma_start_bt); 540#endif 541 ctl_datamove(io); 542 } 543} 544 545static void --- 191 unchanged lines hidden (view full) --- 737 * If this is a write or a verify, we're all done. 738 * If this is a read, we can now send the data to the user. 739 */ 740 if ((beio->bio_cmd == BIO_WRITE) || 741 (ARGS(io)->flags & CTL_LLF_VERIFY)) { 742 ctl_set_success(&io->scsiio); 743 ctl_complete_beio(beio); 744 } else { | 541#ifdef CTL_TIME_IO 542 getbintime(&io->io_hdr.dma_start_bt); 543#endif 544 ctl_datamove(io); 545 } 546} 547 548static void --- 191 unchanged lines hidden (view full) --- 740 * If this is a write or a verify, we're all done. 741 * If this is a read, we can now send the data to the user. 742 */ 743 if ((beio->bio_cmd == BIO_WRITE) || 744 (ARGS(io)->flags & CTL_LLF_VERIFY)) { 745 ctl_set_success(&io->scsiio); 746 ctl_complete_beio(beio); 747 } else { |
748 if ((ARGS(io)->flags & CTL_LLF_READ) && 749 beio->beio_cont == NULL) 750 ctl_set_success(&io->scsiio); |
|
745#ifdef CTL_TIME_IO 746 getbintime(&io->io_hdr.dma_start_bt); 747#endif 748 ctl_datamove(io); 749 } 750} 751 752static void --- 73 unchanged lines hidden (view full) --- 826 * If this is a write or a verify, we're all done. 827 * If this is a read, we can now send the data to the user. 828 */ 829 if ((beio->bio_cmd == BIO_WRITE) || 830 (ARGS(io)->flags & CTL_LLF_VERIFY)) { 831 ctl_set_success(&io->scsiio); 832 ctl_complete_beio(beio); 833 } else { | 751#ifdef CTL_TIME_IO 752 getbintime(&io->io_hdr.dma_start_bt); 753#endif 754 ctl_datamove(io); 755 } 756} 757 758static void --- 73 unchanged lines hidden (view full) --- 832 * If this is a write or a verify, we're all done. 833 * If this is a read, we can now send the data to the user. 834 */ 835 if ((beio->bio_cmd == BIO_WRITE) || 836 (ARGS(io)->flags & CTL_LLF_VERIFY)) { 837 ctl_set_success(&io->scsiio); 838 ctl_complete_beio(beio); 839 } else { |
840 if ((ARGS(io)->flags & CTL_LLF_READ) && 841 beio->beio_cont == NULL) 842 ctl_set_success(&io->scsiio); |
|
834#ifdef CTL_TIME_IO 835 getbintime(&io->io_hdr.dma_start_bt); 836#endif 837 ctl_datamove(io); 838 } 839} 840 841static void --- 1799 unchanged lines hidden --- | 843#ifdef CTL_TIME_IO 844 getbintime(&io->io_hdr.dma_start_bt); 845#endif 846 ctl_datamove(io); 847 } 848} 849 850static void --- 1799 unchanged lines hidden --- |