1. 08 9月, 2010 1 次提交
  2. 19 5月, 2010 2 次提交
    • T
      Ocfs2: Make ocfs2_find_cpos_for_left_leaf() public. · ee149a7c
      Tristan Ye 提交于
      The original idea to pull ocfs2_find_cpos_for_left_leaf() out of
      alloc.c is to benefit punching-holes optimization patch, it however,
      can also be referred by other funcs in the future who want to do the
      same job.
      Signed-off-by: NTristan Ye <tristan.ye@oracle.com>
      Acked-by: NMark Fasheh <mfasheh@suse.com>
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      ee149a7c
    • T
      Ocfs2: Optimize ocfs2 truncate to use ocfs2_remove_btree_range() instead. · 78f94673
      Tristan Ye 提交于
      Truncate is just a special case of punching holes(from new i_size to
      end), we therefore could take advantage of the existing
      ocfs2_remove_btree_range() to reduce the comlexity and redundancy in
      alloc.c.  The goal here is to make truncate more generic and
      straightforward.
      
      Several functions only used by ocfs2_commit_truncate() will smiply be
      removed.
      
      ocfs2_remove_btree_range() was originally used by the hole punching
      code, which didn't take refcount trees into account (definitely a bug).
      We therefore need to change that func a bit to handle refcount trees.
      It must take the refcount lock, calculate and reserve blocks for
      refcount tree changes, and decrease refcounts at the end.  We replace 
      ocfs2_lock_allocators() here by adding a new func
      ocfs2_reserve_blocks_for_rec_trunc() which accepts some extra blocks to
      reserve.  This will not hurt any other code using
      ocfs2_remove_btree_range() (such as dir truncate and hole punching).
      
      I merged the following steps into one patch since they may be
      logically doing one thing, though I know it looks a little bit fat
      to review.
      
      1). Remove redundant code used by ocfs2_commit_truncate(), since we're
          moving to ocfs2_remove_btree_range anyway.
      
      2). Add a new func ocfs2_reserve_blocks_for_rec_trunc() for purpose of
          accepting some extra blocks to reserve.
      
      3). Change ocfs2_prepare_refcount_change_for_del() a bit to fit our
          needs.  It's safe to do this since it's only being called by
          truncate.
      
      4). Change ocfs2_remove_btree_range() a bit to take refcount case into
          account.
      
      5). Finally, we change ocfs2_commit_truncate() to call
          ocfs2_remove_btree_range() in a proper way.
      
      The patch has been tested normally for sanity check, stress tests
      with heavier workload will be expected.
      
      Based on this patch, fixing the punching holes bug will be fairly easy.
      Signed-off-by: NTristan Ye <tristan.ye@oracle.com>
      Acked-by: NMark Fasheh <mfasheh@suse.com>
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      78f94673
  3. 06 5月, 2010 3 次提交
    • 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
    • M
      ocfs2: use allocation reservations during file write · 4fe370af
      Mark Fasheh 提交于
      Add a per-inode reservations structure and pass it through to the
      reservations code.
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      4fe370af
    • 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
  4. 22 3月, 2010 1 次提交
  5. 26 3月, 2010 1 次提交
  6. 06 5月, 2010 1 次提交
  7. 05 3月, 2010 1 次提交
    • C
      dquot: cleanup space allocation / freeing routines · 5dd4056d
      Christoph Hellwig 提交于
      Get rid of the alloc_space, free_space, reserve_space, claim_space and
      release_rsv dquot operations - they are always called from the filesystem
      and if a filesystem really needs their own (which none currently does)
      it can just call into it's own routine directly.
      
      Move shared logic into the common __dquot_alloc_space,
      dquot_claim_space_nodirty and __dquot_free_space low-level methods,
      and rationalize the wrappers around it to move as much as possible
      code into the common block for CONFIG_QUOTA vs not.  Also rename
      all these helpers to be named dquot_* instead of vfs_dq_*.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJan Kara <jack@suse.cz>
      5dd4056d
  8. 27 2月, 2010 1 次提交
  9. 17 12月, 2009 1 次提交
  10. 04 12月, 2009 1 次提交
  11. 03 12月, 2009 1 次提交
    • T
      ocfs2: Find proper end cpos for a leaf refcount block. · 38a04e43
      Tao Ma 提交于
      ocfs2 refcount tree is stored as an extent tree while
      the leaf ocfs2_refcount_rec points to a refcount block.
      
      The following step can trip a kernel panic.
      mkfs.ocfs2 -b 512 -C 1M --fs-features=refcount $DEVICE
      mount -t ocfs2 $DEVICE $MNT_DIR
      FILE_NAME=$RANDOM
      FILE_NAME_1=$RANDOM
      FILE_REF="${FILE_NAME}_ref"
      FILE_REF_1="${FILE_NAME}_ref_1"
      for((i=0;i<305;i++))
      do
      # /mnt/1048576 is a file with 1048576 sizes.
      cat /mnt/1048576 >> $MNT_DIR/$FILE_NAME
      cat /mnt/1048576 >> $MNT_DIR/$FILE_NAME_1
      done
      for((i=0;i<3;i++))
      do
      cat /mnt/1048576 >> $MNT_DIR/$FILE_NAME
      done
      
      for((i=0;i<2;i++))
      do
      cat /mnt/1048576 >> $MNT_DIR/$FILE_NAME
      cat /mnt/1048576 >> $MNT_DIR/$FILE_NAME_1
      done
      
      cat /mnt/1048576 >> $MNT_DIR/$FILE_NAME
      
      for((i=0;i<11;i++))
      do
      cat /mnt/1048576 >> $MNT_DIR/$FILE_NAME
      cat /mnt/1048576 >> $MNT_DIR/$FILE_NAME_1
      done
      reflink $MNT_DIR/$FILE_NAME $MNT_DIR/$FILE_REF
      # write_f is a program which will write some bytes to a file at offset.
      # write_f -f file_name -l offset -w write_bytes.
      ./write_f -f $MNT_DIR/$FILE_REF -l $[310*1048576] -w 4096
      ./write_f -f $MNT_DIR/$FILE_REF -l $[306*1048576] -w 4096
      ./write_f -f $MNT_DIR/$FILE_REF -l $[311*1048576] -w 4096
      ./write_f -f $MNT_DIR/$FILE_NAME -l $[310*1048576] -w 4096
      ./write_f -f $MNT_DIR/$FILE_NAME -l $[311*1048576] -w 4096
      reflink $MNT_DIR/$FILE_NAME $MNT_DIR/$FILE_REF_1
      ./write_f -f $MNT_DIR/$FILE_NAME -l $[311*1048576] -w 4096
      #kernel panic here.
      
      The reason is that if the ocfs2_extent_rec is the last record
      in a leaf extent block, the old solution fails to find the
      suitable end cpos. So this patch try to walk through the b-tree,
      find the next sub root and get the c_pos the next sub-tree starts
      from.
      
      btw, I have runned tristan's test case against the patched kernel
      for several days and this type of kernel panic never happens again.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      38a04e43
  12. 23 9月, 2009 10 次提交
    • T
      ocfs2: Make transaction extend more efficient. · c18b812d
      Tao Ma 提交于
      In ocfs2_extend_rotate_transaction, op_credits is the orignal
      credits in the handle and we only want to extend the credits
      for the rotation, but the old solution always double it. It
      is harmless for some minor operations, but for actions like
      reflink we may rotate tree many times and cause the credits
      increase dramatically. So this patch try to only increase
      the desired credits.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      c18b812d
    • T
      ocfs2: CoW refcount tree improvement. · 6ae23c55
      Tao Ma 提交于
      During CoW, if the old extent record is refcounted, we allocate
      som new clusters and do CoW. Actually we can have some improvement
      here. If the old extent has refcount=1, that means now it is only
      used by this file. So we don't need to allocate new clusters, just
      remove the refcounted flag and it is OK. We also have to remove
      it from the refcount tree while not deleting it.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      6ae23c55
    • T
      ocfs2: Add CoW support. · 6f70fa51
      Tao Ma 提交于
      This patch try CoW support for a refcounted record.
      
      the whole process will be:
      1. Calculate how many clusters we need to CoW and where we start.
         Extents that are not completely encompassed by the write will
         be broken on 1MB boundaries.
      2. Do CoW for the clusters with the help of page cache.
      3. Change the b-tree structure with the new allocated clusters.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      6f70fa51
    • T
      ocfs2: Decrement refcount when truncating refcounted extents. · bcbbb24a
      Tao Ma 提交于
      Add 'Decrement refcount for delete' in to the normal truncate
      process. So for a refcounted extent record, call refcount rec
      decrementation instead of cluster free.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      bcbbb24a
    • T
      ocfs2: Add functions for extents refcounted. · 1aa75fea
      Tao Ma 提交于
      Add function ocfs2_mark_extent_refcounted which can mark
      an extent refcounted.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      1aa75fea
    • T
      ocfs2: Add support of decrementing refcount for delete. · 1823cb0b
      Tao Ma 提交于
          Given a physical cpos and length, decrement the refcount
      in the tree. If the refcount for any portion of the extent goes
      to zero, that portion is queued for freeing.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      1823cb0b
    • T
      ocfs2: move tree path functions to alloc.h. · e2e9f608
      Tao Ma 提交于
      Now fs/ocfs2/alloc.c has more than 7000 lines. It contains our
      basic b-tree operation. Although we have already make our b-tree
      operation generic, the basic structrue ocfs2_path which is used
      to iterate one b-tree branch is still static and limited to only
      used in alloc.c. As refcount tree need them and I don't want to
      add any more b-tree unrelated code to alloc.c, export them out.
      
      Signed-off-by: Tao Ma <tao.ma@oracle.com> 
      e2e9f608
    • T
      ocfs2: Add refcount b-tree as a new extent tree. · fe924415
      Tao Ma 提交于
      Add refcount b-tree as a new extent tree so that it can
      use the b-tree to store and maniuplate ocfs2_refcount_rec.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      fe924415
    • T
      ocfs2: Abstract extent split process. · 555936bf
      Tao Ma 提交于
      ocfs2_mark_extent_written actually does the following things:
      1. check the parameters.
      2. initialize the left_path and split_rec.
      3. call __ocfs2_mark_extent_written. it will do:
         1) check the flags of unwritten
         2) do the real split work.
      The whole process is packed tightly somehow. So this patch
      will abstract 2 different functions so that future b-tree
      operation can work with it.
      
      1. __ocfs2_split_extent will accept path and split_rec and do
        the real split work.
      2. ocfs2_change_extent_flag will accept a new flag and initialize
         path and split_rec.
      
      So now ocfs2_mark_extent_written will do:
      1. check the parameters.
      2. call ocfs2_change_extent_flag.
         1) initalize the left_path and split_rec.
         2) check whether the new flags conflict with the old one.
         3) call __ocfs2_split_extent to do the split.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      555936bf
    • T
      ocfs2: Wrap ocfs2_extent_contig in ocfs2_extent_tree. · 853a3a14
      Tao Ma 提交于
      Add a new operation eo_ocfs2_extent_contig int the extent tree's
      operations vector. So that with the new refcount tree, We want
      this so that refcount trees can always return CONTIG_NONE and
      prevent extent merging.
      Signed-off-by: NTao Ma <tao.ma@oracle.com>
      853a3a14
  13. 05 9月, 2009 16 次提交