mm: provide filemap_range_needs_writeback() helper
authorJens Axboe <axboe@kernel.dk>
Mon, 8 Feb 2021 19:59:16 +0000 (12:59 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 24 Feb 2021 16:38:32 +0000 (09:38 -0700)
commite01cea6a4c80d929ddba8086e0a66f822ae10923
tree4b036f3115a985b8a5f0b905ce5e2c926fafd060
parent899cbb0e53c6b66c3fb98d8745aa4b0b41cd94f2
mm: provide filemap_range_needs_writeback() helper

For O_DIRECT reads/writes, we check if we need to issue a call to
filemap_write_and_wait_range() to issue and/or wait for writeback for any
page in the given range. The existing mechanism just checks for a page in
the range, which is suboptimal for IOCB_NOWAIT as we'll fallback to the
slow path (and needing retry) if there's just a clean page cache page in
the range.

Provide filemap_range_needs_writeback() which tries a little harder to
check if we actually need to issue and/or wait for writeback in the
range.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/fs.h
mm/filemap.c