From owner-svn-src-head@freebsd.org Fri Dec 4 03:38:37 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D704A40135; Fri, 4 Dec 2015 03:38:37 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 D27A715CC; Fri, 4 Dec 2015 03:38:36 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB43cZ2S053264; Fri, 4 Dec 2015 03:38:35 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB43cZY1053263; Fri, 4 Dec 2015 03:38:35 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201512040338.tB43cZY1053263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Fri, 4 Dec 2015 03:38:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r291741 - head/sys/geom 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.20 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: Fri, 04 Dec 2015 03:38:37 -0000 Author: ken Date: Fri Dec 4 03:38:35 2015 New Revision: 291741 URL: https://svnweb.freebsd.org/changeset/base/291741 Log: Fix g_disk_vlist_limit() to work properly with deletes. Add a new bp argument to g_disk_maxsegs(), and add a new function, g_disk_maxsize() tha will properly determine the maximum I/O size for a delete or non-delete bio. Submitted by: will MFC after: 1 week Sponsored by: Spectra Logic Modified: head/sys/geom/geom_disk.c Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Fri Dec 4 03:18:02 2015 (r291740) +++ head/sys/geom/geom_disk.c Fri Dec 4 03:38:35 2015 (r291741) @@ -253,10 +253,18 @@ g_disk_ioctl(struct g_provider *pp, u_lo return (error); } +static off_t +g_disk_maxsize(struct disk *dp, struct bio *bp) +{ + if (bp->bio_cmd == BIO_DELETE) + return (dp->d_delmaxsize); + return (dp->d_maxsize); +} + static int -g_disk_maxsegs(struct disk *dp) +g_disk_maxsegs(struct disk *dp, struct bio *bp) { - return ((dp->d_maxsize / PAGE_SIZE) + 1); + return ((g_disk_maxsize(dp, bp) / PAGE_SIZE) + 1); } static void @@ -334,7 +342,7 @@ g_disk_vlist_limit(struct disk *dp, stru end = (bus_dma_segment_t *)bp->bio_data + bp->bio_ma_n; residual = bp->bio_length; offset = bp->bio_ma_offset; - pages = g_disk_maxsegs(dp); + pages = g_disk_maxsegs(dp, bp); while (residual != 0 && pages != 0) { KASSERT((seg != end), ("vlist limit runs off the end")); @@ -350,10 +358,7 @@ static bool g_disk_limit(struct disk *dp, struct bio *bp) { bool limited = false; - off_t d_maxsize; - - d_maxsize = (bp->bio_cmd == BIO_DELETE) ? - dp->d_delmaxsize : dp->d_maxsize; + off_t maxsz = g_disk_maxsize(dp, bp); /* * XXX: If we have a stripesize we should really use it here. @@ -361,8 +366,8 @@ g_disk_limit(struct disk *dp, struct bio * as deletes can be very sensitive to size given how they * are processed. */ - if (bp->bio_length > d_maxsize) { - bp->bio_length = d_maxsize; + if (bp->bio_length > maxsz) { + bp->bio_length = maxsz; limited = true; }