metaslab
: don't pass whole zio to throttle reserve APIs; rename IO_ALLOCATING
to ALLOC_THROTTLED
#17508
+44
−39
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[Sponsors: Klara, Inc., Wasabi Technology, Inc.]
Motivation and Context
First, see my story in #17507. Part of the reason that it took me so long to understand what was happening was that
metaslab_class_throttle_reserve()
is adding theIO_ALLOCATING
flag to the zio directly. This isn’t a bug as such, and I knew it was happening, but because it wasn’t inzio.c
where I was spending most of my time, I didn’t notice it on the scene in quite the same way. Skimming the code looking for things to ask more questions of is a pretty standard part of my debugging approach, and it not being visible means I missed it.Initially, I thought to just lift the flag change out to the two call sites in
zio.c
. But, looking closer, it seems like there’s no particular reason for_reserve()
and_unreserve()
to take an entire zio as an argument. It only needs three items from it, of which one is already passed in directly, and haven’t them separate adds confusion inzio_dva_allocate_done()
where parts of both are passed to it. And if we don’t pass the zio in, there’s no temptation to just fiddle with it in place. The API only asks for exactly what it needs to do the job, and now it also looks a lot more like the rest of it - there’s already some functions that take class/allocator pairs, and none that take zios, so it looks less weird.The flag name
IO_ALLOCATING
is also confusing, since its applied when the allocation was throttled and a reservation is taken. It could be read as “an allocation is in progress”, or also something like theIO_IS_ALLOCATING()
macro, which is not directly related. So, I’ve renamed that as well toALLOC_THROTTLED
, which at least says closer to what it means.Description
Summarising above:
metaslab_class_throttle_reserve()
andmetaslab_class_throttle_unreserve()
to not take a zio, just passed what it needs.ZIO_FLAG_IO_ALLOCATING
toZIO_FLAG_ALLOC_THROTTLED
.How Has This Been Tested?
Compiled checked on both platforms, full test run completed on Linux.
I would not expect any differences really, since it’s little more than a rename.
Types of changes
Checklist:
Signed-off-by
.