• Andrew Morton's avatar
    [PATCH] fadvise() make POSIX_FADV_NOREUSE a no-op · 60c371bc
    Andrew Morton authored
    The POSIX_FADV_NOREUSE hint means "the application will use this range of the
    file a single time".  It seems to be intended that the implementation will use
    this hint to perform drop-behind of that part of the file when the application
    gets around to reading or writing it.
    
    However for reasons which aren't obvious (or sane?) I mapped
    POSIX_FADV_NOREUSE onto POSIX_FADV_WILLNEED.  ie: it does readahead.
    
    That's daft.  So for now, make POSIX_FADV_NOREUSE a no-op.
    
    This is a non-back-compatible change.  If someone was using POSIX_FADV_NOREUSE
    to perform readahead, they lose.  The likelihood is low.
    
    If/when we later implement POSIX_FADV_NOREUSE things will get interesting - to
    do it fully we'll need to maintain file offset/length ranges and peform all
    sorts of complex tricks, and managing the lifetime of those ranges' data
    structures will be interesting..
    
    A sensible implementation would probably ignore the file range and would
    simply mark the entire file as needing some form of drop-behind treatment.
    
    Cc: Michael Kerrisk <mtk-manpages@gmx.net>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    60c371bc
fadvise.c 2.63 KB