On Mon, Oct 26, 2020 at 04:32:24PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > > Recently, I was able to create a realtime file with a 16b extent size > and the following data fork mapping: > > data offset 0 startblock 144 (0/144) count 3 flag 0 > data offset 3 startblock 147 (0/147) count 3 flag 1 > data offset 6 startblock 150 (0/150) count 10 flag 0 > > Notice how we have a written extent, then an unwritten extent, and then > another written extent. The current code in process_rt_rec trips over > that third extent, because repair only knows not to complain about inuse > extents if the mapping was unwritten. > > This loop logic is confusing, because it tries to do too many things. > Move the phase3 and phase4 code to separate helper functions, then > isolate the code that handles a mapping that starts in the middle of an > rt extent so that it's clearer what's going on. > > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> Looks good, Reviewed-by: Christoph Hellwig <hch@xxxxxx>