• Andrew Morton's avatar
    [PATCH] `event' removal: ext2 · 9aefc010
    Andrew Morton authored
    Patch from Manfred Spraul
    
    Use a local counter instead of the global 'event' variable for the
    readdir() optimization.
    
    Depends on patch-event-II
    
    Background:
      The only user of i_version and f_version in ext2 is
      ext2_readdir(). As an optimization, ext2 performs the
      validation of the start position for readdir() only if
            flip->f_version != inode->i_version.
      If there was no llseek and no directory change since the
      last readdir() call, then f_pos can be trusted.
      f_version is set to 0 in get_empty_flip and during llseek.
      Right now, i_version set to ++event during ext2_read_inode
      and commit_chunk, i.e. at inode creation and if a directory
      is changed.
      Initializing i_version to 1, and updating with i_version++
      achieves the same effect, without the need of a global variable.
      Global uniqueness is not required, there are no other uses
      of [if]_version in ext2.
    
    Change relative to the patch you have right now:
    i_version is initialized to 1 instead of 0. For ext2 it's doesn't
    matter [there is always a valid 'len' value at the beginning of a
    directory data block], but it's cleaner.
    9aefc010
inode.c 34.4 KB