1. 11 11月, 2008 14 次提交
  2. 15 10月, 2008 3 次提交
  3. 14 10月, 2008 18 次提交
    • T
      ocfs2: Refactor xattr list and remove ocfs2_xattr_handler(). · 936b8834
      Tao Ma 提交于
      According to Christoph Hellwig's advice, we really don't need
      a ->list to handle one xattr's list. Just a map from index to
      xattr prefix is enough. And I also refactor the old list method
      with the reference from fs/xfs/linux-2.6/xfs_xattr.c and the
      xattr list method in btrfs.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      936b8834
    • T
      ocfs2: Calculate EA hash only by its suffix. · 2057e5c6
      Tao Ma 提交于
      According to Christoph Hellwig's advice, the hash value of EA
      is only calculated by its suffix.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      2057e5c6
    • M
      ocfs2: Move trusted and user attribute support into xattr.c · 99219aea
      Mark Fasheh 提交于
      Per Christoph Hellwig's suggestion - don't split these up. It's not like we
      gained much by having the two tiny files around.
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      99219aea
    • M
      ocfs2: Uninline ocfs2_xattr_name_hash() · 40daa16a
      Mark Fasheh 提交于
      This is too big to be inlined.
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      40daa16a
    • T
      ocfs2: Add empty bucket support in xattr. · 5a095611
      Tao Ma 提交于
      As Mark mentioned, it may be time-consuming when we remove the
      empty xattr bucket, so this patch try to let empty bucket exist
      in xattr operation. The modification includes:
      1. Remove the functin of bucket and extent record deletion during
         xattr delete.
      2. In xattr set:
         1) Don't clean the last entry so that if the bucket is empty,
            the hash value of the bucket is the hash value of the entry
            which is deleted last.
         2) During insert, if we meet with an empty bucket, just use the
            1st entry.
      3. In binary search of xattr bucket, use the bucket hash value(which
         stored in the 1st xattr entry) to find the right place.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      5a095611
    • T
      ocfs2/xattr.c: Fix a bug when inserting xattr. · 06b240d8
      Tao Ma 提交于
      During the process of xatt insertion, we use binary search
      to find the right place and "low" is set to it. But when
      there is one xattr which has the same name hash as the inserted
      one, low is the wrong value. So set it to the right position.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      06b240d8
    • T
      ocfs2: Resolve deadlock in ocfs2_xattr_free_block. · 08413899
      Tao Ma 提交于
      In ocfs2_xattr_free_block, we take a cluster lock on xb_alloc_inode while we
      have a transaction open. This will deadlock the downconvert thread, so fix
      it.
      
      We can clean up how xattr blocks are removed while here - this patch also
      moves the mechanism of releasing xattr block (including both value, xattr
      tree and xattr block) into this function.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      08413899
    • T
      ocfs2: bug-fix for journal extend in xattr. · 28b8ca0b
      Tao Ma 提交于
      In ocfs2_extend_trans, when we can't extend the current
      transaction, it will commit current transaction and restart
      a new one. So if the previous credits we have allocated aren't
      used(the block isn't dirtied before our extend), we will not
      have enough credits for any future operation(it will cause jbd
      complain and bug out). So check this and re-extend it.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      28b8ca0b
    • J
      ocfs2: Change ocfs2_get_*_extent_tree() to ocfs2_init_*_extent_tree() · 8d6220d6
      Joel Becker 提交于
      The original get/put_extent_tree() functions held a reference on
      et_root_bh.  However, every single caller already has a safe reference,
      making the get/put cycle irrelevant.
      
      We change ocfs2_get_*_extent_tree() to ocfs2_init_*_extent_tree().  It
      no longer gets a reference on et_root_bh.  ocfs2_put_extent_tree() is
      removed.  Callers now have a simpler init+use pattern.
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      8d6220d6
    • J
      ocfs2: Make ocfs2_extent_tree the first-class representation of a tree. · f99b9b7c
      Joel Becker 提交于
      We now have three different kinds of extent trees in ocfs2: inode data
      (dinode), extended attributes (xattr_tree), and extended attribute
      values (xattr_value).  There is a nice abstraction for them,
      ocfs2_extent_tree, but it is hidden in alloc.c.  All the calling
      functions have to pick amongst a varied API and pass in type bits and
      often extraneous pointers.
      
      A better way is to make ocfs2_extent_tree a first-class object.
      Everyone converts their object to an ocfs2_extent_tree() via the
      ocfs2_get_*_extent_tree() calls, then uses the ocfs2_extent_tree for all
      tree calls to alloc.c.
      
      This simplifies a lot of callers, making for readability.  It also
      provides an easy way to add additional extent tree types, as they only
      need to be defined in alloc.c with a ocfs2_get_<new>_extent_tree()
      function.
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      f99b9b7c
    • M
      ocfs2: fix printk format warnings · ff1ec20e
      Mark Fasheh 提交于
      This patch fixes the following build warnings:
      
      fs/ocfs2/xattr.c: In function 'ocfs2_half_xattr_bucket':
      fs/ocfs2/xattr.c:3282: warning: format '%d' expects type 'int', but argument 7 has type 'long int'
      fs/ocfs2/xattr.c:3282: warning: format '%d' expects type 'int', but argument 8 has type 'long int'
      fs/ocfs2/xattr.c:3282: warning: format '%d' expects type 'int', but argument 7 has type 'long int'
      fs/ocfs2/xattr.c:3282: warning: format '%d' expects type 'int', but argument 8 has type 'long int'
      fs/ocfs2/xattr.c:3282: warning: format '%d' expects type 'int', but argument 7 has type 'long int'
      fs/ocfs2/xattr.c:3282: warning: format '%d' expects type 'int', but argument 8 has type 'long int'
      fs/ocfs2/xattr.c: In function 'ocfs2_xattr_set_entry_in_bucket':
      fs/ocfs2/xattr.c:4092: warning: format '%d' expects type 'int', but argument 6 has type 'size_t'
      fs/ocfs2/xattr.c:4092: warning: format '%d' expects type 'int', but argument 6 has type 'size_t'
      fs/ocfs2/xattr.c:4092: warning: format '%d' expects type 'int', but argument 6 has type 'size_t'
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      ff1ec20e
    • T
      ocfs2: Add incompatible flag for extended attribute · 8154da3d
      Tiger Yang 提交于
      This patch adds the s_incompat flag for extended attribute support. This
      helps us ensure that older versions of Ocfs2 or ocfs2-tools will not be able
      to mount a volume with xattr support.
      Signed-off-by: NTiger Yang <tiger.yang@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      8154da3d
    • T
      ocfs2: Delete all xattr buckets during inode removal · a3944256
      Tao Ma 提交于
      In inode removal, we need to iterate all the buckets, remove any
      externally-stored EA values and delete the xattr buckets.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      a3944256
    • 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 lookup code xattr btrees · 589dc260
      Tao Ma 提交于
      Add code to lookup a given extended attribute in the xattr btree. Lookup
      follows this general scheme:
      
      1. Use ocfs2_xattr_get_rec to find the xattr extent record
      
      2. Find the xattr bucket within the extent which may contain this xattr
      
      3. Iterate the bucket to find the xattr. In ocfs2_xattr_block_get(), we need
         to recalcuate the block offset and name offset for the right position of
         name/value.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      589dc260
    • 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
    • T
      ocfs2: Add extent tree operation for xattr value btrees · f56654c4
      Tao Ma 提交于
      Add some thin wrappers around ocfs2_insert_extent() for each of the 3
      different btree types, ocfs2_inode_insert_extent(),
      ocfs2_xattr_value_insert_extent() and ocfs2_xattr_tree_insert_extent(). The
      last is for the xattr index btree, which will be used in a followup patch.
      
      All the old callers in file.c etc will call ocfs2_dinode_insert_extent(),
      while the other two handle the xattr issue. And the init of extent tree are
      handled by these functions.
      
      When storing xattr value which is too large, we will allocate some clusters
      for it and here ocfs2_extent_list and ocfs2_extent_rec will also be used. In
      order to re-use the b-tree operation code, a new parameter named "private"
      is added into ocfs2_extent_tree and it is used to indicate the root of
      ocfs2_exent_list. The reason is that we can't deduce the root from the
      buffer_head now. It may be in an inode, an ocfs2_xattr_block or even worse,
      in any place in an ocfs2_xattr_bucket.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      f56654c4