1. 13 Oct, 2008 10 commits
    • Joel Becker's avatar
      ocfs2: Change ocfs2_get_*_extent_tree() to ocfs2_init_*_extent_tree() · 8d6220d6
      Joel Becker authored
      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: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
    • Joel Becker's avatar
      ocfs2: Make ocfs2_extent_tree the first-class representation of a tree. · f99b9b7c
      Joel Becker authored
      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()
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
    • Joel Becker's avatar
      ocfs2: Create specific get_extent_tree functions. · 1a09f556
      Joel Becker authored
      A caller knows what kind of extent tree they have.  There's no reason
      they have to call ocfs2_get_extent_tree() with a NULL when they could
      just as easily call a specific function to their type of extent tree.
      Introduce ocfs2_dinode_get_extent_tree(),
      ocfs2_xattr_tree_get_extent_tree(), and
      ocfs2_xattr_value_get_extent_tree().  They only take the necessary
      arguments, calling into the underlying __ocfs2_get_extent_tree() to do
      the real work.
      __ocfs2_get_extent_tree() is the old ocfs2_get_extent_tree(), but
      without needing any switch-by-type logic.
      ocfs2_get_extent_tree() is now a wrapper around the specific calls.  It
      exists because a couple alloc.c functions can take et_type.  This will
      go later.
      Another benefit is that ocfs2_xattr_value_get_extent_tree() can take a
      struct ocfs2_xattr_value_root* instead of void*.  This gives us
      typechecking where we didn't have it before.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
    • Tao Ma's avatar
      ocfs2: Optionally limit extent size in ocfs2_insert_extent() · ca12b7c4
      Tao Ma authored
      In xattr bucket, we want to limit the maximum size of a btree leaf,
      otherwise we'll lose the benefits of hashing because we'll have to search
      large leaves.
      So add a new field in ocfs2_extent_tree which indicates the maximum leaf cluster
      size we want so that we can prevent ocfs2_insert_extent() from merging the leaf
      record even if it is contiguous with an adjacent record.
      Other btree types are not affected by this change.
      Signed-off-by: default avatarTao Ma <tao.ma@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
    • Tao Ma's avatar
      ocfs2: Add xattr index tree operations · ba492615
      Tao Ma authored
      When necessary, an ocfs2_xattr_block will embed an ocfs2_extent_list to
      store large numbers of EAs. This patch adds a new type in
      ocfs2_extent_tree_type and adds the implementation so that we can re-use the
      b-tree code to handle the storage of many EAs.
      Signed-off-by: default avatarTao Ma <tao.ma@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
    • Tao Ma's avatar
      ocfs2: Add extent tree operation for xattr value btrees · f56654c4
      Tao Ma authored
      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: default avatarTao Ma <tao.ma@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
    • Tao Ma's avatar
      ocfs2: Make high level btree extend code generic · 0eb8d47e
      Tao Ma authored
      Factor out the non-inode specifics of ocfs2_do_extend_allocation() into a more generic
      function, ocfs2_do_cluster_allocation(). ocfs2_do_extend_allocation calls
      ocfs2_do_cluster_allocation() now, but the latter can be used for other
      btree types as well.
      Signed-off-by: default avatarTao Ma <tao.ma@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
    • Tao Ma's avatar
      ocfs2: Abstract ocfs2_extent_tree in b-tree operations. · e7d4cb6b
      Tao Ma authored
      In the old extent tree operation, we take the hypothesis that we
      are using the ocfs2_extent_list in ocfs2_dinode as the tree root.
      As xattr will also use ocfs2_extent_list to store large value
      for a xattr entry, we refactor the tree operation so that xattr
      can use it directly.
      The refactoring includes 4 steps:
      1. Abstract set/get of last_eb_blk and update_clusters since they may
         be stored in different location for dinode and xattr.
      2. Add a new structure named ocfs2_extent_tree to indicate the
         extent tree the operation will work on.
      3. Remove all the use of fe_bh and di, use root_bh and root_el in
         extent tree instead. So now all the fe_bh is replaced with
         et->root_bh, el with root_el accordingly.
      4. Make ocfs2_lock_allocators generic. Now it is limited to be only used
         in file extend allocation. But the whole function is useful when we want
         to store large EAs.
      Note: This patch doesn't touch ocfs2_commit_truncate() since it is not used
      for anything other than truncate inode data btrees.
      Signed-off-by: default avatarTao Ma <tao.ma@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
    • Tao Ma's avatar
      ocfs2: Use ocfs2_extent_list instead of ocfs2_dinode. · 811f933d
      Tao Ma authored
      ocfs2_extend_meta_needed(), ocfs2_calc_extend_credits() and
      ocfs2_reserve_new_metadata() are all useful for extent tree operations. But
      they are all limited to an inode btree because they use a struct
      ocfs2_dinode parameter. Change their parameter to struct ocfs2_extent_list
      (the part of an ocfs2_dinode they actually use) so that the xattr btree code
      can use these functions.
      Signed-off-by: default avatarTao Ma <tao.ma@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
    • Tao Ma's avatar
      ocfs2: Modify ocfs2_num_free_extents for future xattr usage. · 231b87d1
      Tao Ma authored
      ocfs2_num_free_extents() is used to find the number of free extent records
      in an inode btree. Hence, it takes an "ocfs2_dinode" parameter. We want to
      use this for extended attribute trees in the future, so genericize the
      interface the take a buffer head. A future patch will allow that buffer_head
      to contain any structure rooting an ocfs2 btree.
      Signed-off-by: default avatarTao Ma <tao.ma@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
  2. 03 Oct, 2008 1 commit
    • Mark Fasheh's avatar
      ocfs2: fiemap support · 00dc417f
      Mark Fasheh authored
      Plug ocfs2 into ->fiemap. Some portions of ocfs2_get_clusters() had to be
      refactored so that the extent cache can be skipped in favor of going
      directly to the on-disk records. This makes it easier for us to determine
      which extent is the last one in the btree. Also, I'm not sure we want to be
      caching fiemap lookups anyway as they're not directly related to data
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Cc: ocfs2-devel@oss.oracle.com
      Cc: linux-fsdevel@vger.kernel.org
  3. 12 Oct, 2007 2 commits
    • Mark Fasheh's avatar
      ocfs2: Write support for directories with inline data · 5b6a3a2b
      Mark Fasheh authored
      Create all new directories with OCFS2_INLINE_DATA_FL and the inline data
      bytes formatted as an empty directory. Inode size field reflects the actual
      amount of inline data available, which makes searching for dirent space
      very similar to the regular directory search.
      Inline-data directories are automatically pushed out to extents on any
      insert request which is too large for the available space.
      Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
      Reviewed-by: default avatarJoel Becker <joel.becker@oracle.com>
    • Mark Fasheh's avatar
      ocfs2: Write support for inline data · 1afc32b9
      Mark Fasheh authored
      This fixes up write, truncate, mmap, and RESVSP/UNRESVP to understand inline
      inode data.
      For the most part, the changes to the core write code can be relied on to do
      the heavy lifting. Any code calling ocfs2_write_begin (including shared
      writeable mmap) can count on it doing the right thing with respect to
      growing inline data to an extent tree.
      Size reducing truncates, including UNRESVP can simply zero that portion of
      the inode block being removed. Size increasing truncatesm, including RESVP
      have to be a little bit smarter and grow the inode to an extent tree if
      Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
      Reviewed-by: default avatarJoel Becker <joel.becker@oracle.com>
  4. 11 Jul, 2007 6 commits
  5. 26 Apr, 2007 4 commits
    • Mark Fasheh's avatar
      ocfs2: make room for unwritten extents flag · e48edee2
      Mark Fasheh authored
      Due to the size of our group bitmaps, we'll never have a leaf node extent
      record with more than 16 bits worth of clusters. Split e_clusters up so that
      leaf nodes can get a flags field where we can mark unwritten extents.
      Interior nodes whose length references all the child nodes beneath it can't
      split their e_clusters field, so we use a union to preserve sizing there.
      Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
    • Mark Fasheh's avatar
      ocfs2: zero tail of sparse files on truncate · 60b11392
      Mark Fasheh authored
      Since we don't zero on extend anymore, truncate needs to be fixed up to zero
      the part of a file between i_size and and end of it's cluster. Otherwise a
      subsequent extend could expose bad data.
      This introduced a new helper, which can be used in ocfs2_write().
      Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
    • Mark Fasheh's avatar
      ocfs2: temporarily remove extent map caching · 363041a5
      Mark Fasheh authored
      The code in extent_map.c is not prepared to deal with a subtree being
      rotated between lookups. This can happen when filling holes in sparse files.
      Instead of a lengthy patch to update the code (which would likely lose the
      benefit of caching subtree roots), we remove most of the algorithms and
      implement a simple path based lookup. A less ambitious extent caching scheme
      will be added in a later patch.
      Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
    • Mark Fasheh's avatar
      ocfs2: sparse b-tree support · dcd0538f
      Mark Fasheh authored
      Introduce tree rotations into the b-tree code. This will allow ocfs2 to
      support sparse files. Much of the added code is designed to be generic (in
      the ocfs2 sense) so that it can later be re-used to implement large
      extended attributes.
      This patch only adds the rotation code and does minimal updates to callers
      of the extent api.
      Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
  6. 02 Dec, 2006 1 commit
  7. 03 Jan, 2006 1 commit