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

Tao Ma tao.ma at oracle.com
Tue Jul 13 17:29:10 PDT 2010


Joel Becker wrote:
> 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.
>   
oh, I see.
block_read_full_page will only map and read the blocks within i_size, cool.
Then end = i_size should work fine.
I will test it and then send a final one(hope so ;))
Thanks for pointing it out.

Regards,
Tao



More information about the Ocfs2-devel mailing list