From: Tao Ma <tm@tao.ma>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 9/9] Ocfs2: Handle refcounted extents when doing moving/defraging.
Date: Mon, 17 Jan 2011 15:41:21 +0800 [thread overview]
Message-ID: <4D33F2A1.3040900@tao.ma> (raw)
In-Reply-To: <1295248137-24363-1-git-send-email-tristan.ye@oracle.com>
On 01/17/2011 03:08 PM, Tristan Ye wrote:
> Tao, any thoughts?
ok, so in general it looks good. some comments are inlined.
>
> Signed-off-by: Tristan Ye<tristan.ye@oracle.com>
> ---
> fs/ocfs2/move_extents.c | 112 +++++++++++++++++++++++++++++++++++++++++-----
> 1 files changed, 99 insertions(+), 13 deletions(-)
>
> diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c
> index dd5b995..c0f0ae8 100644
> --- a/fs/ocfs2/move_extents.c
> +++ b/fs/ocfs2/move_extents.c
> @@ -319,20 +338,48 @@ out:
> static int ocfs2_defrag_extent(struct ocfs2_move_extents_context *context,
> u32 cpos, u32 phys_cpos, u32 len, int ext_flags)
> {
> - int ret, credits = 0;
> + int ret, credits = 0, extra_blocks = 0;
> handle_t *handle;
> struct inode *inode = context->inode;
> struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
> struct inode *tl_inode = osb->osb_tl_inode;
> + struct ocfs2_refcount_tree *ref_tree = NULL;
> u32 new_phys_cpos, new_len;
> + u64 phys_blkno = ocfs2_clusters_to_blocks(inode->i_sb, phys_cpos);
> +
> + if ((ext_flags& OCFS2_EXT_REFCOUNTED)&& len) {
So you do the check of 'len' here and we do have a chance of 'len = 0'?
if yes, mayber just something like
if (!len)
return 0;
should be put at the begining of the function.
> +
> + BUG_ON(!(OCFS2_I(inode)->ip_dyn_features&
> + OCFS2_HAS_REFCOUNT_FL));
> +
> + BUG_ON(!context->refcount_loc);
> +
> + ret = ocfs2_lock_refcount_tree(osb, context->refcount_loc, 1,
> + &ref_tree, NULL);
> + if (ret) {
> + mlog_errno(ret);
> + return ret;
> + }
> +
> + ret = ocfs2_prepare_refcount_change_for_del(inode,
> + context->refcount_loc,
> + phys_blkno,
> + len,
> + &credits,
> + &extra_blocks);
> + if (ret) {
> + mlog_errno(ret);
> + goto out;
> + }
> + }
>
> ret = ocfs2_lock_allocators_move_extents(inode,&context->et, len, 1,
> &context->meta_ac,
> &context->data_ac,
> - 0,&credits);
> + extra_blocks,&credits);
So your lock_allocators_move_extents can handle the case of changing 0
-> extra_blocks and not *reset* credits, right?
> if (ret) {
> mlog_errno(ret);
> - return ret;
> + goto out;
> }
>
> /*
Regards,
Tao
next prev parent reply other threads:[~2011-01-17 7:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-17 7:08 [Ocfs2-devel] [PATCH 9/9] Ocfs2: Handle refcounted extents when doing moving/defraging Tristan Ye
2011-01-17 7:41 ` Tao Ma [this message]
2011-01-17 7:52 ` Tristan Ye
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=4D33F2A1.3040900@tao.ma \
--to=tm@tao.ma \
--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).