ocfs2-devel.oss.oracle.com archive mirror
 help / color / mirror / Atom feed
From: Joel Becker <Joel.Becker@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 1/4] Ocfs2: Optimize truncting codes for ocfs2 to use ocfs2_remove_btree_range instead.
Date: Mon, 10 May 2010 12:40:06 -0700	[thread overview]
Message-ID: <20100510194006.GA2836@mail.oracle.com> (raw)
In-Reply-To: <1273128618-4184-1-git-send-email-tristan.ye@oracle.com>

On Thu, May 06, 2010 at 02:50:15PM +0800, Tristan Ye wrote:
> The patch has been tested normally for sanity check, stress tests with heavier workload
> will be expected.

	The patch looks functionally good.  A couple housekeeping
comments.

> +static int ocfs2_reserve_blocks_for_rec_trunc(struct inode *inode,
> +					      struct ocfs2_extent_tree *et,
> +					      u32 extents_to_split,
> +					      struct ocfs2_alloc_context **ac,
> +					      int extra_blocks)
> +{
> +	int ret = 0, num_free_extents, blocks = extra_blocks;
> +	unsigned int max_recs_needed = 2 * extents_to_split;
> +	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
> +
> +	*ac = NULL;
> +
> +	num_free_extents = ocfs2_num_free_extents(osb, et);
> +	if (num_free_extents < 0) {
> +		ret = num_free_extents;
> +		mlog_errno(ret);
> +		goto out;
> +	}
> +
> +	if (!num_free_extents ||
> +	    (ocfs2_sparse_alloc(osb) && num_free_extents < max_recs_needed))
> +		blocks += ocfs2_extend_meta_needed(et->et_root_el);

	You don't need the blocks variable.  Just use extra_blocks here.
Save us a word on the stack.

>  int ocfs2_remove_btree_range(struct inode *inode,
>  			     struct ocfs2_extent_tree *et,
>  			     u32 cpos, u32 phys_cpos, u32 len,

	Move flags here:     u32 cpos, u32 phys_cpos, u32 len, int flags,

> -			     struct ocfs2_cached_dealloc_ctxt *dealloc)
> +			     struct ocfs2_cached_dealloc_ctxt *dealloc,
> +			     u64 refcount_loc, int flags)

It fits with the tuple representing the extent range.

> diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
> index 33dd2a1..cabdcf8 100644
> --- a/fs/ocfs2/refcounttree.c
> +++ b/fs/ocfs2/refcounttree.c
> @@ -2508,21 +2508,20 @@ out:
>   * we gonna touch and whether we need to create new blocks.
>   *
>   * Normally the refcount blocks store these refcount should be
> - * contiguous also, so that we can get the number easily.
> - * As for meta_ac, we will at most add split 2 refcount record and
> - * 2 more refcount block, so just check it in a rough way.
> + * continguous also, so that we can get the number easily.

	Whoops, you misspelled 'contiguous' here.

Joel

-- 

"You cannot bring about prosperity by discouraging thrift. You cannot
 strengthen the weak by weakening the strong. You cannot help the wage
 earner by pulling down the wage payer. You cannot further the
 brotherhood of man by encouraging class hatred. You cannot help the
 poor by destroying the rich. You cannot build character and courage by
 taking away a man's initiative and independence. You cannot help men
 permanently by doing for them what they could and should do for
 themselves."
	- Abraham Lincoln 

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127

  parent reply	other threads:[~2010-05-10 19:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-06  6:50 [Ocfs2-devel] [PATCH 1/4] Ocfs2: Optimize truncting codes for ocfs2 to use ocfs2_remove_btree_range instead Tristan Ye
2010-05-06  6:50 ` [Ocfs2-devel] [PATCH 2/4] Ocfs2: Fix punching hole codes to correctly do CoW during cluster zeroing Tristan Ye
2010-05-06  6:50 ` [Ocfs2-devel] [PATCH 3/4] Ocfs2: Make ocfs2_find_cpos_for_left_leaf() public Tristan Ye
2010-05-06  6:50 ` [Ocfs2-devel] [PATCH 4/4] Ocfs2: Optimize punching-hole codes v5 Tristan Ye
2010-05-10 19:40 ` Joel Becker [this message]
2010-05-11  1:29   ` [Ocfs2-devel] [PATCH 1/4] Ocfs2: Optimize truncting codes for ocfs2 to use ocfs2_remove_btree_range instead tristan
  -- strict thread matches above, loose matches on Subject: below --
2010-05-11  8:10 [Ocfs2-devel] [PATCH 0/4] Patches series for optimization of truncating and punching-hole Tristan Ye
2010-05-11  8:10 ` [Ocfs2-devel] [PATCH 1/4] Ocfs2: Optimize truncting codes for ocfs2 to use ocfs2_remove_btree_range instead Tristan Ye
2010-05-11  9:53 [Ocfs2-devel] [PATCH 0/4] Patches series for optimization of truncating and punching-hole Tristan Ye
2010-05-11  9:53 ` [Ocfs2-devel] [PATCH 1/4] Ocfs2: Optimize truncting codes for ocfs2 to use ocfs2_remove_btree_range instead Tristan Ye
2010-05-11  9:54 [Ocfs2-devel] [PATCH 0/4] Patches series for optimization of truncating and punching-hole Tristan Ye
2010-05-11  9:54 ` [Ocfs2-devel] [PATCH 1/4] Ocfs2: Optimize truncting codes for ocfs2 to use ocfs2_remove_btree_range instead Tristan Ye
2010-05-18 18:50   ` Mark Fasheh
2010-05-19  2:00     ` tristan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100510194006.GA2836@mail.oracle.com \
    --to=joel.becker@oracle.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).