Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Jul 2014 10:41:11 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r268148 - stable/10/sys/cam/ctl
Message-ID:  <201407021041.s62AfBED087663@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed Jul  2 10:41:11 2014
New Revision: 268148
URL: http://svnweb.freebsd.org/changeset/base/268148

Log:
  MFC r267514:
  Move kern_total_len setting from backend to core code.

Modified:
  stable/10/sys/cam/ctl/ctl.c
  stable/10/sys/cam/ctl/ctl_backend_block.c
  stable/10/sys/cam/ctl/ctl_backend_ramdisk.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl.c	Wed Jul  2 10:39:45 2014	(r268147)
+++ stable/10/sys/cam/ctl/ctl.c	Wed Jul  2 10:41:11 2014	(r268148)
@@ -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: stable/10/sys/cam/ctl/ctl_backend_block.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl_backend_block.c	Wed Jul  2 10:39:45 2014	(r268147)
+++ stable/10/sys/cam/ctl/ctl_backend_block.c	Wed Jul  2 10:41:11 2014	(r268148)
@@ -1385,15 +1385,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;
@@ -1404,11 +1400,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.
@@ -1417,10 +1408,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: stable/10/sys/cam/ctl/ctl_backend_ramdisk.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl_backend_ramdisk.c	Wed Jul  2 10:39:45 2014	(r268147)
+++ stable/10/sys/cam/ctl/ctl_backend_ramdisk.c	Wed Jul  2 10:41:11 2014	(r268148)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407021041.s62AfBED087663>