On Tue, Jan 07, 2025 at 07:46:37AM +0100, Christoph Hellwig wrote: > On Mon, Jan 06, 2025 at 10:42:24PM -0800, Darrick J. Wong wrote: > > So I guess b_io_remaining was the count of in-flight bios? > > Yes. Plus a bias of 1 for the submitting context so that the > completion isn't run until all bios are submitted. > > > And making a > > chain of bios basically just moves all that to the bio layer, so all > > xfs_buf needs to know is whether or not a bio is in progress, right? > > Yes. > > > Eerrugh, I spent quite a while trying to wrap my head around the old > > code when I was writing the in-memory xfs_buf support. This is much > > less weird to look at... > > > > > + for (map = 0; map < bp->b_map_count - 1; map++) { > > > > ...but why isn't this "map < bp->b_map_count"? > > Because the final ("main") bio is submitted outside the loop as the > loop body chains the ones before to it. I guess this should go into > a comment to confuse the readers a little less. Ah, right, because we start with one bio for N maps, which means we need to split it N-1 times to end up with N (chained) bios, one for each map. Yes, comment please. :) --D