Skip to content

Commit

Permalink
Fix long_free_dirty accounting for small files
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 <[email protected]>
  • Loading branch information
davidchenntnx committed Jun 14, 2024
1 parent 20c8bdd commit 154a8b3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions module/zfs/dmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,9 @@ get_next_chunk(dnode_t *dn, uint64_t *start, uint64_t minimum, uint64_t *l1blks)
if (total_l1blks <= maxblks) {
*l1blks = total_l1blks;
*start = minimum;
/* Don't count when we don't have L1 blocks */
if (dn->dn_nlevels <= 1)
*l1blks = 0;
return (0);
}
ASSERT(ISP2(iblkrange));
Expand Down

0 comments on commit 154a8b3

Please sign in to comment.