From owner-svn-src-stable@freebsd.org Fri Apr 14 15:09:31 2017 Return-Path: Delivered-To: svn-src-stable@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 CC1A6D3DF2A; Fri, 14 Apr 2017 15:09:31 +0000 (UTC) (envelope-from avg@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 A78009A4; Fri, 14 Apr 2017 15:09:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3EF9UFs083942; Fri, 14 Apr 2017 15:09:30 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3EF9UcJ083939; Fri, 14 Apr 2017 15:09:30 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201704141509.v3EF9UcJ083939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 14 Apr 2017 15:09:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r316850 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Apr 2017 15:09:31 -0000 Author: avg Date: Fri Apr 14 15:09:30 2017 New Revision: 316850 URL: https://svnweb.freebsd.org/changeset/base/316850 Log: MFC r315852: zfs: add zio_buf_alloc_nowait and use it in vdev_queue_aggregate Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Fri Apr 14 15:09:23 2017 (r316849) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Fri Apr 14 15:09:30 2017 (r316850) @@ -566,6 +566,7 @@ extern zio_t *zio_unique_parent(zio_t *c extern void zio_add_child(zio_t *pio, zio_t *cio); extern void *zio_buf_alloc(size_t size); +extern void *zio_buf_alloc_nowait(size_t size); extern void zio_buf_free(void *buf, size_t size); extern void *zio_data_buf_alloc(size_t size); extern void zio_data_buf_free(void *buf, size_t size); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Fri Apr 14 15:09:23 2017 (r316849) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Fri Apr 14 15:09:30 2017 (r316850) @@ -659,6 +659,7 @@ static zio_t * vdev_queue_aggregate(vdev_queue_t *vq, zio_t *zio) { zio_t *first, *last, *aio, *dio, *mandatory, *nio; + void *abuf; uint64_t maxgap = 0; uint64_t size; boolean_t stretch; @@ -767,8 +768,12 @@ vdev_queue_aggregate(vdev_queue_t *vq, z size = IO_SPAN(first, last); ASSERT3U(size, <=, zfs_vdev_aggregation_limit); + abuf = zio_buf_alloc_nowait(size); + if (abuf == NULL) + return (NULL); + aio = zio_vdev_delegated_io(first->io_vd, first->io_offset, - zio_buf_alloc(size), size, first->io_type, zio->io_priority, + abuf, size, first->io_type, zio->io_priority, flags | ZIO_FLAG_DONT_CACHE | ZIO_FLAG_DONT_QUEUE, vdev_queue_agg_io_done, NULL); aio->io_timestamp = first->io_timestamp; Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Fri Apr 14 15:09:23 2017 (r316849) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Fri Apr 14 15:09:30 2017 (r316850) @@ -277,18 +277,33 @@ zio_fini(void) * useful to inspect ZFS metadata, but if possible, we should avoid keeping * excess / transient data in-core during a crashdump. */ -void * -zio_buf_alloc(size_t size) +static void * +zio_buf_alloc_impl(size_t size, boolean_t canwait) { size_t c = (size - 1) >> SPA_MINBLOCKSHIFT; int flags = zio_exclude_metadata ? KM_NODEBUG : 0; VERIFY3U(c, <, SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT); - if (zio_use_uma) - return (kmem_cache_alloc(zio_buf_cache[c], KM_PUSHPAGE)); - else - return (kmem_alloc(size, KM_SLEEP|flags)); + if (zio_use_uma) { + return (kmem_cache_alloc(zio_buf_cache[c], + canwait ? KM_PUSHPAGE : KM_NOSLEEP)); + } else { + return (kmem_alloc(size, + (canwait ? KM_SLEEP : KM_NOSLEEP) | flags)); + } +} + +void * +zio_buf_alloc(size_t size) +{ + return (zio_buf_alloc_impl(size, B_TRUE)); +} + +void * +zio_buf_alloc_nowait(size_t size) +{ + return (zio_buf_alloc_impl(size, B_FALSE)); } /*