Re: [PATCH 02/14] FS-Cache: Recruit a couple of page flags forcache management

From: Peter Zijlstra
Date: Wed Aug 01 2007 - 02:17:54 EST


On Tue, 2007-07-31 at 21:25 +0100, David Howells wrote:

> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> index 209d3a4..eaf9854 100644
> --- a/include/linux/page-flags.h
> +++ b/include/linux/page-flags.h
> @@ -83,19 +83,24 @@
> #define PG_private 11 /* If pagecache, has fs-private data */
>
> #define PG_writeback 12 /* Page is under writeback */
> +#define PG_owner_priv_2 13 /* Owner use. If pagecache, fs may use */
> #define PG_compound 14 /* Part of a compound page */
> #define PG_swapcache 15 /* Swap page: swp_entry_t in private */
>
> #define PG_mappedtodisk 16 /* Has blocks allocated on-disk */
> #define PG_reclaim 17 /* To be reclaimed asap */
> +#define PG_owner_priv_3 18 /* Owner use. If pagecache, fs may use */
> #define PG_buddy 19 /* Page is free, on buddy lists */
>
> /* PG_readahead is only used for file reads; PG_reclaim is only for writes */
> #define PG_readahead PG_reclaim /* Reminder to do async read-ahead */
>
> -/* PG_owner_priv_1 users should have descriptive aliases */
> +/* PG_owner_priv_1/2/3 users should have descriptive aliases */
> #define PG_checked PG_owner_priv_1 /* Used by some filesystems */
> #define PG_pinned PG_owner_priv_1 /* Xen pinned pagetable */
> +#define PG_fscache PG_owner_priv_2 /* Backed by local cache */
> +#define PG_fscache_write PG_owner_priv_3 /* Writing to local cache */
> +


> +/**
> + * page_has_private - Determine if page has private stuff
> + * @page: The page to be checked
> + *
> + * Determine if a page has private stuff, indicating that release routines
> + * should be invoked upon it.
> + */
> +#define page_has_private(page) \
> + ((page)->flags & ((1 << PG_private) | \
> + (1 << PG_fscache)))
> +


Not sure its a good idea to overload page_has_private() with an
overloadable page-flag. What if some future FS wants to use
PG_owner_priv_2 for other purposes?

Obviously filesystems cannot use these two page-flags if they want to be
compatible with FS-cache, but need all filesystems be?


(also, ouch! - 2 pageflags)

-
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/