Skip to content

Improve L2 caching control for prefetched indirects #17204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions module/zfs/dbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -3560,12 +3560,9 @@ dbuf_issue_final_prefetch_done(zio_t *zio, const zbookmark_phys_t *zb,
static void
dbuf_issue_final_prefetch(dbuf_prefetch_arg_t *dpa, blkptr_t *bp)
{
ASSERT(!BP_IS_REDACTED(bp) ||
dsl_dataset_feature_is_active(
dpa->dpa_dnode->dn_objset->os_dsl_dataset,
SPA_FEATURE_REDACTED_DATASETS));

if (BP_IS_HOLE(bp) || BP_IS_EMBEDDED(bp) || BP_IS_REDACTED(bp))
ASSERT(!BP_IS_HOLE(bp));
ASSERT(!BP_IS_REDACTED(bp));
if (BP_IS_EMBEDDED(bp))
return (dbuf_prefetch_fini(dpa, B_FALSE));

int zio_flags = ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE;
Expand Down Expand Up @@ -3651,10 +3648,10 @@ dbuf_prefetch_indirect_done(zio_t *zio, const zbookmark_phys_t *zb,
blkptr_t *bp = ((blkptr_t *)abuf->b_data) +
P2PHASE(nextblkid, 1ULL << dpa->dpa_epbs);

ASSERT(!BP_IS_REDACTED(bp) || (dpa->dpa_dnode &&
ASSERT(!BP_IS_REDACTED(bp) || dpa->dpa_dnode == NULL ||
dsl_dataset_feature_is_active(
dpa->dpa_dnode->dn_objset->os_dsl_dataset,
SPA_FEATURE_REDACTED_DATASETS)));
SPA_FEATURE_REDACTED_DATASETS));
if (BP_IS_HOLE(bp) || BP_IS_REDACTED(bp)) {
arc_buf_destroy(abuf, private);
dbuf_prefetch_fini(dpa, B_TRUE);
Expand All @@ -3667,8 +3664,14 @@ dbuf_prefetch_indirect_done(zio_t *zio, const zbookmark_phys_t *zb,
zbookmark_phys_t zb;

/* flag if L2ARC eligible, l2arc_noprefetch then decides */
if (dpa->dpa_aflags & ARC_FLAG_L2CACHE)
iter_aflags |= ARC_FLAG_L2CACHE;
if (dpa->dpa_dnode) {
if (dnode_level_is_l2cacheable(bp, dpa->dpa_dnode,
dpa->dpa_curlevel))
iter_aflags |= ARC_FLAG_L2CACHE;
} else {
if (dpa->dpa_aflags & ARC_FLAG_L2CACHE)
iter_aflags |= ARC_FLAG_L2CACHE;
}

ASSERT3U(dpa->dpa_curlevel, ==, BP_GET_LEVEL(bp));

Expand Down Expand Up @@ -3807,7 +3810,7 @@ dbuf_prefetch_impl(dnode_t *dn, int64_t level, uint64_t blkid,
zbookmark_phys_t zb;

/* flag if L2ARC eligible, l2arc_noprefetch then decides */
if (dnode_level_is_l2cacheable(&bp, dn, level))
if (dnode_level_is_l2cacheable(&bp, dn, curlevel))
iter_aflags |= ARC_FLAG_L2CACHE;

SET_BOOKMARK(&zb, ds != NULL ? ds->ds_object : DMU_META_OBJSET,
Expand Down
Loading