]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Decouple arc_read_done callback from arc buf instantiation
authorMatthew Macy <mmacy@freebsd.org>
Wed, 9 Dec 2020 23:05:06 +0000 (15:05 -0800)
committerGitHub <noreply@github.com>
Wed, 9 Dec 2020 23:05:06 +0000 (15:05 -0800)
Add ARC_FLAG_NO_BUF to indicate that a buffer need not be
instantiated.  This fixes a ~20% performance regression on
cached reads due to zfetch changes.

Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
Closes #11220
Closes #11232

include/sys/arc.h
module/zfs/arc.c
module/zfs/dbuf.c

index a0852b4d5a70ab072c7f52fb0131c418455bd4d8..9ade1a4328c37cfbfd70b2fbe49e3bbd95832e6d 100644 (file)
@@ -154,6 +154,11 @@ typedef enum arc_flags
         */
        ARC_FLAG_CACHED_ONLY            = 1 << 22,
 
+       /*
+        * Don't instantiate an arc_buf_t for arc_read_done.
+        */
+       ARC_FLAG_NO_BUF                 = 1 << 23,
+
        /*
         * The arc buffer's compression mode is stored in the top 7 bits of the
         * flags field, so these dummy flags are included so that MDB can
index 42c09e2e585f9270e9754915a4f3dd88fe59c4fc..efc6bb138dc88e69c5837942b95fb8c2b6e247e3 100644 (file)
@@ -5924,6 +5924,7 @@ arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp,
        boolean_t noauth_read = BP_IS_AUTHENTICATED(bp) &&
            (zio_flags & ZIO_FLAG_RAW_ENCRYPT) != 0;
        boolean_t embedded_bp = !!BP_IS_EMBEDDED(bp);
+       boolean_t no_buf = *arc_flags & ARC_FLAG_NO_BUF;
        int rc = 0;
 
        ASSERT(!embedded_bp ||
@@ -5998,7 +5999,7 @@ top:
                        }
                        ASSERT(*arc_flags & ARC_FLAG_NOWAIT);
 
-                       if (done) {
+                       if (done && !no_buf) {
                                arc_callback_t *acb = NULL;
 
                                acb = kmem_zalloc(sizeof (arc_callback_t),
@@ -6027,7 +6028,7 @@ top:
                ASSERT(hdr->b_l1hdr.b_state == arc_mru ||
                    hdr->b_l1hdr.b_state == arc_mfu);
 
-               if (done) {
+               if (done && !no_buf) {
                        if (hdr->b_flags & ARC_FLAG_PREDICTIVE_PREFETCH) {
                                /*
                                 * This is a demand read which does not have to
index 82bb7206c1ac2e6b999d90dfdf72b8ccf74dfd27..0056910ff7d586af428705215fd901ccc3454a4c 100644 (file)
@@ -3040,7 +3040,8 @@ dbuf_issue_final_prefetch(dbuf_prefetch_arg_t *dpa, blkptr_t *bp)
 
        int zio_flags = ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE;
        arc_flags_t aflags =
-           dpa->dpa_aflags | ARC_FLAG_NOWAIT | ARC_FLAG_PREFETCH;
+           dpa->dpa_aflags | ARC_FLAG_NOWAIT | ARC_FLAG_PREFETCH |
+           ARC_FLAG_NO_BUF;
 
        /* dnodes are always read as raw and then converted later */
        if (BP_GET_TYPE(bp) == DMU_OT_DNODE && BP_IS_PROTECTED(bp) &&