• Andrew Morton's avatar
    [PATCH] i_size atomic access · eafe5916
    Andrew Morton authored
    From: Daniel McNeil <daniel@osdl.org>
    
    This adds i_seqcount to the inode structure and then uses i_size_read() and
    i_size_write() to provide atomic access to i_size.  This is a port of
    Andrea Arcangeli's i_size atomic access patch from 2.4.  This only uses the
    generic reader/writer consistent mechanism.
    
    Before:
    mnm:/usr/src/25> size vmlinux
       text    data     bss     dec     hex filename
    2229582 1027683  162436 3419701  342e35 vmlinux
    
    After:
    mnm:/usr/src/25> size vmlinux
       text    data     bss     dec     hex filename
    2225642 1027655  162436 3415733  341eb5 vmlinux
    
    3.9k more text, a lot of it fastpath :(
    
    It's a very minor bug, and the fix has a fairly non-minor cost.  The most
    compelling reason for fixing this is that writepage() checks i_size.  If it
    sees a transient value it may decide that page is outside i_size and will
    refuse to write it.  Lost user data.
    eafe5916
read_write.c 13.5 KB