Re: [Ext2-devel] Bufferheads & page-cache reference
From: Sonny Rao <hidden>
Date: 2005-02-14 19:45:32
On Mon, Feb 14, 2005 at 11:30:16AM -0800, Badari Pulavarty wrote:
Hi,,
I am trying to understand interactions between filesystem pagecache
pages & bufferhead associated with them.
I was wondering if someone could help me clarify this..
I see that as part of bufferheads to page association, we get a
ref. on the page.
create_empty_buffers() -> attach_page_buffers() -> page_cache_get()
I also see that this reference get dropped by ..
shrink_list() -> try_to_release_page() ->
try_to_free_buffers() -> drop_buffers() ->
__clear_page_buffers()-> page_cache_release();
So, it looks like we drop the reference on the page and disassociate
bufferheads from the page when VM wants to re-use the page. Only other
path, I see this can happen is through invalidate_mapping_pages().
Is this true ?
If I do fsync(), we flush the data - still leave the page & bufferhead
association. If I see lots of bufferheads even after fsync() is normal.
Correct ?Also Badari, a minor addition in the same vein, if a_ops->releasepage gets called journal_try_to_free_buffers() will be called by ext3_releasepage, which may actually release the buffers before try_to_free_buffers() does. I believe this should happen in the shrink_list->try_to_release_page case. I can't find any other place where the buffers would be released after a normal ext3 write. Here's a list of the callers of try_to_free_buffers: release_buffer_page: fs/jbd/commit.c:72 journal_try_to_free_bufers: fs/jbd/transaction.c:1633 mpage_writepage: fs/mpage.c:563 try_to_release_page: fs/buffer.c:1584 grow_dev_page: fs/buffer.c:1137 XFS only linvfs_release_page: fs/xfs/linux-2.6/xfs_aops.c:1250 I looked at all of these and callers to "free_buffer_head" but didn't see any obvious freeing until we release the whole page under memory pressure, etc. Sonny