Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jun 2015 12:28:14 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
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
Message-ID:  <201506171228.t5HCSEb8062164@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506171228.t5HCSEb8062164>