From owner-svn-src-all@FreeBSD.ORG Tue Oct 25 07:44:10 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE6FD106566B; Tue, 25 Oct 2011 07:44:10 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE4618FC16; Tue, 25 Oct 2011 07:44:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9P7iAgW084772; Tue, 25 Oct 2011 07:44:10 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9P7iAN9084770; Tue, 25 Oct 2011 07:44:10 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201110250744.p9P7iAN9084770@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 25 Oct 2011 07:44:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226720 - head/sbin/geom/class/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Oct 2011 07:44:10 -0000 Author: pjd Date: Tue Oct 25 07:44:10 2011 New Revision: 226720 URL: http://svn.freebsd.org/changeset/base/226720 Log: Simplify eli_resize() function. MFC after: 3 days Modified: head/sbin/geom/class/eli/geom_eli.c Modified: head/sbin/geom/class/eli/geom_eli.c ============================================================================== --- head/sbin/geom/class/eli/geom_eli.c Tue Oct 25 07:37:02 2011 (r226719) +++ head/sbin/geom/class/eli/geom_eli.c Tue Oct 25 07:44:10 2011 (r226720) @@ -1480,18 +1480,12 @@ eli_resize(struct gctl_req *req) * it back to the correct place on the provider. */ md.md_provsize = mediasize; - eli_metadata_encode(&md, sector); - if (pwrite(provfd, sector, secsize, mediasize - secsize) != secsize) { - gctl_error(req, "Cannot write metadata: %s.", strerror(errno)); - goto out; - } - (void)g_flush(provfd); - + /* Write metadata to the provider. */ + (void)eli_metadata_store(req, prov, &md); /* Now trash the old metadata. */ - if (eli_trash_metadata(req, prov, provfd, oldsize - secsize) == -1) - goto out; + (void)eli_trash_metadata(req, prov, provfd, oldsize - secsize); out: - if (provfd >= 0) + if (provfd != -1) (void)g_close(provfd); if (sector != NULL) { bzero(sector, secsize);