Re: linux-next: manual merge of the cleancache tree with Linus' tree

From: Minchan Kim
Date: Thu Mar 24 2011 - 01:58:13 EST


On Thu, Mar 24, 2011 at 2:38 PM, Minchan Kim <minchan.kim@xxxxxxxxx> wrote:
> On Thu, Mar 24, 2011 at 12:56 PM, Andrew Morton
> <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>> On Thu, 24 Mar 2011 13:55:24 +1100 Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> wrote:
>>
>>> Hi Dan,
>>>
>>> Today's linux-next merge of the cleancache tree got a conflict in
>>> mm/truncate.c between commit 5adc7b518b54 ("mm: truncate: change
>>> remove_from_page_cache") from Linus' tree and commit 03e838947c8a
>>> ("mm/fs: add hooks to support cleancache") from the cleancache tree.
>>>
>>> I fixed it up (see below) but am really not sure of the fix. ÂI can carry
>>> this fix as necessary.
>>>
>>> Is this stuff going to be merged into Linus' tree this time round?
>>> --
>>> Cheers,
>>> Stephen Rothwell          Âsfr@xxxxxxxxxxxxxxxx
>>>
>>> diff --cc mm/truncate.c
>>> index a956675,cd94607..0000000
>>> --- a/mm/truncate.c
>>> +++ b/mm/truncate.c
>>> @@@ -106,8 -108,13 +108,12 @@@ truncate_complete_page(struct address_s
>>> Â Â Â cancel_dirty_page(page, PAGE_CACHE_SIZE);
>>>
>>> Â Â Â clear_page_mlock(page);
>>> Â- Â Âremove_from_page_cache(page);
>>> Â Â Â ClearPageMappedToDisk(page);
>>> Â+ Â Âdelete_from_page_cache(page);
>>> + Â Â /* this must be after the remove_from_page_cache which
>>> + Â Â Â* calls cleancache_put_page (and note page->mapping is now NULL)
>>> + Â Â Â*/
>>> + Â Â cleancache_flush_page(mapping, page);
>>> Â- Â Âpage_cache_release(page); Â Â Â /* pagecache ref */
>>> Â Â Â return 0;
>>> Â }
>>
>> I did the cleancache_flush_page() before the delete_from_page_cache(),
>> in case the delete_from_page_cache() freed the page. ÂI didn't actually
>> check whether that makes sense though.
>
> I am not sure cleancache's put and flush semantic.
> If I understand rightly with old __remove_from_page_cache's comment,
> maybe cleancache_flush_page is to invalidate the page.(If I understand
> right, I hope the name is changed to cleancache_invalidate_page)
>
> " Â Â Â Â/*
> Â Â Â Â * if we're uptodate, flush out into the cleancache, otherwise
> Â Â Â Â * invalidate any existing cleancache entries. ÂWe can't leave
> Â Â Â Â * stale data around in the cleancache once our page is gone
> Â Â Â Â */
> Â Â Â Âif (PageUptodate(page))
> Â Â Â Â Â Â Â Âcleancache_put_page(page);
> Â Â Â Âelse
> Â Â Â Â Â Â Â Âcleancache_flush_page(mapping, page); "
>
> So I think cleancache_flush_page should be done after
> delete_from_page_cache because delete_from_page_cache calls
> cleancache_put_page(maybe this function would flush the content of
> memory into cleancache's target) before we invalidates the page.
>
> And it should not be a problem in case the delete_from_page_cache
> freed the page since cleancache should have a reference the page but I
> didn't check cleancahe always has a reference of page. If it isn't,
> it's a critical problem.
>
> Dan, Could you comment this?

Dan, one more thing.

#define cleancache_fs_enabled_mapping(_mapping) \
(mapping->host->i_sb->cleancache_poolid >= 0)

One is "_mapping", another is "mapping"


--
Kind regards,
Minchan Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/