From owner-svn-src-head@FreeBSD.ORG Wed Apr 9 10:44:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CF442A26; Wed, 9 Apr 2014 10:44:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BCABE13E3; Wed, 9 Apr 2014 10:44:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s39Ai922078286; Wed, 9 Apr 2014 10:44:09 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s39Ai9cY078285; Wed, 9 Apr 2014 10:44:09 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201404091044.s39Ai9cY078285@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Apr 2014 10:44:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r264296 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Apr 2014 10:44:09 -0000 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;