From owner-svn-src-head@FreeBSD.ORG Wed Jun 17 12:28:14 2015 Return-Path: Delivered-To: svn-src-head@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8F474600; Wed, 17 Jun 2015 12:28:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) 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 642666B0; Wed, 17 Jun 2015 12:28:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5HCSE0o062165; Wed, 17 Jun 2015 12:28:14 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5HCSEb8062164; Wed, 17 Jun 2015 12:28:14 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201506171228.t5HCSEb8062164@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 17 Jun 2015 12:28:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r284513 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.20 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: Wed, 17 Jun 2015 12:28:14 -0000 Author: avg Date: Wed Jun 17 12:28:13 2015 New Revision: 284513 URL: https://svnweb.freebsd.org/changeset/base/284513 Log: l2arc: pass correct size to trim requests b_size is a logical size of a buffer in memory, b_asize is its physical size that accounts for possible compression. Currently the latter is the best approximation for the allocated, on-disk size. L2ARC TRIM support was committed a few weeks before L2ARC compression was imported, so originally the code was correct, because b_size was the size. Further thoughts. Given that the cache device is being overwritten in a circular fashion it is not clear if a TRIM per each evicted L2ARC buffer has any benefits. Maybe it would be sufficient to issue a single trim request for the whole device when it is loaded, e.g. after a bootup, or when it is unloaded, e.g. before a shutdown. At least as long as L2ARC is not persistent across reboots. Discussed with: smh MFC after: 19 says Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jun 17 12:23:04 2015 (r284512) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jun 17 12:28:13 2015 (r284513) @@ -1826,7 +1826,7 @@ arc_hdr_destroy(arc_buf_hdr_t *hdr) if (l2hdr != NULL) { trim_map_free(l2hdr->b_dev->l2ad_vdev, l2hdr->b_daddr, - hdr->b_size, 0); + l2hdr->b_asize, 0); list_remove(l2hdr->b_dev->l2ad_buflist, hdr); arc_buf_l2_cdata_free(hdr); ARCSTAT_INCR(arcstat_l2_size, -hdr->b_size); @@ -3868,7 +3868,7 @@ arc_release(arc_buf_t *buf, void *tag) vdev_space_update(l2hdr->b_dev->l2ad_vdev, -l2hdr->b_asize, 0, 0); trim_map_free(l2hdr->b_dev->l2ad_vdev, l2hdr->b_daddr, - hdr->b_size, 0); + l2hdr->b_asize, 0); kmem_free(l2hdr, sizeof (l2arc_buf_hdr_t)); ARCSTAT_INCR(arcstat_l2_size, -buf_size); mutex_exit(&l2arc_buflist_mtx); @@ -4813,7 +4813,7 @@ l2arc_write_done(zio_t *zio) bytes_dropped += abl2->b_asize; hdr->b_l2hdr = NULL; trim_map_free(abl2->b_dev->l2ad_vdev, abl2->b_daddr, - hdr->b_size, 0); + abl2->b_asize, 0); kmem_free(abl2, sizeof (l2arc_buf_hdr_t)); ARCSTAT_INCR(arcstat_l2_size, -hdr->b_size); }