Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Apr 2014 10:44:09 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r264296 - head/sys/cam/ctl
Message-ID:  <201404091044.s39Ai9cY078285@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed Apr  9 10:44:09 2014
New Revision: 264296
URL: http://svnweb.freebsd.org/changeset/base/264296

Log:
  When splitting huge unmap requests, do it on sector boundary.

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

Modified: head/sys/cam/ctl/ctl_backend_block.c
==============================================================================
--- head/sys/cam/ctl/ctl_backend_block.c	Wed Apr  9 08:57:57 2014	(r264295)
+++ head/sys/cam/ctl/ctl_backend_block.c	Wed Apr  9 10:44:09 2014	(r264296)
@@ -766,19 +766,21 @@ ctl_be_block_unmap_dev_range(struct ctl_
 {
 	struct bio *bio;
 	struct ctl_be_block_devdata *dev_data;
+	uint64_t maxlen;
 
 	dev_data = &be_lun->backend.dev;
+	maxlen = LONG_MAX - (LONG_MAX % be_lun->blocksize);
 	while (len > 0) {
 		bio = g_alloc_bio();
 		bio->bio_cmd	    = BIO_DELETE;
 		bio->bio_flags	   |= beio->bio_flags;
 		bio->bio_dev	    = dev_data->cdev;
 		bio->bio_offset	    = off;
-		bio->bio_length	    = MIN(len, LONG_MAX);
+		bio->bio_length	    = MIN(len, maxlen);
 		bio->bio_data	    = 0;
 		bio->bio_done	    = ctl_be_block_biodone;
 		bio->bio_caller1    = beio;
-		bio->bio_pblkno     = beio->io_offset / be_lun->blocksize;
+		bio->bio_pblkno     = off / be_lun->blocksize;
 
 		off += bio->bio_length;
 		len -= bio->bio_length;



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