svn commit: r267514 - head/sys/cam/ctl

Alexander Motin mav at FreeBSD.org
Sun Jun 15 17:14:53 UTC 2014


Author: mav
Date: Sun Jun 15 17:14:52 2014
New Revision: 267514
URL: http://svnweb.freebsd.org/changeset/base/267514

Log:
  Move kern_total_len setting from backend to core code.

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_backend_block.c
  head/sys/cam/ctl/ctl_backend_ramdisk.c

Modified: head/sys/cam/ctl/ctl.c
==============================================================================
--- head/sys/cam/ctl/ctl.c	Sun Jun 15 16:54:26 2014	(r267513)
+++ head/sys/cam/ctl/ctl.c	Sun Jun 15 17:14:52 2014	(r267514)
@@ -8800,6 +8800,9 @@ ctl_read_write(struct ctl_scsiio *ctsio)
 	memcpy(ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes, &lbalen,
 	       sizeof(lbalen));
 
+	ctsio->kern_total_len = num_blocks * lun->be_lun->blocksize;
+	ctsio->kern_rel_offset = 0;
+
 	CTL_DEBUG_PRINT(("ctl_read_write: calling data_submit()\n"));
 
 	retval = lun->backend->data_submit((union ctl_io *)ctsio);

Modified: head/sys/cam/ctl/ctl_backend_block.c
==============================================================================
--- head/sys/cam/ctl/ctl_backend_block.c	Sun Jun 15 16:54:26 2014	(r267513)
+++ head/sys/cam/ctl/ctl_backend_block.c	Sun Jun 15 17:14:52 2014	(r267514)
@@ -1383,15 +1383,11 @@ ctl_be_block_worker(void *context, int p
 static int
 ctl_be_block_submit(union ctl_io *io)
 {
-	struct ctl_lba_len lbalen;
 	struct ctl_be_block_lun *be_lun;
 	struct ctl_be_lun *ctl_be_lun;
-	int retval;
 
 	DPRINTF("entered\n");
 
-	retval = CTL_RETVAL_COMPLETE;
-
 	ctl_be_lun = (struct ctl_be_lun *)io->io_hdr.ctl_private[
 		CTL_PRIV_BACKEND_LUN].ptr;
 	be_lun = (struct ctl_be_block_lun *)ctl_be_lun->be_lun;
@@ -1402,11 +1398,6 @@ ctl_be_block_submit(union ctl_io *io)
 	KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, ("Non-SCSI I/O (type "
 		"%#x) encountered", io->io_hdr.io_type));
 
-	memcpy(&lbalen, io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes,
-	       sizeof(lbalen));
-	io->scsiio.kern_total_len = lbalen.len * be_lun->blocksize;
-	io->scsiio.kern_rel_offset = 0;
-
 	mtx_lock(&be_lun->lock);
 	/*
 	 * XXX KDM make sure that links is okay to use at this point.
@@ -1415,10 +1406,9 @@ ctl_be_block_submit(union ctl_io *io)
 	 */
 	STAILQ_INSERT_TAIL(&be_lun->input_queue, &io->io_hdr, links);
 	mtx_unlock(&be_lun->lock);
-
 	taskqueue_enqueue(be_lun->io_taskqueue, &be_lun->io_task);
 
-	return (retval);
+	return (CTL_RETVAL_COMPLETE);
 }
 
 static int

Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c
==============================================================================
--- head/sys/cam/ctl/ctl_backend_ramdisk.c	Sun Jun 15 16:54:26 2014	(r267513)
+++ head/sys/cam/ctl/ctl_backend_ramdisk.c	Sun Jun 15 17:14:52 2014	(r267514)
@@ -274,20 +274,8 @@ ctl_backend_ramdisk_move_done(union ctl_
 static int
 ctl_backend_ramdisk_submit(union ctl_io *io)
 {
-	struct ctl_lba_len lbalen;
-	struct ctl_be_lun *ctl_be_lun;
 
-	ctl_be_lun = (struct ctl_be_lun *)io->io_hdr.ctl_private[
-		CTL_PRIV_BACKEND_LUN].ptr;
-
-	memcpy(&lbalen, io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN].bytes,
-	       sizeof(lbalen));
-	io->scsiio.be_move_done = ctl_backend_ramdisk_move_done;
-	io->scsiio.kern_total_len = lbalen.len * ctl_be_lun->blocksize;
-	io->scsiio.kern_rel_offset = 0;
-	io->scsiio.kern_data_resid = 0;
 	ctl_backend_ramdisk_continue(io);
-
 	return (CTL_RETVAL_COMPLETE);
 }
 
@@ -328,6 +316,8 @@ ctl_backend_ramdisk_continue(union ctl_i
 	io->scsiio.kern_data_ptr = softc->ramdisk_buffer;
 #endif /* CTL_RAMDISK_PAGES */
 
+	io->scsiio.be_move_done = ctl_backend_ramdisk_move_done;
+	io->scsiio.kern_data_resid = 0;
 	io->scsiio.kern_data_len = len_filled;
 	io->scsiio.kern_sg_entries = sg_filled;
 	io->io_hdr.flags |= CTL_FLAG_ALLOCATED;


More information about the svn-src-head mailing list