[Ocfs2-devel] [PATCH v2] ocfs2: Don't duplicate page passes i_size during CoW.

Joel Becker Joel.Becker at oracle.com
Tue Jul 13 11:38:29 PDT 2010


On Tue, Jul 13, 2010 at 10:25:53PM +0800, Tao Ma wrote:
> Joel Becker wrote:
> >	Why even worry about that?  We only need up to i_size.  If end
> >is safe and not page aligned, so is i_size.
> i_size isn't safe in ocfs2_duplicate_clusters_by_page. Check the
> below function.
> 
>            if (page_has_buffers(page)) {
>                        ret = walk_page_buffers(handle, page_buffers(page),
>                                                from, to, &partial,
>                                                ocfs2_clear_cow_buffer);
>                        if (ret) {
>                                mlog_errno(ret);
>                                goto unlock;
>                        }
>                }
> So 'to' is limited to 'map_end' and then 'end'. If we set 'end' to
> i_size, we may not clear all the buffer heads

	We don't need to clear all the buffer heads.  This is the same
as the logic in block_prepare_write().  We only need to clear the blocks
that encompass i_size.  Unless we did something wrong, the buffers past
i_size should not be mapped.
	More importantly, your 'end' has the same layout.  If end is not
page aligned, it will only clear some of the blocks in its page.  Which
is fine.  There's no difference between end and i_size - they don't have
to fall on page boundaries.

Joel

-- 

"Here's something to think about:  How come you never see a headline
 like ``Psychic Wins Lottery''?"
	- Jay Leno

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



More information about the Ocfs2-devel mailing list