Skip to content

Commit dd3bda3

Browse files
authored
Add comment on metaslab_class_throttle_reserve() locking
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Issue #12314 Closes #12419
1 parent bdd2bfd commit dd3bda3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

module/zfs/metaslab.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5617,6 +5617,13 @@ metaslab_class_throttle_reserve(metaslab_class_t *mc, int slots, int allocator,
56175617
if (GANG_ALLOCATION(flags) || (flags & METASLAB_MUST_RESERVE) ||
56185618
zfs_refcount_count(&mca->mca_alloc_slots) + slots <= max) {
56195619
/*
5620+
* The potential race between _count() and _add() is covered
5621+
* by the allocator lock in most cases, or irrelevant due to
5622+
* GANG_ALLOCATION() or METASLAB_MUST_RESERVE set in others.
5623+
* But even if we assume some other non-existing scenario, the
5624+
* worst that can happen is few more I/Os get to allocation
5625+
* earlier, that is not a problem.
5626+
*
56205627
* We reserve the slots individually so that we can unreserve
56215628
* them individually when an I/O completes.
56225629
*/

0 commit comments

Comments
 (0)