From 1e4732cbda8eb0c95901ed9f924b5a13bf24c76e Mon Sep 17 00:00:00 2001 From: Matthew Macy Date: Wed, 9 Dec 2020 15:05:06 -0800 Subject: Decouple arc_read_done callback from arc buf instantiation 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 Reviewed-by: Brian Behlendorf Reviewed-by: Matthew Ahrens Signed-off-by: Matt Macy Closes #11220 Closes #11232 --- module/zfs/arc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'module/zfs/arc.c') diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 42c09e2e5..efc6bb138 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -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 -- cgit v1.2.3