summaryrefslogtreecommitdiffstats
path: root/sys/cddl/contrib
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2014-07-15 05:32:53 +0000
committerdelphij <delphij@FreeBSD.org>2014-07-15 05:32:53 +0000
commitf8b96a7c88fb1506692a5290c444d1494309d443 (patch)
treefc82a3689d7b8d0b32d5b6646c7926ab46940500 /sys/cddl/contrib
parentbfdd43f2b55bab822f028f6f948a2c3ea6d51401 (diff)
downloadFreeBSD-src-f8b96a7c88fb1506692a5290c444d1494309d443.zip
FreeBSD-src-f8b96a7c88fb1506692a5290c444d1494309d443.tar.gz
MFC r268085: MFV r267569:
4897 Space accounting mismatch in L2ARC/zpool
Diffstat (limited to 'sys/cddl/contrib')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
index 366ca71..adc7d00 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
@@ -22,7 +22,7 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2014 by Saso Kiselkov. All rights reserved.
- * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
/*
@@ -1748,6 +1748,8 @@ arc_hdr_destroy(arc_buf_hdr_t *hdr)
list_remove(l2hdr->b_dev->l2ad_buflist, hdr);
ARCSTAT_INCR(arcstat_l2_size, -hdr->b_size);
ARCSTAT_INCR(arcstat_l2_asize, -l2hdr->b_asize);
+ vdev_space_update(l2hdr->b_dev->l2ad_vdev,
+ -l2hdr->b_asize, 0, 0);
kmem_free(l2hdr, sizeof (l2arc_buf_hdr_t));
if (hdr->b_state == arc_l2c_only)
l2arc_hdr_stat_remove();
@@ -3701,6 +3703,8 @@ arc_release(arc_buf_t *buf, void *tag)
if (l2hdr) {
ARCSTAT_INCR(arcstat_l2_asize, -l2hdr->b_asize);
+ 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);
kmem_free(l2hdr, sizeof (l2arc_buf_hdr_t));
@@ -4602,6 +4606,7 @@ l2arc_write_done(zio_t *zio)
arc_buf_hdr_t *head, *ab, *ab_prev;
l2arc_buf_hdr_t *abl2;
kmutex_t *hash_lock;
+ int64_t bytes_dropped = 0;
cb = zio->io_private;
ASSERT(cb != NULL);
@@ -4649,6 +4654,7 @@ l2arc_write_done(zio_t *zio)
*/
list_remove(buflist, ab);
ARCSTAT_INCR(arcstat_l2_asize, -abl2->b_asize);
+ bytes_dropped += abl2->b_asize;
ab->b_l2hdr = NULL;
trim_map_free(abl2->b_dev->l2ad_vdev, abl2->b_daddr,
ab->b_size, 0);
@@ -4669,6 +4675,8 @@ l2arc_write_done(zio_t *zio)
kmem_cache_free(hdr_cache, head);
mutex_exit(&l2arc_buflist_mtx);
+ vdev_space_update(dev->l2ad_vdev, -bytes_dropped, 0, 0);
+
l2arc_do_free_on_write();
kmem_free(cb, sizeof (l2arc_write_callback_t));
@@ -4808,6 +4816,7 @@ l2arc_evict(l2arc_dev_t *dev, uint64_t distance, boolean_t all)
arc_buf_hdr_t *ab, *ab_prev;
kmutex_t *hash_lock;
uint64_t taddr;
+ int64_t bytes_evicted = 0;
buflist = dev->l2ad_buflist;
@@ -4906,6 +4915,7 @@ top:
if (ab->b_l2hdr != NULL) {
abl2 = ab->b_l2hdr;
ARCSTAT_INCR(arcstat_l2_asize, -abl2->b_asize);
+ bytes_evicted += abl2->b_asize;
ab->b_l2hdr = NULL;
kmem_free(abl2, sizeof (l2arc_buf_hdr_t));
ARCSTAT_INCR(arcstat_l2_size, -ab->b_size);
@@ -4922,7 +4932,7 @@ top:
}
mutex_exit(&l2arc_buflist_mtx);
- vdev_space_update(dev->l2ad_vdev, -(taddr - dev->l2ad_evict), 0, 0);
+ vdev_space_update(dev->l2ad_vdev, -bytes_evicted, 0, 0);
dev->l2ad_evict = taddr;
}
@@ -5175,15 +5185,13 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz,
ARCSTAT_INCR(arcstat_l2_write_bytes, write_asize);
ARCSTAT_INCR(arcstat_l2_size, write_sz);
ARCSTAT_INCR(arcstat_l2_asize, write_asize);
- vdev_space_update(dev->l2ad_vdev, write_psize, 0, 0);
+ vdev_space_update(dev->l2ad_vdev, write_asize, 0, 0);
/*
* Bump device hand to the device start if it is approaching the end.
* l2arc_evict() will already have evicted ahead for this case.
*/
if (dev->l2ad_hand >= (dev->l2ad_end - target_sz)) {
- vdev_space_update(dev->l2ad_vdev,
- dev->l2ad_end - dev->l2ad_hand, 0, 0);
dev->l2ad_hand = dev->l2ad_start;
dev->l2ad_evict = dev->l2ad_start;
dev->l2ad_first = B_FALSE;
OpenPOWER on IntegriCloud