• Andrew Morton's avatar
    [PATCH] sync dirty pages in fadvise(FADV_DONTNEED) · 3bc17e74
    Andrew Morton authored
    This changes the fadvise(FADV_DONTNEED) operation to start async writeout of
    any dirty pages in the file.
    
    The thinking is that if the application doesn't want to use those pages in
    the future, we may as well get IO underway against them so they can be freed
    up on the next call to fadvise().
    
    The POSIX spec does not go into any detail as to whether this is the right or
    wrong behaviour.
    
    This provides a nice way for applications whihc are writing streaming data
    (the main users of fadvise) to keep the amount of dirty pagecache under
    control without having to resort to system-wide VM tuning.
    
    It also provides an "async fsync()".  If the application passes in a length
    of zero, fadvise will start async writeout of the pages, but will not
    invalidate any of the file's pagecache.
    3bc17e74
fadvise.c 1.58 KB