diff options
author | mav <mav@FreeBSD.org> | 2014-06-16 11:00:14 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2014-06-16 11:00:14 +0000 |
commit | 6f0acfd6e3c7a24775fee30864375a98e945310c (patch) | |
tree | 11aecddaa9ac435be7f9b76893b498480b29b6bd /sys/cam/ctl/ctl_backend_ramdisk.c | |
parent | ac5689b4147a8dcf78382390fb0ea89b2578e547 (diff) | |
download | FreeBSD-src-6f0acfd6e3c7a24775fee30864375a98e945310c.zip FreeBSD-src-6f0acfd6e3c7a24775fee30864375a98e945310c.tar.gz |
Add support for VERIFY(10/12/16) and COMPARE AND WRITE SCSI commands.
Make data_submit backends method support not only read and write requests,
but also two new ones: verify and compare. Verify just checks readability
of the data in specified location without transferring them outside.
Compare reads the specified data and compares them to received data,
returning error if they are different.
VERIFY(10/12/16) commands request either verify or compare from backend,
depending on BYTCHK CDB field. COMPARE AND WRITE command executed in two
stages: first it requests compare, and then, if succeesed, requests write.
Atomicity of operation is guarantied by CTL request ordering code.
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.
Diffstat (limited to 'sys/cam/ctl/ctl_backend_ramdisk.c')
-rw-r--r-- | sys/cam/ctl/ctl_backend_ramdisk.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/cam/ctl/ctl_backend_ramdisk.c b/sys/cam/ctl/ctl_backend_ramdisk.c index ac03f3a..885e9a6 100644 --- a/sys/cam/ctl/ctl_backend_ramdisk.c +++ b/sys/cam/ctl/ctl_backend_ramdisk.c @@ -267,7 +267,7 @@ ctl_backend_ramdisk_move_done(union ctl_io *io) /*retry_count*/ io->io_hdr.port_status); } - ctl_done(io); + ctl_data_submit_done(io); return(0); } @@ -275,11 +275,16 @@ static int ctl_backend_ramdisk_submit(union ctl_io *io) { struct ctl_be_lun *ctl_be_lun; - struct ctl_lba_len *lbalen; + struct ctl_lba_len_flags *lbalen; ctl_be_lun = (struct ctl_be_lun *)io->io_hdr.ctl_private[ CTL_PRIV_BACKEND_LUN].ptr; - lbalen = (struct ctl_lba_len *)&io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; + lbalen = (struct ctl_lba_len_flags *)&io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; + if (lbalen->flags & CTL_LLF_VERIFY) { + ctl_set_success(&io->scsiio); + ctl_data_submit_done(io); + return (CTL_RETVAL_COMPLETE); + } io->io_hdr.ctl_private[CTL_PRIV_BACKEND].integer = lbalen->len * ctl_be_lun->blocksize; ctl_backend_ramdisk_continue(io); |