All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Becker <Joel.Becker@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 2/2] ocfs2: Adjust rightmost path in ocfs2_add_branch.
Date: Fri, 12 Jun 2009 14:56:04 -0700	[thread overview]
Message-ID: <20090612215604.GF22662@mail.oracle.com> (raw)
In-Reply-To: <1244787516-13475-2-git-send-email-tao.ma@oracle.com>

On Fri, Jun 12, 2009 at 02:18:36PM +0800, Tao Ma wrote:
> @@ -998,6 +1052,27 @@ static int ocfs2_add_branch(struct ocfs2_super *osb,
>  
>  	new_blocks = le16_to_cpu(el->l_tree_depth);
>  
> +	eb = (struct ocfs2_extent_block *)(*last_eb_bh)->b_data;
> +	new_cpos = ocfs2_sum_rightmost_rec(&eb->h_list);
> +	root_end = ocfs2_sum_rightmost_rec(et->et_root_el);
> +
> +	/*
> +	 * If there is a gap before the root end and the real end
> +	 * of the righmost leaf block, we need to remove the gap
> +	 * between new_cpos and root_end first so that the tree
> +	 * is consistent after we add a new branch(it will start
> +	 * from new_cpos).
> +	 */
> +	if (root_end > new_cpos) {
> +		mlog(0, "adjust the cluster end from %u to %u\n",
> +		     root_end, new_cpos);
> +		status = ocfs2_adjust_rightmost_branch(handle, inode, et);
> +		if (status) {
> +			mlog_errno(status);
> +			goto bail;
> +		}
> +	}
> +
>  	/* allocate the number of new eb blocks we need */
>  	new_eb_bhs = kcalloc(new_blocks, sizeof(struct buffer_head *),
>  			     GFP_KERNEL);

	Yeah, this is nice and clean.

Joel

-- 

"Senator let's be sincere,
 As much as you can."

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

      parent reply	other threads:[~2009-06-12 21:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-12 15:03 [Ocfs2-devel] [PATCH 0/2] ocfs2: Adjust rightmost path in ocfs2_add_branch.v2 Tao Ma
2009-06-12  6:18 ` [Ocfs2-devel] [PATCH 1/2] ocfs2: return EROFS instead of BUG in ocfs2_insert_at_leaf Tao Ma
2009-06-12 21:42   ` Joel Becker
2009-06-12  6:18 ` [Ocfs2-devel] [PATCH 2/2] ocfs2: Adjust rightmost path in ocfs2_add_branch Tao Ma
2009-06-12 16:13   ` Mark Fasheh
2009-06-12 21:56   ` Joel Becker [this message]

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=20090612215604.GF22662@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.