From: Xiaowei.hu <xiaowei.hu@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2: ensure journalaccess/journaldirty pairs don't cross journal restarting --ocfs2_rotate_subtree_left
Date: Thu, 12 Jan 2012 15:32:16 +0800 [thread overview]
Message-ID: <4F0E8C80.2010001@oracle.com> (raw)
In-Reply-To: <201111040359.pA43x9wm007354@acsmt357.oracle.com>
How about this patch? Could anyone comment on it?
On 11/04/2011 11:59 AM, Wengang Wang wrote:
> journalaccess/journaldirty pairs shouldn't cross journal restarting.
> Function ocfs2_rotate_subtree_left() violates this rule. This patch tries
> to fix it.
>
> 1) adding a extra journal access before modifying the tree root. (see
> comment in patch it's self)
>
> 2) moving ocfs2_remove_empty_extent(left_leaf_el) priror, so that
> ocfs2_journal_dirty(handle, path_leaf_bh(left_path)) can take care of it.
> (before the change, seems there is a miss of not putting left_leaf_el to
> journal in del_right_subtree case.
>
> Signed-off-by: Wengang Wang<wen.gang.wang@oracle.com>
> ---
> fs/ocfs2/alloc.c | 36 +++++++++++++++---------------------
> 1 files changed, 15 insertions(+), 21 deletions(-)
>
> diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
> index ed553c6..ace7aa2 100644
> --- a/fs/ocfs2/alloc.c
> +++ b/fs/ocfs2/alloc.c
> @@ -2708,20 +2708,8 @@ static int ocfs2_rotate_subtree_left(handle_t *handle,
> }
>
> if (eb->h_next_leaf_blk == 0ULL&&
> - le16_to_cpu(right_leaf_el->l_next_free_rec) == 1) {
> - /*
> - * We have to update i_last_eb_blk during the meta
> - * data delete.
> - */
> - ret = ocfs2_et_root_journal_access(handle, et,
> - OCFS2_JOURNAL_ACCESS_WRITE);
> - if (ret) {
> - mlog_errno(ret);
> - goto out;
> - }
> -
> + le16_to_cpu(right_leaf_el->l_next_free_rec) == 1)
> del_right_subtree = 1;
> - }
>
> /*
> * Getting here with an empty extent in the right path implies
> @@ -2762,7 +2750,10 @@ static int ocfs2_rotate_subtree_left(handle_t *handle,
> ocfs2_rotate_leaf(left_leaf_el,&right_leaf_el->l_recs[0]);
> memset(&right_leaf_el->l_recs[0], 0,
> sizeof(struct ocfs2_extent_rec));
> + } else {
> + ocfs2_remove_empty_extent(left_leaf_el);
> }
> +
> if (eb->h_next_leaf_blk == 0ULL) {
> /*
> * Move recs over to get rid of empty extent, decrease
> @@ -2786,17 +2777,20 @@ static int ocfs2_rotate_subtree_left(handle_t *handle,
> goto out;
> }
>
> - eb = (struct ocfs2_extent_block *)path_leaf_bh(left_path)->b_data;
> - ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno));
> -
> /*
> - * Removal of the extent in the left leaf was skipped
> - * above so we could delete the right path
> - * 1st.
> + * journal can just restarted in ocfs2_update_edge_lengths.
> + * we have to re-access the tree root. We still has an credit
> + * reserved for the tree root.
> */
> - if (right_has_empty)
> - ocfs2_remove_empty_extent(left_leaf_el);
> + ret = ocfs2_et_root_journal_access(handle, et,
> + OCFS2_JOURNAL_ACCESS_WRITE);
> + if (ret) {
> + mlog_errno(ret);
> + goto out;
> + }
>
> + eb = (struct ocfs2_extent_block *)path_leaf_bh(left_path)->b_data;
> + ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno));
> ocfs2_journal_dirty(handle, et_root_bh);
>
> *deleted = 1;
prev parent reply other threads:[~2012-01-12 7:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-04 3:59 [Ocfs2-devel] [PATCH] ocfs2: ensure journalaccess/journaldirty pairs don't cross journal restarting --ocfs2_rotate_subtree_left Wengang Wang
2012-01-12 7:32 ` Xiaowei.hu [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=4F0E8C80.2010001@oracle.com \
--to=xiaowei.hu@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.