Skip to content

Commit

Permalink
Fix long_free_dirty accounting for small files (#16264)
Browse files Browse the repository at this point in the history
For files smaller than recordsize, it's most likely that they don't have
L1 blocks. However, current calculation will always return at least 1 L1
block.

In this change, we check dnode level to figure out if it has L1 blocks
or not, and return 0 if it doesn't. This will reduce the chance of
unnecessary throttling when deleting a large number of small files.

Signed-off-by: Chunwei Chen <david.chen@nutanix.com>
Co-authored-by: Chunwei Chen <david.chen@nutanix.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
  • Loading branch information
tuxoko and davidchenntnx authored Jul 23, 2024
1 parent 37275fd commit 9dfc5c4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions module/zfs/dmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,13 @@ get_next_chunk(dnode_t *dn, uint64_t *start, uint64_t minimum, uint64_t *l1blks)

ASSERT3U(minimum, <=, *start);

/* dn_nlevels == 1 means we don't have any L1 blocks */
if (dn->dn_nlevels <= 1) {
*l1blks = 0;
*start = minimum;
return (0);
}

/*
* Check if we can free the entire range assuming that all of the
* L1 blocks in this range have data. If we can, we use this
Expand Down

0 comments on commit 9dfc5c4

Please sign in to comment.