[Ocfs2-devel] [PATCH v2] ocfs2: Don't duplicate page passes i_size during CoW.
Tao Ma
tao.ma at oracle.com
Tue Jul 13 07:25:53 PDT 2010
Joel Becker wrote:
> On Tue, Jul 13, 2010 at 01:13:06AM -0700, Joel Becker wrote:
>
>> On Tue, Jul 13, 2010 at 11:22:32AM +0800, Tao Ma wrote:
>>
>>> + /*
>>> + * We only duplicate pages until we reach i_size.
>>> + * So trim 'end' to the boundary of that page.
>>> + */
>>> + if (end > i_size_read(context->inode))
>>> + end = ((i_size_read(context->inode) + PAGE_CACHE_SIZE - 1) >>
>>> + PAGE_CACHE_SHIFT) << PAGE_CACHE_SHIFT;
>>>
>
> 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
since walk_page_buffers will only call ocfs2_clear_cow_buffer within
from and to.
Maybe we can improve it somehow later, but I would leave it as-is now.
Regards,
Tao
More information about the Ocfs2-devel
mailing list