From owner-svn-src-head@freebsd.org Fri Oct 6 16:38:02 2017 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 0CC61E3B3D7; Fri, 6 Oct 2017 16:38:02 +0000 (UTC) (envelope-from marcel@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 CB474655FF; Fri, 6 Oct 2017 16:38:01 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v96Gc0e8053543; Fri, 6 Oct 2017 16:38:00 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v96Gc0OT053542; Fri, 6 Oct 2017 16:38:00 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201710061638.v96Gc0OT053542@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Fri, 6 Oct 2017 16:38:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324369 - head/sbin/geom/class/part X-SVN-Group: head X-SVN-Commit-Author: marcel X-SVN-Commit-Paths: head/sbin/geom/class/part X-SVN-Commit-Revision: 324369 X-SVN-Commit-Repository: base 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.23 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, 06 Oct 2017 16:38:02 -0000 Author: marcel Date: Fri Oct 6 16:38:00 2017 New Revision: 324369 URL: https://svnweb.freebsd.org/changeset/base/324369 Log: Fix alignment of 'last' in autofill. 'last' is the sector number of the last usable sector. Sector numbers start with 0. As such, 'last' is always 1 less than the count of sectors and aligning 'last' down as-is means that the number of free sectors is pessimized by 'alignment - 1' if the number of usable sectors was already a multiple of the alignment. Consequently, gpart(8) failed to create a partition when the alignment and size were such that it would extend to the end of the disk. Modified: head/sbin/geom/class/part/geom_part.c Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Fri Oct 6 15:46:11 2017 (r324368) +++ head/sbin/geom/class/part/geom_part.c Fri Oct 6 16:38:00 2017 (r324369) @@ -547,7 +547,7 @@ gpart_autofill(struct gctl_req *req) last = (off_t)strtoimax(s, NULL, 0); grade = ~0ULL; a_first = ALIGNUP(first + offset, alignment); - last = ALIGNDOWN(last + offset, alignment); + last = ALIGNDOWN(last + offset + 1, alignment) - 1; if (a_first < start) a_first = start; while ((pp = find_provider(gp, first)) != NULL) {