1. 05 Nov, 2002 2 commits
    • 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
    • Andrew Morton's avatar
      [PATCH] `event' removal: core kernel · 4ccf7a32
      Andrew Morton authored
      Patch from Manfred Spraul
      
      f_version and i_version are used by filesystems to check if it can
      reuse the f_pos position across readdir calls without validation.
      
      Right now f_version and i_version are modified by
          f_version = ++event;
          i_version = ++event;
          if (f_version != i_version) goto revalidate
      and event is a global, exported variable.
      
      But that's not needed,
          f_version  = 0;
          i_version++;
          if (f_version != i_version) goto revalidate
      works too, without the ugly 'event' variable.
      
      I got an ok from viro, and I had notified the fs maintainers, no
      complaints either
      
      - block_dev.c, block_llseek updates f_version to '++event'.
         grep showed that no device driver uses f_version, this is dead
         code copied from the default llseek implementation.
      
      - the llseek implementations and get_empty_flip set f_version
         to '++event'
         This is not dead code, but
                  filp->f_version = 0
         achieves the same effect:
         f_version is used by the readdir() implementation of several
         filesystems to skip the revalidation of f_pos at the beginning
         of a readdir call: If llseek was not called and the filesystem
         did not change since the last readdir call, then the value in
         f_pos can be trusted.
         The implementation (for example in ext2) is
           inode->i_version = ++event;
         in all operations that change a directory
         At the beginning of file_operation->readdir():
           if(inode->i_version != flip->f_version)
                      revalidate();
           filp->f_version = inode->i_version;
         There are other users of f_version, but none of them use the
         default llseek implementation (e.g. fs/pipe.c)
      4ccf7a32
  2. 04 Nov, 2002 7 commits
  3. 03 Nov, 2002 31 commits