From owner-svn-src-vendor@FreeBSD.ORG Fri Jul 5 20:37:10 2013 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BADA3C3D; Fri, 5 Jul 2013 20:37:10 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9CE0411CD; Fri, 5 Jul 2013 20:37:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r65KbA16070669; Fri, 5 Jul 2013 20:37:10 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r65KbANV070667; Fri, 5 Jul 2013 20:37:10 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201307052037.r65KbANV070667@svn.freebsd.org> From: Martin Matuska Date: Fri, 5 Jul 2013 20:37:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r252839 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Jul 2013 20:37:10 -0000 Author: mm Date: Fri Jul 5 20:37:09 2013 New Revision: 252839 URL: http://svnweb.freebsd.org/changeset/base/252839 Log: Update vendor-sys/illumos/dist to illumos-gate 14070:d4c9f8eba8fa Illumos ZFS issues: 3836 zio_free() can be processed immediately in the common case Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio_impl.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio_impl.h Fri Jul 5 20:24:50 2013 (r252838) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio_impl.h Fri Jul 5 20:37:09 2013 (r252839) @@ -24,7 +24,7 @@ */ /* - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. */ #ifndef _ZIO_IMPL_H @@ -38,7 +38,7 @@ extern "C" { #endif /* - * XXX -- Describe ZFS I/O pipleine here. Fill in as needed. + * XXX -- Describe ZFS I/O pipeline here. Fill in as needed. * * The ZFS I/O pipeline is comprised of various stages which are defined * in the zio_stage enum below. The individual stages are used to construct @@ -213,7 +213,6 @@ enum zio_stage { #define ZIO_FREE_PIPELINE \ (ZIO_INTERLOCK_STAGES | \ ZIO_STAGE_FREE_BP_INIT | \ - ZIO_STAGE_ISSUE_ASYNC | \ ZIO_STAGE_DVA_FREE) #define ZIO_DDT_FREE_PIPELINE \ Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c Fri Jul 5 20:24:50 2013 (r252838) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c Fri Jul 5 20:37:09 2013 (r252839) @@ -698,7 +698,20 @@ void zio_free(spa_t *spa, uint64_t txg, const blkptr_t *bp) { metaslab_check_free(spa, bp); - bplist_append(&spa->spa_free_bplist[txg & TXG_MASK], bp); + + /* + * Frees that are for the currently-syncing txg, are not going to be + * deferred, and which will not need to do a read (i.e. not GANG or + * DEDUP), can be processed immediately. Otherwise, put them on the + * in-memory list for later processing. + */ + if (BP_IS_GANG(bp) || BP_GET_DEDUP(bp) || + txg != spa->spa_syncing_txg || + spa_sync_pass(spa) >= zfs_sync_pass_deferred_free) { + bplist_append(&spa->spa_free_bplist[txg & TXG_MASK], bp); + } else { + VERIFY0(zio_wait(zio_free_sync(NULL, spa, txg, bp, 0))); + } } zio_t * @@ -706,6 +719,7 @@ zio_free_sync(zio_t *pio, spa_t *spa, ui enum zio_flag flags) { zio_t *zio; + enum zio_stage stage = ZIO_FREE_PIPELINE; dprintf_bp(bp, "freeing in txg %llu, pass %u", (longlong_t)txg, spa->spa_sync_pass); @@ -717,9 +731,18 @@ zio_free_sync(zio_t *pio, spa_t *spa, ui metaslab_check_free(spa, bp); arc_freed(spa, bp); + /* + * GANG and DEDUP blocks can induce a read (for the gang block header, + * or the DDT), so issue them asynchronously so that this thread is + * not tied up. + */ + if (BP_IS_GANG(bp) || BP_GET_DEDUP(bp)) + stage |= ZIO_STAGE_ISSUE_ASYNC; + zio = zio_create(pio, spa, txg, bp, NULL, BP_GET_PSIZE(bp), NULL, NULL, ZIO_TYPE_FREE, ZIO_PRIORITY_FREE, flags, - NULL, 0, NULL, ZIO_STAGE_OPEN, ZIO_FREE_PIPELINE); + NULL, 0, NULL, ZIO_STAGE_OPEN, stage); + return (zio); }