1. 04 4月, 2009 1 次提交
    • M
      ocfs2: Add a name indexed b-tree to directory inodes · 9b7895ef
      Mark Fasheh 提交于
      This patch makes use of Ocfs2's flexible btree code to add an additional
      tree to directory inodes. The new tree stores an array of small,
      fixed-length records in each leaf block. Each record stores a hash value,
      and pointer to a block in the traditional (unindexed) directory tree where a
      dirent with the given name hash resides. Lookup exclusively uses this tree
      to find dirents, thus providing us with constant time name lookups.
      
      Some of the hashing code was copied from ext3. Unfortunately, it has lots of
      unfixed checkpatch errors. I left that as-is so that tracking changes would
      be easier.
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      Acked-by: NJoel Becker <joel.becker@oracle.com>
      9b7895ef
  2. 06 1月, 2009 7 次提交
  3. 11 11月, 2008 2 次提交
  4. 14 10月, 2008 3 次提交
    • T
      ocfs2: Enable xattr set in index btree · 01225596
      Tao Ma 提交于
      Where the previous patches added the ability of list/get xattr in buckets
      for ocfs2, this patch enables ocfs2 to store large numbers of EAs.
      
      The original design doc is written by Mark Fasheh, and it can be found in
      http://oss.oracle.com/osswiki/OCFS2/DesignDocs/IndexedEATrees. I only had to
      make small modifications to it.
      
      First, because the bucket size is 4K, a new field named xh_free_start is added
      in ocfs2_xattr_header to indicate the next valid name/value offset in a bucket.
      It is used when we store new EA name/value. With this field, we can find the
      place more quickly and what's more, we don't need to sort the name/value every
      time to let the last entry indicate the next unused space. This makes the
      insert operation more efficient for blocksizes smaller than 4k.
      
      Because of the new xh_free_start, another field named as xh_name_value_len is
      also added in ocfs2_xattr_header. It records the total length of all the
      name/values in the bucket. We need this so that we can check it and defragment
      the bucket if there is not enough contiguous free space.
      
      An xattr insertion looks like this:
      1. xattr_index_block_find: find the right bucket by the name_hash, say bucketA.
      2. check whether there is enough space in bucketA. If yes, insert it directly
         and modify xh_free_start and xh_name_value_len accordingly. If not, check
         xh_name_value_len to see whether we can store this by defragment the bucket.
         If yes, defragment it and go on insertion.
      3. If defragement doesn't work, check whether there is new empty bucket in
         the clusters within this extent record. If yes, init the new bucket and move
         all the buckets after bucketA one by one to the next bucket. Move half of the
         entries in bucketA to the next bucket and go on insertion.
      4. If there is no new bucket, grow the extent tree.
      
      As for xattr deletion, we will delete an xattr bucket when all it's xattrs
      are removed and move all the buckets after it to the previous one. When all
      the xattr buckets in an extend record are freed, free this extend records
      from ocfs2_xattr_tree.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      01225596
    • T
      ocfs2: Add xattr bucket iteration for large numbers of EAs · 0c044f0b
      Tao Ma 提交于
      Ocfs2 breaks up xattr index tree leaves into 4k regions, called buckets.
      Attributes are stored within a given bucket, depending on hash value.
      
      After a discussion with Mark, we decided that the per-bucket index
      (xe_entry[]) would only exist in the 1st block of a bucket. Likewise,
      name/value pairs will not straddle more than one block. This allows the
      majority of operations to work directly on the buffer heads in a leaf block.
      
      This patch adds code to iterate the buckets in an EA. A new abstration of
      ocfs2_xattr_bucket is added. It records the bhs in this bucket and
      ocfs2_xattr_header. This keeps the code neat, improving readibility.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      0c044f0b
    • T
      ocfs2: Add extended attribute support · cf1d6c76
      Tiger Yang 提交于
      This patch implements storing extended attributes both in inode or a single
      external block. We only store EA's in-inode when blocksize > 512 or that
      inode block has free space for it. When an EA's value is larger than 80
      bytes, we will store the value via b-tree outside inode or block.
      Signed-off-by: NTiger Yang <tiger.yang@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      cf1d6c76