On Fri, Oct 28, 2022 at 10:00:33AM +0530, Ritesh Harjani (IBM) wrote: > @@ -1354,7 +1399,8 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc, > * invalid, grab a new one. > */ > for (i = 0; i < nblocks && pos < end_pos; i++, pos += len) { > - if (iop && !test_bit(i, iop->state)) > + if (iop && (!test_bit(i, iop->state) || > + !test_bit(i + nblocks, iop->state))) > continue; > > error = wpc->ops->map_blocks(wpc, inode, pos); Why do we need to test both uptodate and dirty? Surely we only need to test the dirty bit? How can a !uptodate block ever be marked as dirty? More generally, I think open-coding this is going to lead to confusion. We need wrappers like 'iop_block_dirty()' and 'iop_block_uptodate()'. (iop is still a bad name for this, but nobody's stepped up with a better one yet).