From owner-svn-src-all@FreeBSD.ORG Thu May 8 12:39:09 2014 Return-Path: Delivered-To: svn-src-all@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 24672F33; Thu, 8 May 2014 12:39: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 056C2A7F; Thu, 8 May 2014 12:39: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 s48Cd8q1095022; Thu, 8 May 2014 12:39:08 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s48Cd7Lk095010; Thu, 8 May 2014 12:39:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201405081239.s48Cd7Lk095010@svn.freebsd.org> From: Alexander Motin Date: Thu, 8 May 2014 12:39:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r265675 - stable/9/sys/geom/raid X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 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: Thu, 08 May 2014 12:39:09 -0000 Author: mav Date: Thu May 8 12:39:07 2014 New Revision: 265675 URL: http://svnweb.freebsd.org/changeset/base/265675 Log: MFC r265054: Reduce number of opens by REOM RAID during provider taste. Instead opening/closing provider by each of metadata classes, do it only once in core code. Since for SCSI disks open/close means sending some SCSI commands to the device, this change reduces taste time. Modified: stable/9/sys/geom/raid/g_raid.c stable/9/sys/geom/raid/md_ddf.c stable/9/sys/geom/raid/md_intel.c stable/9/sys/geom/raid/md_jmicron.c stable/9/sys/geom/raid/md_nvidia.c stable/9/sys/geom/raid/md_promise.c stable/9/sys/geom/raid/md_sii.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sys/geom/raid/g_raid.c ============================================================================== --- stable/9/sys/geom/raid/g_raid.c Thu May 8 12:35:37 2014 (r265674) +++ stable/9/sys/geom/raid/g_raid.c Thu May 8 12:39:07 2014 (r265675) @@ -2249,6 +2249,8 @@ g_raid_taste(struct g_class *mp, struct return (NULL); G_RAID_DEBUG(2, "Tasting provider %s.", pp->name); + geom = NULL; + status = G_RAID_MD_TASTE_FAIL; gp = g_new_geomf(mp, "raid:taste"); /* * This orphan function should be never called. @@ -2256,8 +2258,9 @@ g_raid_taste(struct g_class *mp, struct gp->orphan = g_raid_taste_orphan; cp = g_new_consumer(gp); g_attach(cp, pp); + if (g_access(cp, 1, 0, 0) != 0) + goto ofail; - geom = NULL; LIST_FOREACH(class, &g_raid_md_classes, mdc_list) { if (!class->mdc_enable) continue; @@ -2273,6 +2276,9 @@ g_raid_taste(struct g_class *mp, struct break; } + if (status == G_RAID_MD_TASTE_FAIL) + (void)g_access(cp, -1, 0, 0); +ofail: g_detach(cp); g_destroy_consumer(cp); g_destroy_geom(gp); Modified: stable/9/sys/geom/raid/md_ddf.c ============================================================================== --- stable/9/sys/geom/raid/md_ddf.c Thu May 8 12:35:37 2014 (r265674) +++ stable/9/sys/geom/raid/md_ddf.c Thu May 8 12:39:07 2014 (r265675) @@ -2120,13 +2120,10 @@ g_raid_md_taste_ddf(struct g_raid_md_obj pp = cp->provider; /* Read metadata from device. */ - if (g_access(cp, 1, 0, 0) != 0) - return (G_RAID_MD_TASTE_FAIL); g_topology_unlock(); bzero(&meta, sizeof(meta)); error = ddf_meta_read(cp, &meta); g_topology_lock(); - g_access(cp, -1, 0, 0); if (error != 0) return (G_RAID_MD_TASTE_FAIL); be = meta.bigendian; @@ -2164,6 +2161,9 @@ g_raid_md_taste_ddf(struct g_raid_md_obj geom = sc->sc_geom; } + /* There is no return after this point, so we close passed consumer. */ + g_access(cp, -1, 0, 0); + rcp = g_new_consumer(geom); g_attach(rcp, pp); if (g_access(rcp, 1, 1, 1) != 0) Modified: stable/9/sys/geom/raid/md_intel.c ============================================================================== --- stable/9/sys/geom/raid/md_intel.c Thu May 8 12:35:37 2014 (r265674) +++ stable/9/sys/geom/raid/md_intel.c Thu May 8 12:39:07 2014 (r265675) @@ -1382,8 +1382,6 @@ g_raid_md_taste_intel(struct g_raid_md_o meta = NULL; vendor = 0xffff; disk_pos = 0; - if (g_access(cp, 1, 0, 0) != 0) - return (G_RAID_MD_TASTE_FAIL); g_topology_unlock(); error = g_raid_md_get_label(cp, serial, sizeof(serial)); if (error != 0) { @@ -1396,7 +1394,6 @@ g_raid_md_taste_intel(struct g_raid_md_o g_io_getattr("GEOM::hba_vendor", cp, &len, &vendor); meta = intel_meta_read(cp); g_topology_lock(); - g_access(cp, -1, 0, 0); if (meta == NULL) { if (g_raid_aggressive_spare) { if (vendor != 0x8086) { @@ -1476,6 +1473,9 @@ search: G_RAID_DEBUG1(1, sc, "root_mount_hold %p", mdi->mdio_rootmount); } + /* There is no return after this point, so we close passed consumer. */ + g_access(cp, -1, 0, 0); + rcp = g_new_consumer(geom); g_attach(rcp, pp); if (g_access(rcp, 1, 1, 1) != 0) @@ -1511,7 +1511,6 @@ search: return (result); fail2: g_topology_lock(); - g_access(cp, -1, 0, 0); fail1: free(meta, M_MD_INTEL); return (G_RAID_MD_TASTE_FAIL); Modified: stable/9/sys/geom/raid/md_jmicron.c ============================================================================== --- stable/9/sys/geom/raid/md_jmicron.c Thu May 8 12:35:37 2014 (r265674) +++ stable/9/sys/geom/raid/md_jmicron.c Thu May 8 12:39:07 2014 (r265675) @@ -837,15 +837,12 @@ g_raid_md_taste_jmicron(struct g_raid_md /* Read metadata from device. */ meta = NULL; vendor = 0xffff; - if (g_access(cp, 1, 0, 0) != 0) - return (G_RAID_MD_TASTE_FAIL); g_topology_unlock(); len = 2; if (pp->geom->rank == 1) g_io_getattr("GEOM::hba_vendor", cp, &len, &vendor); meta = jmicron_meta_read(cp); g_topology_lock(); - g_access(cp, -1, 0, 0); if (meta == NULL) { if (g_raid_aggressive_spare) { if (vendor == 0x197b) { @@ -922,6 +919,9 @@ search: G_RAID_DEBUG1(1, sc, "root_mount_hold %p", mdi->mdio_rootmount); } + /* There is no return after this point, so we close passed consumer. */ + g_access(cp, -1, 0, 0); + rcp = g_new_consumer(geom); g_attach(rcp, pp); if (g_access(rcp, 1, 1, 1) != 0) Modified: stable/9/sys/geom/raid/md_nvidia.c ============================================================================== --- stable/9/sys/geom/raid/md_nvidia.c Thu May 8 12:35:37 2014 (r265674) +++ stable/9/sys/geom/raid/md_nvidia.c Thu May 8 12:39:07 2014 (r265675) @@ -841,15 +841,12 @@ g_raid_md_taste_nvidia(struct g_raid_md_ /* Read metadata from device. */ meta = NULL; vendor = 0xffff; - if (g_access(cp, 1, 0, 0) != 0) - return (G_RAID_MD_TASTE_FAIL); g_topology_unlock(); len = 2; if (pp->geom->rank == 1) g_io_getattr("GEOM::hba_vendor", cp, &len, &vendor); meta = nvidia_meta_read(cp); g_topology_lock(); - g_access(cp, -1, 0, 0); if (meta == NULL) { if (g_raid_aggressive_spare) { if (vendor == 0x10de) { @@ -918,6 +915,9 @@ search: G_RAID_DEBUG1(1, sc, "root_mount_hold %p", mdi->mdio_rootmount); } + /* There is no return after this point, so we close passed consumer. */ + g_access(cp, -1, 0, 0); + rcp = g_new_consumer(geom); g_attach(rcp, pp); if (g_access(rcp, 1, 1, 1) != 0) Modified: stable/9/sys/geom/raid/md_promise.c ============================================================================== --- stable/9/sys/geom/raid/md_promise.c Thu May 8 12:35:37 2014 (r265674) +++ stable/9/sys/geom/raid/md_promise.c Thu May 8 12:39:07 2014 (r265675) @@ -1106,15 +1106,12 @@ g_raid_md_taste_promise(struct g_raid_md /* Read metadata from device. */ meta = NULL; vendor = 0xffff; - if (g_access(cp, 1, 0, 0) != 0) - return (G_RAID_MD_TASTE_FAIL); g_topology_unlock(); len = 2; if (pp->geom->rank == 1) g_io_getattr("GEOM::hba_vendor", cp, &len, &vendor); subdisks = promise_meta_read(cp, metaarr); g_topology_lock(); - g_access(cp, -1, 0, 0); if (subdisks == 0) { if (g_raid_aggressive_spare) { if (vendor == 0x105a || vendor == 0x1002) { @@ -1175,6 +1172,9 @@ search: geom = sc->sc_geom; } + /* There is no return after this point, so we close passed consumer. */ + g_access(cp, -1, 0, 0); + rcp = g_new_consumer(geom); g_attach(rcp, pp); if (g_access(rcp, 1, 1, 1) != 0) Modified: stable/9/sys/geom/raid/md_sii.c ============================================================================== --- stable/9/sys/geom/raid/md_sii.c Thu May 8 12:35:37 2014 (r265674) +++ stable/9/sys/geom/raid/md_sii.c Thu May 8 12:39:07 2014 (r265675) @@ -923,15 +923,12 @@ g_raid_md_taste_sii(struct g_raid_md_obj /* Read metadata from device. */ meta = NULL; vendor = 0xffff; - if (g_access(cp, 1, 0, 0) != 0) - return (G_RAID_MD_TASTE_FAIL); g_topology_unlock(); len = 2; if (pp->geom->rank == 1) g_io_getattr("GEOM::hba_vendor", cp, &len, &vendor); meta = sii_meta_read(cp); g_topology_lock(); - g_access(cp, -1, 0, 0); if (meta == NULL) { if (g_raid_aggressive_spare) { if (vendor == 0x1095) { @@ -1011,6 +1008,9 @@ search: G_RAID_DEBUG1(1, sc, "root_mount_hold %p", mdi->mdio_rootmount); } + /* There is no return after this point, so we close passed consumer. */ + g_access(cp, -1, 0, 0); + rcp = g_new_consumer(geom); g_attach(rcp, pp); if (g_access(rcp, 1, 1, 1) != 0)