1. 16 10月, 2010 1 次提交
  2. 11 9月, 2010 1 次提交
    • T
      ocfs2/lockdep: Move ip_xattr_sem out of ocfs2_xattr_get_nolock. · 5e64b0d9
      Tao Ma 提交于
      As the name shows, we shouldn't have any lock in
      ocfs2_xattr_get_nolock. so lift ip_xattr_sem to the caller.
      This should be safe for us since the only 2 callers are:
      1. ocfs2_xattr_get which will lock the resources.
      2. ocfs2_mknod which don't need this locking.
      
      And this also resolves the following lockdep warning.
      
      =======================================================
      [ INFO: possible circular locking dependency detected ]
      2.6.35+ #5
      -------------------------------------------------------
      reflink/30027 is trying to acquire lock:
       (&oi->ip_alloc_sem){+.+.+.}, at: [<ffffffffa0673b67>] ocfs2_reflink_ioctl+0x69a/0x1226 [ocfs2]
      
      but task is already holding lock:
       (&oi->ip_xattr_sem){++++..}, at: [<ffffffffa0673b58>] ocfs2_reflink_ioctl+0x68b/0x1226 [ocfs2]
      
      which lock already depends on the new lock.
      
      the existing dependency chain (in reverse order) is:
      
      -> #3 (&oi->ip_xattr_sem){++++..}:
             [<ffffffff82064d6d>] __lock_acquire+0x79a/0x7f1
             [<ffffffff82065a81>] lock_acquire+0xc6/0xed
             [<ffffffff82339650>] down_read+0x34/0x47
             [<ffffffffa0691cb8>] ocfs2_xattr_get_nolock+0xa0/0x4e6 [ocfs2]
             [<ffffffffa069d64f>] ocfs2_get_acl_nolock+0x5c/0x132 [ocfs2]
             [<ffffffffa069d9c7>] ocfs2_init_acl+0x60/0x243 [ocfs2]
             [<ffffffffa066499d>] ocfs2_mknod+0xae8/0xfea [ocfs2]
             [<ffffffffa0665041>] ocfs2_create+0x9d/0x105 [ocfs2]
             [<ffffffff820e1c83>] vfs_create+0x9b/0xf4
             [<ffffffff820e20bb>] do_last+0x2fd/0x5be
             [<ffffffff820e31c0>] do_filp_open+0x1fb/0x572
             [<ffffffff820d6cf6>] do_sys_open+0x5a/0xe7
             [<ffffffff820d6dac>] sys_open+0x1b/0x1d
             [<ffffffff8200296b>] system_call_fastpath+0x16/0x1b
      
      -> #2 (jbd2_handle){+.+...}:
             [<ffffffff82064d6d>] __lock_acquire+0x79a/0x7f1
             [<ffffffff82065a81>] lock_acquire+0xc6/0xed
             [<ffffffffa0604ff8>] start_this_handle+0x4a3/0x4bc [jbd2]
             [<ffffffffa06051d6>] jbd2__journal_start+0xba/0xee [jbd2]
             [<ffffffffa0605218>] jbd2_journal_start+0xe/0x10 [jbd2]
             [<ffffffffa065ca34>] ocfs2_start_trans+0xb7/0x19b [ocfs2]
             [<ffffffffa06645f3>] ocfs2_mknod+0x73e/0xfea [ocfs2]
             [<ffffffffa0665041>] ocfs2_create+0x9d/0x105 [ocfs2]
             [<ffffffff820e1c83>] vfs_create+0x9b/0xf4
             [<ffffffff820e20bb>] do_last+0x2fd/0x5be
             [<ffffffff820e31c0>] do_filp_open+0x1fb/0x572
             [<ffffffff820d6cf6>] do_sys_open+0x5a/0xe7
             [<ffffffff820d6dac>] sys_open+0x1b/0x1d
             [<ffffffff8200296b>] system_call_fastpath+0x16/0x1b
      
      -> #1 (&journal->j_trans_barrier){.+.+..}:
             [<ffffffff82064d6d>] __lock_acquire+0x79a/0x7f1
             [<ffffffff82064fa9>] lock_release_non_nested+0x1e5/0x24b
             [<ffffffff82065999>] lock_release+0x158/0x17a
             [<ffffffff823389f6>] __mutex_unlock_slowpath+0xbf/0x11b
             [<ffffffff82338a5b>] mutex_unlock+0x9/0xb
             [<ffffffffa0679673>] ocfs2_free_ac_resource+0x31/0x67 [ocfs2]
             [<ffffffffa067c6bc>] ocfs2_free_alloc_context+0x11/0x1d [ocfs2]
             [<ffffffffa0633de0>] ocfs2_write_begin_nolock+0x141e/0x159b [ocfs2]
             [<ffffffffa0635523>] ocfs2_write_begin+0x11e/0x1e7 [ocfs2]
             [<ffffffff820a1297>] generic_file_buffered_write+0x10c/0x210
             [<ffffffffa0653624>] ocfs2_file_aio_write+0x4cc/0x6d3 [ocfs2]
             [<ffffffff820d822d>] do_sync_write+0xc2/0x106
             [<ffffffff820d897b>] vfs_write+0xae/0x131
             [<ffffffff820d8e55>] sys_write+0x47/0x6f
             [<ffffffff8200296b>] system_call_fastpath+0x16/0x1b
      
      -> #0 (&oi->ip_alloc_sem){+.+.+.}:
             [<ffffffff82063f92>] validate_chain+0x727/0xd68
             [<ffffffff82064d6d>] __lock_acquire+0x79a/0x7f1
             [<ffffffff82065a81>] lock_acquire+0xc6/0xed
             [<ffffffff82339694>] down_write+0x31/0x52
             [<ffffffffa0673b67>] ocfs2_reflink_ioctl+0x69a/0x1226 [ocfs2]
             [<ffffffffa06599f6>] ocfs2_ioctl+0x61a/0x656 [ocfs2]
             [<ffffffff820e53ac>] vfs_ioctl+0x2a/0x9d
             [<ffffffff820e5903>] do_vfs_ioctl+0x45d/0x4ae
             [<ffffffff820e59ab>] sys_ioctl+0x57/0x7a
             [<ffffffff8200296b>] system_call_fastpath+0x16/0x1b
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      5e64b0d9
  3. 13 7月, 2010 2 次提交
  4. 22 5月, 2010 1 次提交
  5. 19 5月, 2010 2 次提交
    • T
      ocfs2: Don't retry xattr set in case value extension fails. · 5f5261ac
      Tao Ma 提交于
      In normal xattr set, the set sequence is inode, xattr block
      and finally xattr bucket if we meet with a ENOSPC. But there
      is a corner case.
      So consider we will set a xattr whose value will be stored in
      a cluster, and there is no xattr block by now. So we will
      reserve 1 xattr block and 1 cluster for setting it. Now if we
      fail in value extension(in case the volume is almost full and
      we can't allocate the cluster because the check in
      ocfs2_test_bg_bit_allocatable), ENOSPC will be returned. So
      we will try to create a bucket(this time there is a chance that
      the reserved cluster will be used), and when we try value extension
      again, kernel bug happens. We did meet with it. Check the bug below.
      http://oss.oracle.com/bugzilla/show_bug.cgi?id=1251
      
      This patch just try to avoid this by adding a set_abort in
      ocfs2_xattr_set_ctxt, so in case ENOSPC happens in value extension,
      we will check whether it is caused by the real ENOSPC or just the
      full of inode or xattr block. If it is the first case, we set set_abort
      so that we don't try any further. we are safe to exit directly here
      ince it is really ENOSPC.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      5f5261ac
    • T
      ocfs2: Reset xattr value size after xa_cleanup_value_truncate(). · d5a7df06
      Tao Ma 提交于
      In ocfs2_prepare_xattr_entry, if we fail to grow an existing value,
      xa_cleanup_value_truncate() will leave the old entry in place.  Thus, we
      reset its value size.  However, if we were allocating a new value, we
      must not reset the value size or we will BUG().  This resolves
      oss.oracle.com bug 1247.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      d5a7df06
  6. 06 5月, 2010 2 次提交
    • T
      ocfs2: Make ocfs2_extend_trans() really extend. · c901fb00
      Tao Ma 提交于
      In ocfs2, we use ocfs2_extend_trans() to extend a journal handle's
      blocks. But if jbd2_journal_extend() fails, it will only restart
      with the the new number of blocks.  This tends to be awkward since
      in most cases we want additional reserved blocks. It makes our code
      harder to mantain since the caller can't be sure all the original
      blocks will not be accessed and dirtied again.  There are 15 callers
      of ocfs2_extend_trans() in fs/ocfs2, and 12 of them have to add
      h_buffer_credits before they call ocfs2_extend_trans().  This makes
      ocfs2_extend_trans() really extend atop the original block count.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      c901fb00
    • J
      ocfs2: Make ocfs2_journal_dirty() void. · ec20cec7
      Joel Becker 提交于
      jbd[2]_journal_dirty_metadata() only returns 0.  It's been returning 0
      since before the kernel moved to git.  There is no point in checking
      this error.
      
      ocfs2_journal_dirty() has been faithfully returning the status since the
      beginning.  All over ocfs2, we have blocks of code checking this can't
      fail status.  In the past few years, we've tried to avoid adding these
      checks, because they are pointless.  But anyone who looks at our code
      assumes they are needed.
      
      Finally, ocfs2_journal_dirty() is made a void function.  All error
      checking is removed from other files.  We'll BUG_ON() the status of
      jbd2_journal_dirty_metadata() just in case they change it someday.  They
      won't.
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      ec20cec7
  7. 20 3月, 2010 2 次提交
    • T
      ocfs2: Init meta_ac properly in ocfs2_create_empty_xattr_block. · b2317968
      Tao Ma 提交于
      You can't store a pointer that you haven't filled in yet and expect it
      to work.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      b2317968
    • T
      ocfs2: Fix the update of name_offset when removing xattrs · dfe4d3d6
      Tao Ma 提交于
      When replacing a xattr's value, in some case we wipe its name/value
      first and then re-add it. The wipe is done by
      ocfs2_xa_block_wipe_namevalue() when the xattr is in the inode or
      block. We currently adjust name_offset for all the entries which have
      (offset < name_offset). This does not adjust the entrie we're replacing.
      Since we are replacing the entry, we don't adjust the total entry count.
      When we calculate a new namevalue location, we trust the entries
      now-wrong offset in ocfs2_xa_get_free_start().  The solution is to
      also adjust the name_offset for the replaced entry, allowing
      ocfs2_xa_get_free_start() to calculate the new namevalue location
      correctly.
      
      The following script can trigger a kernel panic easily.
      
      echo 'y'|mkfs.ocfs2 --fs-features=local,xattr -b 4K $DEVICE
      mount -t ocfs2 $DEVICE $MNT_DIR
      FILE=$MNT_DIR/$RANDOM
      for((i=0;i<76;i++))
      do
      string_76="a$string_76"
      done
      string_78="aa$string_76"
      string_82="aaaa$string_78"
      
      touch $FILE
      setfattr -n 'user.test1234567890' -v $string_76 $FILE
      setfattr -n 'user.test1234567890' -v $string_78 $FILE
      setfattr -n 'user.test1234567890' -v $string_82 $FILE
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      dfe4d3d6
  8. 22 3月, 2010 1 次提交
  9. 26 3月, 2010 1 次提交
  10. 06 5月, 2010 1 次提交
  11. 27 2月, 2010 16 次提交
    • J
      ocfs2: Handle errors while setting external xattr values. · 399ff3a7
      Joel Becker 提交于
      ocfs2 can store extended attribute values as large as a single file.  It
      does this using a standard ocfs2 btree for the large value.  However,
      the previous code did not handle all error cases cleanly.
      
      There are multiple problems to have.
      
      1) We have trouble allocating space for a new xattr.  This leaves us
         with an empty xattr.
      2) We overwrote an existing local xattr with a value root, and now we
         have an error allocating the storage.  This leaves us an empty xattr.
         where there used to be a value.  The value is lost.
      3) We have trouble truncating a reused value.  This leaves us with the
         original entry pointing to the truncated original value.  The value
         is lost.
      4) We have trouble extending the storage on a reused value.  This leaves
         us with the original value safely in place, but with more storage
         allocated when needed.
      
      This doesn't consider storing local xattrs (values that don't require a
      btree).  Those only fail when the journal fails.
      
      Case (1) is easy.  We just remove the xattr we added.  We leak the
      storage because we can't safely remove it, but otherwise everything is
      happy.  We'll print a warning about the leak.
      
      Case (4) is easy.  We still have the original value in place.  We can
      just leave the extra storage attached to this xattr.  We return the
      error, but the old value is untouched.  We print a warning about the
      storage.
      
      Case (2) and (3) are hard because we've lost the original values.  In
      the old code, we ended up with values that could be partially read.
      That's not good.  Instead, we just wipe the xattr entry and leak the
      storage.  It stinks that the original value is lost, but now there isn't
      a partial value to be read.  We'll print a big fat warning.
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      399ff3a7
    • J
      ocfs2: Set inline xattr entries with ocfs2_xa_set() · 139fface
      Joel Becker 提交于
      ocfs2_xattr_ibody_set() is the only remaining user of
      ocfs2_xattr_set_entry().  ocfs2_xattr_set_entry() actually does two
      things: it calls ocfs2_xa_set(), and it initializes the inline xattrs.
      Initializing the inline space really belongs in its own call.
      
      We lift the initialization to ocfs2_xattr_ibody_init(), called from
      ocfs2_xattr_ibody_set() only when necessary.  Now
      ocfs2_xattr_ibody_set() can call ocfs2_xa_set() directly.
      ocfs2_xattr_set_entry() goes away.
      
      Another nice fact is that ocfs2_init_dinode_xa_loc() can trust
      i_xattr_inline_size.
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      139fface
    • J
      ocfs2: Set xattr block entries with ocfs2_xa_set() · d3981544
      Joel Becker 提交于
      ocfs2_xattr_block_set() calls into ocfs2_xattr_set_entry() with just the
      HAS_XATTR flag.  Most of the machinery of ocfs2_xattr_set_entry() is
      skipped.  All that really happens other than the call to ocfs2_xa_set()
      is making sure the HAS_XATTR flag is set on the inode.
      
      But HAS_XATTR should be set when we also set di->i_xattr_loc.  And
      that's done in ocfs2_create_xattr_block().  So let's move it there, and
      then ocfs2_xattr_block_set() can just call ocfs2_xa_set().
      
      While we're there, ocfs2_create_xattr_block() can take the set_ctxt for
      a smaller argument list.  It also learns to set HAS_XATTR_FL, because it
      knows for sure.  ocfs2_create_empty_xatttr_block() in the reflink path
      fakes a set_ctxt to call ocfs2_create_xattr_block().
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      d3981544
    • J
      ocfs2: Let ocfs2_xa_prepare_entry() do space checks. · c5d95df5
      Joel Becker 提交于
      ocfs2_xattr_set_in_bucket() doesn't need to do its own hacky space
      checking.  Let's let ocfs2_xa_prepare_entry() (via ocfs2_xa_set()) do
      the more accurate work.  Whenever it doesn't have space,
      ocfs2_xattr_set_in_bucket() can try to get more space.
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      c5d95df5
    • J
      ocfs2: Gell into ocfs2_xa_set() · bca5e9bd
      Joel Becker 提交于
      ocfs2_xa_set() wraps the ocfs2_xa_prepare_entry()/ocfs2_xa_store_value()
      logic.  Both callers can now use the same routine.  ocfs2_xa_remove()
      moves directly into ocfs2_xa_set().
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      bca5e9bd
    • J
      ocfs2: Allocation in ocfs2_xa_prepare_entry(), values in ocfs2_xa_store_value() · 73857ee0
      Joel Becker 提交于
      ocfs2_xa_prepare_entry() gets all the logic to add, remove, or modify
      external value trees.  Now, when it exits, the entry is ready to receive
      a value of any size.
      
      ocfs2_xa_remove() is added to handle the complete removal of an entry.
      It truncates the external value tree before calling
      ocfs2_xa_remove_entry().
      
      ocfs2_xa_store_inline_value() becomes ocfs2_xa_store_value().  It can
      store any value.
      
      ocfs2_xattr_set_entry() loses all the allocation logic and just uses
      these functions.  ocfs2_xattr_set_value_outside() disappears.
      
      ocfs2_xattr_set_in_bucket() uses these functions and makes
      ocfs2_xattr_set_entry_in_bucket() obsolete.  That goes away, as does
      ocfs2_xattr_bucket_set_value_outside() and
      ocfs2_xattr_bucket_value_truncate().
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      73857ee0
    • J
      ocfs2: Teach ocfs2_xa_loc how to do its own journal work · cf2bc809
      Joel Becker 提交于
      We're going to want to make sure our buffers get accessed and dirtied
      correctly.  So have the xa_loc do the work.  This includes storing the
      inode on ocfs2_xa_loc.
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      cf2bc809
    • J
      ocfs2: Provide ocfs2_xa_fill_value_buf() for external value processing · 3fc12afa
      Joel Becker 提交于
      We use the ocfs2_xattr_value_buf structure to manage external values.
      It lets the value tree code do its work regardless of the containing
      storage.  ocfs2_xa_fill_value_buf() initializes a value buf from an
      ocfs2_xa_loc entry.
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      3fc12afa
    • J
      ocfs2: Handle value tree roots in ocfs2_xa_set_inline_value() · 9dc47400
      Joel Becker 提交于
      Previously the xattr code would send in a fake value, containing a tree
      root, to the function that installed name+value pairs.  Instead, we pass
      the real value to ocfs2_xa_set_inline_value(), and it notices that the
      value cannot fit.  Thus, it installs a tree root.
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      9dc47400
    • J
      ocfs2: Set the xattr name+value pair in one place · 69a3e539
      Joel Becker 提交于
      We create two new functions on ocfs2_xa_loc, ocfs2_xa_prepare_entry()
      and ocfs2_xa_store_inline_value().
      
      ocfs2_xa_prepare_entry() makes sure that the xl_entry field of
      ocfs2_xa_loc is ready to receive an xattr.  The entry will point to an
      appropriately sized name+value region in storage.  If an existing entry
      can be reused, it will be.  If no entry already exists, it will be
      allocated.  If there isn't space to allocate it, -ENOSPC will be
      returned.
      
      ocfs2_xa_store_inline_value() stores the data that goes into the 'value'
      part of the name+value pair.  For values that don't fit directly, this
      stores the value tree root.
      
      A number of operations are added to ocfs2_xa_loc_operations to support
      these functions.  This reflects the disparate behaviors of xattr blocks
      and buckets.
      
      With these functions, the overlapping ocfs2_xattr_set_entry_local() and
      ocfs2_xattr_set_entry_normal() can be replaced with a single call
      scheme.
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      69a3e539
    • J
      ocfs2: Wrap calculation of name+value pair size. · 199799a3
      Joel Becker 提交于
      An ocfs2 xattr entry stores the text name and value as a pair in the
      storage area.  Obviously names and values can be variable-sized.  If a
      value is too large for the entry storage, a tree root is stored instead.
      The name+value pair is also padded.
      
      Because of this, there are a million places in the code that do:
      
      	if (needs_external_tree(value_size)
      		namevalue_size = pad(name_size) + tree_root_size;
      	else
      		namevalue_size = pad(name_size) + pad(value_size);
      
      Let's create some convenience functions to make the code more readable.
      There are three forms.  The first takes the raw sizes.  The second takes
      an ocfs2_xattr_info structure.  The third takes an existing
      ocfs2_xattr_entry.
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      199799a3
    • J
      ocfs2: Add a name_len field to ocfs2_xattr_info. · 18853b95
      Joel Becker 提交于
      Rather than calculating strlen all over the place, let's store the
      name length directly on ocfs2_xattr_info.
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      18853b95
    • J
      ocfs2: Prefix the member fields of struct ocfs2_xattr_info. · 6b240ff6
      Joel Becker 提交于
      struct ocfs2_xattr_info is a useful structure describing an xattr
      you'd like to set.  Let's put prefixes on the member fields so it's
      easier to read and use.
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      6b240ff6
    • J
      ocfs2: Remove xattrs via ocfs2_xa_loc · bde1e540
      Joel Becker 提交于
      Add ocfs2_xa_remove_entry(), which will remove an xattr entry from its
      storage via the ocfs2_xa_loc descriptor.
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      bde1e540
    • J
      ocfs2: Introduce ocfs2_xa_loc · 11179f2c
      Joel Becker 提交于
      The ocfs2 extended attribute (xattr) code is very flexible.  It can
      store xattrs in the inode itself, in an external block, or in a tree of
      data structures.  This allows the number of xattrs to be bounded by the
      filesystem size.
      
      However, the code that manages each possible storage location is
      different.  Maintaining the ocfs2 xattr code requires changing each hunk
      separately.
      
      This patch is the start of a series introducing the ocfs2_xa_loc
      structure.  This structure wraps the on-disk details of an xattr
      entry.  The goal is that the generic xattr routines can use
      ocfs2_xa_loc without knowing the underlying storage location.
      
      This first pass merely implements the basic structure, initializing it,
      and wiping the name+value pair of the entry.
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      11179f2c
    • T
      ocfs2: add extent block stealing for ocfs2 v5 · b89c5428
      Tiger Yang 提交于
      This patch add extent block (metadata) stealing mechanism for
      extent allocation. This mechanism is same as the inode stealing.
      if no room in slot specific extent_alloc, we will try to
      allocate extent block from the next slot.
      Signed-off-by: NTiger Yang <tiger.yang@oracle.com>
      Acked-by: NTao Ma <tao.ma@oracle.com>
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      b89c5428
  12. 24 12月, 2009 1 次提交
  13. 17 12月, 2009 1 次提交
    • C
      sanitize xattr handler prototypes · 431547b3
      Christoph Hellwig 提交于
      Add a flags argument to struct xattr_handler and pass it to all xattr
      handler methods.  This allows using the same methods for multiple
      handlers, e.g. for the ACL methods which perform exactly the same action
      for the access and default ACLs, just using a different underlying
      attribute.  With a little more groundwork it'll also allow sharing the
      methods for the regular user/trusted/secure handlers in extN, ocfs2 and
      jffs2 like it's already done for xfs in this patch.
      
      Also change the inode argument to the handlers to a dentry to allow
      using the handlers mechnism for filesystems that require it later,
      e.g. cifs.
      
      [with GFS2 bits updated by Steven Whitehouse <swhiteho@redhat.com>]
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NJames Morris <jmorris@namei.org>
      Acked-by: NJoel Becker <joel.becker@oracle.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      431547b3
  14. 29 10月, 2009 1 次提交
  15. 23 9月, 2009 7 次提交
    • T
      ocfs2: Add preserve to reflink. · 0fe9b66c
      Tao Ma 提交于
      reflink has 2 options for the destination file:
      1. snapshot: reflink will attempt to preserve ownership, permissions,
         and all other security state in order to create a full snapshot.
      2. new file: it will acquire the data extent sharing but will see the
         file's security state and attributes initialized as a new file.
      
      So add the option to ocfs2.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      0fe9b66c
    • T
      ocfs2: Modify removing xattr process for refcount. · ce9c5a54
      Tao Ma 提交于
      The old xattr value remove is quite simple, it just erase the
      tree and free the clusters. But as we have added refcount support,
      The process is a little complicated.
      
      We have to lock the refcount tree at the beginning, what's more,
      we may split the refcount tree in some cases, so meta/credits are
      needed.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      ce9c5a54
    • T
      ocfs2: Add reflink support for xattr. · 2999d12f
      Tao Ma 提交于
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      2999d12f
    • T
      ocfs2: Create an xattr indexed block if needed. · a7fe7a3a
      Tao Ma 提交于
      With reflink, there is a need that we create a new xattr indexed
      block from the very beginning. So add a new parameter for
      ocfs2_create_xattr_block.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      a7fe7a3a
    • T
      ocfs2: Call refcount tree remove process properly. · 8b2c0dba
      Tao Ma 提交于
      Now with xattr refcount support, we need to check whether
      we have xattr refcounted before we remove the refcount tree.
      
      Now the mechanism is:
      1) Check whether i_clusters == 0, if no, exit.
      2) check whether we have i_xattr_loc in dinode. if yes, exit.
      2) Check whether we have inline xattr stored outside, if yes, exit.
      4) Remove the tree.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      8b2c0dba
    • T
      ocfs2: Attach xattr clusters to refcount tree. · 0129241e
      Tao Ma 提交于
      In ocfs2, when xattr's value is larger than OCFS2_XATTR_INLINE_SIZE,
      it will be kept outside of the blocks we store xattr entry. And they
      are stored in a b-tree also. So this patch try to attach all these
      clusters to refcount tree also.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      0129241e
    • T
      ocfs2: Abstract ocfs2 xattr tree extend rec iteration process. · 47bca495
      Tao Ma 提交于
      Currently we have ocfs2_iterate_xattr_buckets which can receive
      a para and a callback to iterate a series of bucket. It is good.
      But actually the 2 callers ocfs2_xattr_tree_list_index_block and
      ocfs2_delete_xattr_index_block are almost the same. The only
      difference is that the latter need to handle the extent record
      also. So add a new function named ocfs2_iterate_xattr_index_block.
      It can be given func callback which are used for exten record.
      So now we only have one iteration function for the xattr index
      block. Ane what's more, it is useful for our future reflink
      operations.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      47bca495