Re: fscache review comments, part 1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:

> 05-release-page.diff:
> 	ACK, though I'd wish someone could come up with nicer names for
> 	read_cache_pages_invalidate_page(s).

They could always be nested:-).  That way they don't pollute the namespace.
This is one of the gcc extensions.  If you do nm on the output, you see the
nested function appear like this if not inlined:

	000000000000058f t invalidate_page.17245

That above derives from this:


int read_cache_pages(struct address_space *mapping, struct list_head *pages,
			int (*filler)(void *, struct page *), void *data)
{
	struct page *page;
	struct pagevec lru_pvec;
	int ret = 0;

	/* see if a page needs releasing upon read_cache_pages() failure */
	void invalidate_page(struct address_space *mapping, struct page *page)
	{
		if (PagePrivate(page)) {
			if (TestSetPageLocked(page))
				BUG();
			page->mapping = mapping;
			do_invalidatepage(page, 0);
			page->mapping = NULL;
			unlock_page(page);
		}
		page_cache_release(page);
	}

	/* release a list of pages, invalidating them first if need be */
	void invalidate_pages(struct address_space *mapping,
			      struct list_head *pages)
	{
		struct page *victim;

		while (!list_empty(pages)) {
			victim = list_to_page(pages);
			list_del(&victim->lru);
			invalidate_page(mapping, victim);
		}
	}

	pagevec_init(&lru_pvec, 0);

	while (!list_empty(pages)) {
		page = list_to_page(pages);
		list_del(&page->lru);
		if (add_to_page_cache(page, mapping, page->index, GFP_KERNEL)) {
			invalidate_page(mapping, page);
			continue;
		}
		ret = filler(data, page);
		if (!pagevec_add(&lru_pvec, page))
			__pagevec_lru_add(&lru_pvec);
		if (ret) {
			invalidate_pages(mapping, pages);
			break;
		}
	}
	pagevec_lru_add(&lru_pvec);
	return ret;
}

David
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux