All of lore.kernel.org
 help / color / mirror / Atom feed
From: TaoMa <tao.ma@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 2/2] Ocfs2: Fix punching hole codes to correctly do CoW during cluster zeroing.
Date: Tue, 02 Feb 2010 06:13:38 +0800	[thread overview]
Message-ID: <4B675212.7080706@oracle.com> (raw)
In-Reply-To: <1265020173-14623-2-git-send-email-tristan.ye@oracle.com>

Hi Tristan,
Tristan Ye wrote:
> Based on the former patch of truncating optimization, bugfix for refcount on
> punching holes can be fairly easy and straightforward since most of work we
> should take into account for refcounting have been completed already in func
> ocfs2_remove_btree_range(), which is also being used by our truncating codes.
>
> The patch just did CoW for reflinks when a hole is being punched whose start
> and end offset were within one cluster, which means partial zeroing for a cluster
> will be performed soon.
>
> The patch has been tested fixing the following bug:
>
> http://oss.oracle.com/bugzilla/show_bug.cgi?id=1216
>
> Signed-off-by: Tristan Ye <tristan.ye@oracle.com>
> ---
>  fs/ocfs2/file.c |   21 +++++++++++++++++++++
>  1 files changed, 21 insertions(+), 0 deletions(-)
>
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index e0c9d1c..bb15a1e 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -1458,6 +1458,27 @@ static int ocfs2_remove_inode_range(struct inode *inode,
>  		goto out;
>  	}
>  
> +	/*
> +	 * For reflinks, we may need to CoW 2 clusters which might be
> +	 * partially zero'd later, if hole's start and end offset were
> +	 * within one cluster(means is not exactly aligned to clustersize).
> +	 */
> +
> +	if (OCFS2_I(inode)->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL) {
> +
> +		ret = ocfs2_cow_file_pos(inode, di_bh, byte_start);
> +		if (ret) {
> +			mlog_errno(ret);
> +			goto out;
> +		}
> +
> +		ret = ocfs2_cow_file_pos(inode, di_bh, byte_start + byte_len);
> +		if (ret) {
> +			mlog_errno(ret);
> +			goto out;
> +		}
> +	}
> +
>   
If the bytes_start and bytes_sart + byte_len are in alignment with 
cluster size, we don't need to do CoW.

Regards,
Tao

  reply	other threads:[~2010-02-01 22:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-01 10:29 [Ocfs2-devel] [PATCH 1/2] Ocfs2: Optimize truncting codes for ocfs2 to use ocfs2_remove_btree_range instead Tristan Ye
2010-02-01 10:29 ` [Ocfs2-devel] [PATCH 2/2] Ocfs2: Fix punching hole codes to correctly do CoW during cluster zeroing Tristan Ye
2010-02-01 22:13   ` TaoMa [this message]
2010-02-02  1:24     ` tristan
2010-02-01 22:20 ` [Ocfs2-devel] [PATCH 1/2] Ocfs2: Optimize truncting codes for ocfs2 to use ocfs2_remove_btree_range instead TaoMa
2010-02-02  1:32   ` tristan
  -- strict thread matches above, loose matches on Subject: below --
2010-02-05 10:45 Tristan Ye
2010-02-05 10:45 ` [Ocfs2-devel] [PATCH 2/2] Ocfs2: Fix punching hole codes to correctly do CoW during cluster zeroing Tristan Ye
2010-02-06  0:32   ` Tao Ma
2010-02-09  0:50   ` Joel Becker
2010-02-08 10:51 [Ocfs2-devel] [PATCH 1/2] Ocfs2: Optimize truncting codes for ocfs2 to use ocfs2_remove_btree_range instead Tristan Ye
2010-02-08 10:51 ` [Ocfs2-devel] [PATCH 2/2] Ocfs2: Fix punching hole codes to correctly do CoW during cluster zeroing 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=4B675212.7080706@oracle.com \
    --to=tao.ma@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.