Skip to content
  • Jeff Layton's avatar
    mm: remove optimizations based on i_size in mapping writeback waits · ffb959bb
    Jeff Layton authored
    
    
    Marcelo added this i_size based optimization with a patch in 2004
    (commitid is from the linux-history tree):
    
        commit 765dad09b4ac101a32d87af2bb793c3060497d3c
        Author: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
        Date:   Tue Sep 7 17:51:17 2004 -0700
    
    	small wait_on_page_writeback_range() optimization
    
    	filemap_fdatawait() calls wait_on_page_writeback_range() with -1
    	as "end" parameter.  This is not needed since we know the EOF
    	from the inode.  Use that instead.
    
    There may be races here, particularly with clustered or network
    filesystems. It also seems like a bit of a layering violation since
    we're operating on an address_space here, not an inode.
    
    Finally, it's also questionable whether this optimization really helps
    on workloads that we care about. Should we be optimizing for writeback
    vs. truncate races in a codepath where we expect to wait anyway? It
    doesn't seem worth the risk.
    
    Remove this optimization from the filemap_fdatawait codepaths. This
    means that filemap_fdatawait becomes a trivial wrapper around
    filemap_fdatawait_range.
    
    Reviewed-by: default avatarJan Kara <jack@suse.cz>
    Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
    ffb959bb