diff options
author | Matthew Macy <[email protected]> | 2020-12-09 15:05:06 -0800 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-09 15:05:06 -0800 |
commit | 1e4732cbda8eb0c95901ed9f924b5a13bf24c76e (patch) | |
tree | 0a480e1fce09aaa2fe99a60575757e7da8409fe5 | |
parent | edb20ff3bab31f9e07578a7bf8279d67b821f29a (diff) |
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 <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Matthew Ahrens <[email protected]>
Signed-off-by: Matt Macy <[email protected]>
Closes #11220
Closes #11232
-rw-r--r-- | include/sys/arc.h | 5 | ||||
-rw-r--r-- | module/zfs/arc.c | 5 | ||||
-rw-r--r-- | module/zfs/dbuf.c | 3 |
3 files changed, 10 insertions, 3 deletions
diff --git a/include/sys/arc.h b/include/sys/arc.h index a0852b4d5..9ade1a432 100644 --- a/include/sys/arc.h +++ b/include/sys/arc.h @@ -155,6 +155,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 * interpret the enum properly. 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 diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index 82bb7206c..0056910ff 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -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) && |