From: Nick Piggin <nickpiggin@yahoo.com.au>
To: David Howells <dhowells@redhat.com>
Cc: linux-kernel@vger.kernel.org, nfsv4@linux-nfs.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 05/41] FS-Cache: Release page->private after failed readahead [ver #48]
Date: Sat, 4 Apr 2009 17:00:08 +1100 [thread overview]
Message-ID: <200904041700.09248.nickpiggin@yahoo.com.au> (raw)
In-Reply-To: <20090403155502.28714.31394.stgit@warthog.procyon.org.uk>
Again, what about prefixing patches with the subsystems they affect?
This would be mm: or fs:.
On Saturday 04 April 2009 02:55:02 David Howells wrote:
> The attached patch causes read_cache_pages() to release page-private data on a
> page for which add_to_page_cache() fails. If the filler function fails, then
> the problematic page is left attached to the pagecache (with appropriate flags
> set, one presumes) and the remaining to-be-attached pages are invalidated and
> discarded. This permits pages with caching references associated with them to
> be cleaned up.
>
> The invalidatepage() address space op is called (indirectly) to do the honours.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> Acked-by: Steve Dickson <steved@redhat.com>
> Acked-by: Trond Myklebust <Trond.Myklebust@netapp.com>
> Acked-by: Rik van Riel <riel@redhat.com>
> Acked-by: Al Viro <viro@zeniv.linux.org.uk>
> Tested-by: Daire Byrne <Daire.Byrne@framestore.com>
> ---
>
> include/linux/page-flags.h | 2 +-
> mm/readahead.c | 39 +++++++++++++++++++++++++++++++++++++--
> 2 files changed, 38 insertions(+), 3 deletions(-)
>
>
> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> index 61df177..9d99e74 100644
> --- a/include/linux/page-flags.h
> +++ b/include/linux/page-flags.h
> @@ -182,7 +182,7 @@ static inline int TestClearPage##uname(struct page *page) { return 0; }
>
> struct page; /* forward declaration */
>
> -TESTPAGEFLAG(Locked, locked)
> +TESTPAGEFLAG(Locked, locked) TESTSETFLAG(Locked, locked)
> PAGEFLAG(Error, error)
> PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced)
> PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty)
> diff --git a/mm/readahead.c b/mm/readahead.c
> index 9ce303d..6be9275 100644
> --- a/mm/readahead.c
> +++ b/mm/readahead.c
> @@ -31,6 +31,41 @@ EXPORT_SYMBOL_GPL(file_ra_state_init);
>
> #define list_to_page(head) (list_entry((head)->prev, struct page, lru))
>
> +/*
> + * see if a page needs releasing upon read_cache_pages() failure
> + * - the caller of read_cache_pages() may have set PG_private before calling,
> + * such as the NFS fs marking pages that are cached locally on disk, thus we
> + * need to give the fs a chance to clean up in the event of an error
> + */
> +static void read_cache_pages_invalidate_page(struct address_space *mapping,
> + struct page *page)
> +{
> + if (PagePrivate(page)) {
> + if (!trylock_page(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
> + */
> +static void read_cache_pages_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);
> + read_cache_pages_invalidate_page(mapping, victim);
> + }
> +}
> +
> /**
> * read_cache_pages - populate an address space with some pages & start reads against them
> * @mapping: the address_space
> @@ -52,14 +87,14 @@ int read_cache_pages(struct address_space *mapping, struct list_head *pages,
> list_del(&page->lru);
> if (add_to_page_cache_lru(page, mapping,
> page->index, GFP_KERNEL)) {
> - page_cache_release(page);
> + read_cache_pages_invalidate_page(mapping, page);
> continue;
> }
> page_cache_release(page);
>
> ret = filler(data, page);
> if (unlikely(ret)) {
> - put_pages_list(pages);
> + read_cache_pages_invalidate_pages(mapping, pages);
> break;
> }
> task_io_account_read(PAGE_CACHE_SIZE);
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
next prev parent reply other threads:[~2009-04-04 6:00 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-03 15:54 [PATCH 00/41] Permit filesystem local caching " David Howells
2009-04-03 15:54 ` [PATCH 01/41] Create a dynamically sized pool of threads for doing very slow work items " David Howells
2009-04-03 15:54 ` [PATCH 02/41] Make slow-work thread pool actually dynamic " David Howells
2009-04-03 15:54 ` [PATCH 03/41] Make the slow work pool configurable " David Howells
2009-04-03 15:54 ` [PATCH 04/41] Document the slow work thread pool " David Howells
2009-04-03 15:55 ` [PATCH 05/41] FS-Cache: Release page->private after failed readahead " David Howells
2009-04-04 6:00 ` Nick Piggin [this message]
2009-04-03 15:55 ` [PATCH 06/41] FS-Cache: Recruit a page flags for cache management " David Howells
2009-04-04 6:04 ` Nick Piggin
2009-04-03 15:55 ` [PATCH 07/41] FS-Cache: Add the FS-Cache netfs API and documentation " David Howells
2009-04-03 15:55 ` [PATCH 08/41] FS-Cache: Add the FS-Cache cache backend " David Howells
2009-04-03 15:55 ` [PATCH 09/41] FS-Cache: Add main configuration option, module entry points and debugging " David Howells
2009-04-03 15:55 ` [PATCH 10/41] FS-Cache: Add use of /proc and presentation of statistics " David Howells
2009-04-04 17:39 ` Christoph Hellwig
2009-04-03 15:55 ` [PATCH 11/41] FS-Cache: Root index definition " David Howells
2009-04-03 15:55 ` [PATCH 12/41] FS-Cache: Add cache tag handling " David Howells
2009-04-03 15:55 ` [PATCH 13/41] FS-Cache: Add cache management " David Howells
2009-04-03 15:55 ` [PATCH 14/41] FS-Cache: Provide a slab for cookie allocation " David Howells
2009-04-03 15:55 ` [PATCH 15/41] FS-Cache: Add netfs registration " David Howells
2009-04-03 15:55 ` [PATCH 16/41] FS-Cache: Bit waiting helpers " David Howells
2009-04-03 15:56 ` [PATCH 17/41] FS-Cache: Object management state machine " David Howells
2009-04-03 15:56 ` [PATCH 18/41] FS-Cache: Implement the cookie management part of the netfs API " David Howells
2009-04-03 15:56 ` [PATCH 19/41] FS-Cache: Add and document asynchronous operation handling " David Howells
2009-04-03 15:56 ` [PATCH 20/41] FS-Cache: Implement data I/O part of netfs API " David Howells
2009-04-03 15:56 ` [PATCH 21/41] CacheFiles: Permit the page lock state to be monitored " David Howells
2009-04-04 6:09 ` Nick Piggin
2009-04-04 14:22 ` Nick Piggin
2009-04-04 22:13 ` David Howells
2009-04-06 8:31 ` Nick Piggin
2009-04-04 11:31 ` David Howells
2009-04-06 9:34 ` Nick Piggin
2009-04-03 15:56 ` [PATCH 22/41] CacheFiles: Export things for CacheFiles " David Howells
2009-04-03 15:56 ` [PATCH 23/41] CacheFiles: A cache that backs onto a mounted filesystem " David Howells
2009-04-03 15:56 ` [PATCH 24/41] FS-Cache: Make kAFS use FS-Cache " David Howells
2009-04-03 15:56 ` [PATCH 25/41] NFS: Add comment banners to some NFS functions " David Howells
2009-04-03 15:56 ` [PATCH 26/41] NFS: Add FS-Cache option bit and debug bit " David Howells
2009-04-03 15:56 ` [PATCH 27/41] NFS: Permit local filesystem caching to be enabled for NFS " David Howells
2009-04-03 15:57 ` [PATCH 28/41] NFS: Register NFS for caching and retrieve the top-level index " David Howells
2009-04-03 15:57 ` [PATCH 29/41] NFS: Define and create server-level objects " David Howells
2009-04-03 15:57 ` [PATCH 30/41] NFS: Define and create superblock-level " David Howells
2009-04-03 15:57 ` [PATCH 31/41] NFS: Define and create inode-level cache " David Howells
2009-04-03 15:57 ` [PATCH 32/41] NFS: Use local disk inode cache " David Howells
2009-04-03 15:57 ` [PATCH 33/41] NFS: Invalidate FsCache page flags when cache removed " David Howells
2009-04-03 15:57 ` [PATCH 34/41] NFS: Add some new I/O counters for FS-Cache doing things for NFS " David Howells
2009-04-03 15:57 ` [PATCH 35/41] NFS: FS-Cache page management " David Howells
2009-04-03 15:57 ` [PATCH 36/41] NFS: Add read context retention for FS-Cache to call back with " David Howells
2009-04-03 15:57 ` [PATCH 37/41] NFS: nfs_readpage_async() needs to be accessible as a fallback for local caching " David Howells
2009-04-03 15:57 ` [PATCH 38/41] NFS: Read pages from FS-Cache into an NFS inode " David Howells
2009-04-03 15:57 ` [PATCH 39/41] NFS: Store pages from an NFS inode into a local cache " David Howells
2009-04-03 15:58 ` [PATCH 40/41] NFS: Display local caching state " David Howells
2009-04-03 15:58 ` [PATCH 41/41] NFS: Add mount options to enable local caching on NFS " David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200904041700.09248.nickpiggin@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=dhowells@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nfsv4@linux-nfs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®