svn commit: r322239 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Andriy Gapon
avg at FreeBSD.org
Tue Aug 8 11:19:15 UTC 2017
Author: avg
Date: Tue Aug 8 11:19:14 2017
New Revision: 322239
URL: https://svnweb.freebsd.org/changeset/base/322239
Log:
MFV r322238: 7915 checks in l2arc_evict could use some cleaning up
illumos/illumos-gate at 267ae6c3a88d2fc39276af66caafa978b0935b82
https://github.com/illumos/illumos-gate/commit/267ae6c3a88d2fc39276af66caafa978b0935b82
https://www.illumos.org/issues/7915
l2arc_evict() is strictly serialized with respect to
l2arc_write_buffers() and l2arc_write_done(). Normally, l2arc_evict()
and l2arc_write_buffers() are called from the same thread, so they can
not be concurrent. Also, l2arc_write_buffers() uses zio_wait() on the
parent zio of all cache zio-s. That ensures that l2arc_write_done()
is completed before l2arc_write_buffers() returns. Finally, if a
cache device is removed, then l2arc_evict() is called under SCL_ALL in
the exclusive mode. That ensures that it can not be concurrent with
the normal L2ARC accesses to the device (including writing and
evicting buffers). Given the above, some checks and actions in
l2arc_evict() do not make sense. For instance, it must never
encounter the write head header let alone remove it from the buffer
list.
Reviewed by: Dan Kimmel <dan.kimmel at delphix.com>
Reviewed by: Prakash Surya <prakash.surya at delphix.com>
Approved by: Matthew Ahrens <mahrens at delphix.com>
Author: Andriy Gapon <avg at FreeBSD.org>
MFC after: 2 weeks
Modified:
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
Directory Properties:
head/sys/cddl/contrib/opensolaris/ (props changed)
Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Aug 8 11:15:36 2017 (r322238)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Aug 8 11:19:14 2017 (r322239)
@@ -7284,18 +7284,16 @@ top:
goto top;
}
- if (HDR_L2_WRITE_HEAD(hdr)) {
- /*
- * We hit a write head node. Leave it for
- * l2arc_write_done().
- */
- list_remove(buflist, hdr);
- mutex_exit(hash_lock);
- continue;
- }
+ /*
+ * A header can't be on this list if it doesn't have L2 header.
+ */
+ ASSERT(HDR_HAS_L2HDR(hdr));
- if (!all && HDR_HAS_L2HDR(hdr) &&
- (hdr->b_l2hdr.b_daddr >= taddr ||
+ /* Ensure this header has finished being written. */
+ ASSERT(!HDR_L2_WRITING(hdr));
+ ASSERT(!HDR_L2_WRITE_HEAD(hdr));
+
+ if (!all && (hdr->b_l2hdr.b_daddr >= taddr ||
hdr->b_l2hdr.b_daddr < dev->l2ad_hand)) {
/*
* We've evicted to the target address,
@@ -7305,7 +7303,6 @@ top:
break;
}
- ASSERT(HDR_HAS_L2HDR(hdr));
if (!HDR_HAS_L1HDR(hdr)) {
ASSERT(!HDR_L2_READING(hdr));
/*
@@ -7327,9 +7324,6 @@ top:
ARCSTAT_BUMP(arcstat_l2_evict_reading);
arc_hdr_set_flags(hdr, ARC_FLAG_L2_EVICTED);
}
-
- /* Ensure this header has finished being written */
- ASSERT(!HDR_L2_WRITING(hdr));
arc_hdr_l2hdr_destroy(hdr);
}
More information about the svn-src-all
mailing list