Re: [PATCH 14/17] iomap: make buffered writes work with RWF_UNCACHED

Christoph Hellwig
2024-12-12T05:50:20Z

On Thu, Nov 14, 2024 at 08:25:18AM -0700, Jens Axboe wrote:
> + if (iocb->ki_flags & IOCB_UNCACHED)
> + iter.flags |= IOMAP_UNCACHED;
>
> - while ((ret = iomap_iter(&iter, ops)) > 0)
> + while ((ret = iomap_iter(&iter, ops)) > 0) {
> + if (iocb->ki_flags & IOCB_UNCACHED)
> + iter.iomap.flags |= IOMAP_F_UNCACHED;

iomap.flags and the IOMAP_F_* namespace is used to communicate flags
from the file system to the iomap core, so this looks wrong.

> size_t poff = offset_in_folio(folio, pos);
> int error;
>
> + if (folio_test_uncached(folio))
> + wpc->iomap.flags |= IOMAP_F_UNCACHED;

I guess this is what actually makes it work. Note that with the iomap
zoned series I posted yesteday things change a bit here in that the flags
in the wpc are decouple from the iomap flags, and this would now become
a wpc only flag as it isn't really a fs to iomap cummunication, but
based on iomap / page cache state.