1. 20 11月, 2014 2 次提交
  2. 01 10月, 2014 1 次提交
    • B
      GFS2: Make rename not save dirent location · 19aeb5a6
      Bob Peterson 提交于
      This patch fixes a regression in the patch "GFS2: Remember directory
      insert point", commit 2b47dad8.
      The problem had to do with the rename function: The function found
      space for the new dirent, and remembered that location. But then the
      old dirent was removed, which often moved the eligible location for
      the renamed dirent. Putting the new dirent at the saved location
      caused file system corruption.
      
      This patch adds a new "save_loc" variable to struct gfs2_diradd.
      If 1, the dirent location is saved. If 0, the dirent location is not
      saved and the buffer_head is released as per previous behavior.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      19aeb5a6
  3. 07 3月, 2014 2 次提交
  4. 07 2月, 2014 1 次提交
    • S
      GFS2: Add meta readahead field in directory entries · 44aaada9
      Steven Whitehouse 提交于
      The intent of this new field in the directory entry is to
      allow a subsequent lookup to know how many blocks, which
      are contiguous with the inode, contain metadata which relates
      to the inode. This will then allow the issuing of a single
      read to read these blocks, rather than reading the inode
      first, and then issuing a second read for the metadata.
      
      This only works under some fairly strict conditions, since
      we do not have back pointers from inodes to directory entries
      we must ensure that the blocks referenced in this way will
      always belong to the inode.
      
      This rules out being able to use this system for indirect
      blocks, as these can change as a result of truncate/rewrite.
      
      So the idea here is to restrict this to xattr blocks only
      for the time being. For most inodes, that means only a
      single block. Also, when using ACLs and/or SELinux or
      other LSMs, these will be added at inode creation time
      so that they will be contiguous with the inode on disk and
      also will almost always be needed when we read the inode in
      for permissions checks.
      
      Once an xattr block for an inode is allocated, it will never
      change until the inode is deallocated.
      
      This patch adds the new field, a further patch will add the
      readahead in due course.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      44aaada9
  5. 08 1月, 2014 2 次提交
    • S
      GFS2: Add hints to directory leaf blocks · 01bcb0de
      Steven Whitehouse 提交于
      This patch adds four new fields to directory leaf blocks.
      The intent is not to use them in the kernel itself, although
      perhaps we may be able to use them as hints at some later date,
      but instead to provide more information for debug/fsck use.
      
      One new field adds a pointer to the inode to which the leaf
      belongs. This can be useful if the pointer to the leaf block
      has become corrupt, as it will allow us to know which inode
      this block should be associated with. This field is set when
      the leaf is created and never changed over its lifetime.
      
      The second field is a "distance from the hash table" field.
      The meaning is as follows:
       0  = An old leaf in which this value has not been set
       1  = This leaf is pointed to directly from the hash table
       2+ = This leaf is part of a chain, pointed to by another leaf
            block, the value gives the position in the chain.
      
      The third and fourth fields combine to give a time stamp of
      the most recent directory insertion or deletion from this
      leaf block. The time stamp is not updated when a new leaf
      block is chained from the current one. The code is currently
      written such that the timestamp on the dir inode will match
      that of the leaf block for the most recent insertion/deletion.
      
      For backwards compatibility, any of these new fields which is
      zero should be considered to be "unknown".
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      01bcb0de
    • S
      GFS2: For exhash conversion, only one block is needed · 22b5a6c0
      Steven Whitehouse 提交于
      For most cases, only a single new block is needed when we reach
      the point of converting from stuffed to exhash directory. The
      exception being when the file name is so long that it will not
      fit within the new leaf block.
      
      So this patch adds a simple test for that situation so that we
      do not need to request the full reservation size in this case.
      
      Potentially we could calculate more accurately the value to use
      in other cases too, but that is much more complicated to do and
      it is doubtful that the benefit would outweigh the extra cost
      in code complexity.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      22b5a6c0
  6. 06 1月, 2014 2 次提交
    • S
      GFS2: Remember directory insert point · 2b47dad8
      Steven Whitehouse 提交于
      When we look to see if there is enough space to add a dir
      entry without allocation, we have then been repeating the
      same search later when we do the actual insertion. This
      patch caches the details of the location in the gfs2_diradd
      structure, so that we do not have to repeat the search.
      
      This will provide a performance improvement which will be
      greater as the size of the directory increases.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      2b47dad8
    • S
      GFS2: Add directory addition info structure · 3c1c0ae1
      Steven Whitehouse 提交于
      The intent is that this structure will hold the information
      required when adding entries to a directory (linking). To
      start with, it will contain only the number of blocks which
      are required to link the new entry into the directory. The
      current calculation returns either 0 or the maximim number of
      blocks that can ever be requested by such a transaction.
      
      The intent is that in a later patch, we can update the dir
      code to calculate this value more accurately. In addition
      further patches will also add further fields to the new
      structure to increase its utility.
      
      In addition this patch fixes a bug where the link used during
      inode creation was adding requesting too many blocks in
      some cases. This is harmless unless the fs is close to being
      full.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      3c1c0ae1
  7. 20 8月, 2013 1 次提交
  8. 29 6月, 2013 1 次提交
  9. 14 6月, 2013 1 次提交
  10. 11 6月, 2013 1 次提交
    • S
      GFS2: Only do one directory search on create · 5a00f3cc
      Steven Whitehouse 提交于
      Creation of a new inode requires a directory search in order to ensure
      that we are not trying to create an inode with the same name as an
      existing one. This was hidden away inside the create_ok() function.
      
      In the case that there was an existing inode, and a lookup can be
      substituted for a create (which is the case with regular files
      when the O_EXCL flag is not in use) then we were doing a second
      lookup in order to return the inode.
      
      This patch merges these two lookups into one. This can be done by
      passing a flag to gfs2_dir_search() to tell it to just return -EEXIST
      in the cases where we don't actually want to look up the inode.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      5a00f3cc
  11. 03 6月, 2013 1 次提交
    • B
      GFS2: Fall back to vmalloc if kmalloc fails for dir hash tables · e8830d88
      Bob Peterson 提交于
      This version has one more correction: the vmalloc calls are replaced
      by __vmalloc calls to preserve the GFP_NOFS flag.
      
      When GFS2's directory management code allocates buffers for a
      directory hash table, if it can't get the memory it needs, it
      currently gives a bad return code. Rather than giving an error,
      this patch allows it to use virtual memory rather than kernel
      memory for the hash table. This should make it possible for
      directories to function properly, even when kernel memory becomes
      very fragmented.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      e8830d88
  12. 13 2月, 2013 1 次提交
  13. 29 1月, 2013 1 次提交
    • S
      GFS2: Split gfs2_trans_add_bh() into two · 350a9b0a
      Steven Whitehouse 提交于
      There is little common content in gfs2_trans_add_bh() between the data
      and meta classes by the time that the functions which it calls are
      taken into account. The intent here is to split this into two
      separate functions. Stage one is to introduce gfs2_trans_add_data()
      and gfs2_trans_add_meta() and update the callers accordingly.
      
      Later patches will then pull in the content of gfs2_trans_add_bh()
      and its dependent functions in order to clean up the code in this
      area.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      350a9b0a
  14. 13 11月, 2012 1 次提交
  15. 06 6月, 2012 1 次提交
  16. 11 5月, 2012 1 次提交
    • L
      vfs: make it possible to access the dentry hash/len as one 64-bit entry · 26fe5750
      Linus Torvalds 提交于
      This allows comparing hash and len in one operation on 64-bit
      architectures.  Right now only __d_lookup_rcu() takes advantage of this,
      since that is the case we care most about.
      
      The use of anonymous struct/unions hides the alternate 64-bit approach
      from most users, the exception being a few cases where we initialize a
      'struct qstr' with a static initializer.  This makes the problematic
      cases use a new QSTR_INIT() helper function for that (but initializing
      just the name pointer with a "{ .name = xyzzy }" initializer remains
      valid, as does just copying another qstr structure).
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      26fe5750
  17. 05 4月, 2012 1 次提交
  18. 22 11月, 2011 1 次提交
  19. 21 11月, 2011 1 次提交
    • B
      GFS2: move toward a generic multi-block allocator · 6e87ed0f
      Bob Peterson 提交于
      This patch is a revision of the one I previously posted.
      I tried to integrate all the suggestions Steve gave.
      The purpose of the patch is to change function gfs2_alloc_block
      (allocate either a dinode block or an extent of data blocks)
      to a more generic gfs2_alloc_blocks function that can
      allocate both a dinode _and_ an extent of data blocks in the
      same call. This will ultimately help us create a multi-block
      reservation scheme to reduce file fragmentation.
      
      This patch moves more toward a generic multi-block allocator that
      takes a pointer to the number of data blocks to allocate, plus whether
      or not to allocate a dinode. In theory, it could be called to allocate
      (1) a single dinode block, (2) a group of one or more data blocks, or
      (3) a dinode plus several data blocks.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      6e87ed0f
  20. 15 11月, 2011 1 次提交
  21. 09 11月, 2011 1 次提交
  22. 08 11月, 2011 1 次提交
  23. 21 10月, 2011 4 次提交
    • S
      GFS2: Use cached rgrp in gfs2_rlist_add() · 70b0c365
      Steven Whitehouse 提交于
      Each block which is deallocated, requires a call to gfs2_rlist_add()
      and each of those calls was calling gfs2_blk2rgrpd() in order to
      figure out which rgrp the block belonged in. This can be speeded up
      by making use of the rgrp cached in the inode. We also reset this
      cached rgrp in case the block has changed rgrp. This should provide
      a big reduction in gfs2_blk2rgrpd() calls during deallocation.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      70b0c365
    • S
      GFS2: Make resource groups "append only" during life of fs · 8339ee54
      Steven Whitehouse 提交于
      Since we have ruled out supporting online filesystem shrink,
      it is possible to make the resource group list append only
      during the life of a super block. This gives several benefits:
      
      Firstly, we only need to read new rindex elements as they are added
      rather than needing to reread the whole rindex file each time one
      element is added.
      
      Secondly, the rindex glock can be held for much shorter periods of
      time, and is completely removed from the fast path for allocations.
      The lock is taken in shared mode only when updating the resource
      groups when the first allocation occurs, and after a grow has
      taken place.
      
      Thirdly, this results in a reduction in code size, and everything
      gets a lot simpler to understand in this area.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      8339ee54
    • S
      GFS2: Use ->dirty_inode() · ab9bbda0
      Steven Whitehouse 提交于
      The aim of this patch is to use the newly enhanced ->dirty_inode()
      super block operation to deal with atime updates, rather than
      piggy backing that code into ->write_inode() as is currently
      done.
      
      The net result is a simplification of the code in various places
      and a reduction of the number of gfs2_dinode_out() calls since
      this is now implied by ->dirty_inode().
      
      Some of the mark_inode_dirty() calls have been moved under glocks
      in order to take advantage of then being able to avoid locking in
      ->dirty_inode() when we already have suitable locks.
      
      One consequence is that generic_write_end() now correctly deals
      with file size updates, so that we do not need a separate check
      for that afterwards. This also, indirectly, means that fdatasync
      should work correctly on GFS2 - the current code always syncs the
      metadata whether it needs to or not.
      
      Has survived testing with postmark (with and without atime) and
      also fsx.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      ab9bbda0
    • S
      GFS2: Clean up dir hash table reading · 4c28d338
      Steven Whitehouse 提交于
      Since there is now only a single caller to gfs2_dir_read_data()
      and it has a number of constant arguments, we can factor
      those out. Also some tests relating to the inode size were
      being done twice.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      4c28d338
  24. 15 7月, 2011 1 次提交
    • S
      GFS2: Cache dir hash table in a contiguous buffer · 17d539f0
      Steven Whitehouse 提交于
      This patch adds a cache for the hash table to the directory code
      in order to help simplify the way in which the hash table is
      accessed. This is intended to be a first step towards introducing
      some performance improvements in the directory code.
      
      There are two follow ups that I'm hoping to see fairly shortly. One
      is to simplify the hash table reading code now that we always read the
      complete hash table, whether we want one entry or all of them. The
      other is to introduce readahead on the heads of the hash chains
      which are referred to from the table.
      
      The hash table is a maximum of 128k in size, so it is not worth trying
      to read it in small chunks.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      17d539f0
  25. 09 5月, 2011 2 次提交
    • S
      GFS2: When adding a new dir entry, inc link count if it is a subdir · 3d6ecb7d
      Steven Whitehouse 提交于
      This adds an increment of the link count when we add a new directory
      entry, if that entry is itself a directory. This means that we no
      longer need separate code to perform this operation.
      
      Now that both adding and removing directory entries automatically
      update the parent directory's link count if required, that makes
      the code shorter and simpler than before.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      3d6ecb7d
    • S
      GFS2: Make gfs2_dir_del update link count when required · 855d23ce
      Steven Whitehouse 提交于
      When we remove an entry from a directory, we can save ourselves
      some trouble if we know the type of the entry in question, since
      if it is itself a directory, we can update the link count of the
      parent at the same time as removing the directory entry.
      
      In addition this patch also merges the rmdir and unlink code which
      was almost identical anyway. This eliminates the calls to remove
      the . and .. directory entries on each rmdir (not needed since the
      directory will be deallocated, anyway) which was the only thing preventing
      passing the dentry to gfs2_dir_del(). The passing of the dentry
      rather than just the name allows us to figure out the type of the entry
      which is being removed, and thus adjust the link count when required.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      855d23ce
  26. 20 4月, 2011 4 次提交
  27. 18 4月, 2011 1 次提交
    • B
      GFS2: filesystem hang caused by incorrect lock order · 44ad37d6
      Bob Peterson 提交于
      This patch fixes a deadlock in GFS2 where two processes are trying
      to reclaim an unlinked dinode:
      One holds the inode glock and calls gfs2_lookup_by_inum trying to look
      up the inode, which it can't, due to I_FREEING.  The other has set
      I_FREEING from vfs and is at the beginning of gfs2_delete_inode
      waiting for the glock, which is held by the first.  The solution is to
      add a new non_block parameter to the gfs2_iget function that causes it
      to return -ENOENT if the inode is being freed.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      44ad37d6
  28. 20 9月, 2010 2 次提交