]> granicus.if.org Git - zfs/commitdiff
OpenZFS 7915 - checks in l2arc_evict could use some cleaning up
authorAndriy Gapon <avg@FreeBSD.org>
Tue, 28 Feb 2017 21:32:55 +0000 (23:32 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 28 Jul 2017 21:09:49 +0000 (14:09 -0700)
Authored by: Andriy Gapon <avg@FreeBSD.org>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Ported-by: Giuseppe Di Natale <dinatale2@llnl.gov>
OpenZFS-issue: https://www.illumos.org/issues/7915
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/836a00c
Closes #6375

module/zfs/arc.c

index a26e1156c4defd7c5e4bfafd6acbeed6bea41f02..9f1dccaf47e300615f68dabb939999f7e740a446 100644 (file)
@@ -7242,18 +7242,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,
@@ -7263,7 +7261,6 @@ top:
                        break;
                }
 
-               ASSERT(HDR_HAS_L2HDR(hdr));
                if (!HDR_HAS_L1HDR(hdr)) {
                        ASSERT(!HDR_L2_READING(hdr));
                        /*
@@ -7286,9 +7283,6 @@ top:
                                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);
                }
                mutex_exit(hash_lock);