From owner-svn-src-head@FreeBSD.ORG Mon Feb 3 17:21:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B73F677E; Mon, 3 Feb 2014 17:21:36 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A3B551DBB; Mon, 3 Feb 2014 17:21:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s13HLaIT078401; Mon, 3 Feb 2014 17:21:36 GMT (envelope-from loos@svn.freebsd.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s13HLaSM078400; Mon, 3 Feb 2014 17:21:36 GMT (envelope-from loos@svn.freebsd.org) Message-Id: <201402031721.s13HLaSM078400@svn.freebsd.org> From: Luiz Otavio O Souza Date: Mon, 3 Feb 2014 17:21:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r261439 - head/sys/geom/uncompress 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: Mon, 03 Feb 2014 17:21:36 -0000 Author: loos Date: Mon Feb 3 17:21:36 2014 New Revision: 261439 URL: http://svnweb.freebsd.org/changeset/base/261439 Log: Remove some unnecessary code. The offsets read from the first block are overwritten a few lines bellow. Reviewed by: ray Approved by: adrian (mentor) Modified: head/sys/geom/uncompress/g_uncompress.c Modified: head/sys/geom/uncompress/g_uncompress.c ============================================================================== --- head/sys/geom/uncompress/g_uncompress.c Mon Feb 3 16:54:53 2014 (r261438) +++ head/sys/geom/uncompress/g_uncompress.c Mon Feb 3 17:21:36 2014 (r261439) @@ -451,7 +451,7 @@ g_uncompress_taste(struct g_class *mp, s struct g_provider *pp2; struct g_consumer *cp; struct g_geom *gp; - uint32_t i, total_offsets, offsets_read, type; + uint32_t i, total_offsets, type; uint8_t *buf; int error; @@ -546,21 +546,15 @@ g_uncompress_taste(struct g_class *mp, s gp->name, sc->nblocks); goto err; } - sc->offsets = malloc( - total_offsets * sizeof(uint64_t), M_GEOM_UNCOMPRESS, M_WAITOK); - offsets_read = MIN(total_offsets, - (pp->sectorsize - sizeof(*header)) / sizeof(uint64_t)); - for (i = 0; i < offsets_read; i++) - sc->offsets[i] = be64toh(((uint64_t *) (header + 1))[i]); - DPRINTF(("%s: %u offsets in the first sector\n", - gp->name, offsets_read)); - free(buf, M_GEOM); + i = roundup((sizeof(struct cloop_header) + total_offsets * sizeof(uint64_t)),pp->sectorsize); buf = g_read_data(cp, 0, i, NULL); if (buf == NULL) goto err; + sc->offsets = malloc(total_offsets * sizeof(uint64_t), + M_GEOM_UNCOMPRESS, M_WAITOK); for (i = 0; i <= total_offsets; i++) { sc->offsets[i] = be64toh(((uint64_t *) (buf+sizeof(struct cloop_header)))[i]);