[Ocfs2-devel] [PATCH v5] ocfs2: Don't duplicate page passes i_size during CoW.
tristan
tristan.ye at oracle.com
Wed Jul 14 18:15:24 PDT 2010
Tested-by: Tristan Ye <tristan.ye at oracle.com>
Tao Ma wrote:
> During CoW, actually all the pages after i_size contains
> garbage data, so don't read and duplicate them.
>
> Signed-off-by: Tao Ma <tao.ma at oracle.com>
> ---
> fs/ocfs2/refcounttree.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
> index 1cf9cda..5e03db2 100644
> --- a/fs/ocfs2/refcounttree.c
> +++ b/fs/ocfs2/refcounttree.c
> @@ -2931,6 +2931,12 @@ static int ocfs2_duplicate_clusters_by_page(handle_t *handle,
>
> offset = ((loff_t)cpos) << OCFS2_SB(sb)->s_clustersize_bits;
> end = offset + (new_len << OCFS2_SB(sb)->s_clustersize_bits);
> + /*
> + * We only duplicate pages until we reach the page contains i_size - 1.
> + * So trim 'end' to i_size.
> + */
> + if (end > i_size_read(context->inode))
> + end = i_size_read(context->inode);
>
> while (offset < end) {
> page_index = offset >> PAGE_CACHE_SHIFT;
More information about the Ocfs2-devel
mailing list