Re: [PATCH] fadvise: only initiate writeback for specified range with FADV_DONTNEED

Johannes Weiner
2011-11-01T15:06:23Z

On Mon, Oct 31, 2011 at 11:16:59AM -0500, Shawn Bohrer wrote:
> Previously POSIX_FADV_DONTNEED would start writeback for the entire file
> when the bdi was not write congested. This negatively impacts
> performance if the file contians dirty pages outside of the requested
> range. This change uses __filemap_fdatawrite_range() to only initiate
> writeback for the requested range.
>
> Signed-off-by: Shawn Bohrer <sbohrer@rgmadvisors.com>

It probably makes sense for some cases to take advantage of the disk
head being nearby and flush more than requested.

But I can certainly see this go wrong by taking away the write-caching
benefits for the rest of the file just because a small part of it was
fadvised.

Acked-by: Johannes Weiner <jweiner@redhat.com>