linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Richard Knutsson <ricknu-0@student.ltu.se>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"nickpiggin@yahoo.com.au" <nickpiggin@yahoo.com.au>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: [PATCH] add page->mapping handling interface [1/35] interface definitions
Date: Thu, 13 Sep 2007 22:19:20 +0200	[thread overview]
Message-ID: <46E99B48.6050106@student.ltu.se> (raw)
In-Reply-To: <20070910184239.e1f705c9.kamezawa.hiroyu@jp.fujitsu.com>

KAMEZAWA Hiroyuki wrote:
>  - changes page->mapping from address_space* to unsigned long
>  - add page_mapping_anon() function.
>  - add linux/page-cache.h
>  - add page_inode() function
>  - add page_is_pagecache() function
>  - add pagecaceh_consisten() function for pagecache consistency test.
>  - expoterd swapper_space. inline function page_mapping() refers this.
>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>
> ---
>  include/linux/fs.h         |    1 +
>  include/linux/mm.h         |   20 +++++++++++++++++---
>  include/linux/mm_types.h   |    2 +-
>  include/linux/page-cache.h |   39 +++++++++++++++++++++++++++++++++++++++
>  mm/swap_state.c            |    2 ++
>  5 files changed, 60 insertions(+), 4 deletions(-)
>
> Index: test-2.6.23-rc4-mm1/include/linux/page-cache.h
> ===================================================================
> --- /dev/null
> +++ test-2.6.23-rc4-mm1/include/linux/page-cache.h
> @@ -0,0 +1,39 @@
> +/*
> + * For interface definitions between memory management and file systems.
> + * - This file defines small interface functions for handling page cache.
> + */
> +
> +#ifndef _LINUX_PAGECACHE_H
> +#define _LINUX_PAGECACHE_H
> +
> +#include <linux/mm.h>
> +/* page_mapping_xxx() function is defined in mm.h */
> +
> +static inline int page_is_pagecache(struct page *page)
>   
Why return it as an 'int' instead of 'bool'?
> +{
> +	if (!page->mapping || (page->mapping & PAGE_MAPPING_ANON))
> +		return 0;
> +	return 1;
> +}
>   
Not easier with 'return page->mapping && (page->mapping & 
PAGE_MAPPING_ANON) == 0;'?
> +
> +/*
> + * Return an inode this page belongs to
> + */
> +
> +static inline struct inode *page_inode(struct page *page)
> +{
> +	if (!page_is_pagecache(page))
> +		return NULL;
> +	return page_mapping_cache(page)->host;
> +}
> +
> +/*
> + * Test a page is a page-cache of an address_space.
> + */
> +static inline int
> +pagecache_consistent(struct page *page, struct address_space *as)
> +{
> +	return (page_mapping(page) == as);
> +}
> +
> +#endif
<snip>
> Index: test-2.6.23-rc4-mm1/include/linux/mm.h
> ===================================================================
> --- test-2.6.23-rc4-mm1.orig/include/linux/mm.h
> +++ test-2.6.23-rc4-mm1/include/linux/mm.h
> @@ -563,7 +563,7 @@ void page_address_init(void);
>  extern struct address_space swapper_space;
>  static inline struct address_space *page_mapping(struct page *page)
>  {
> -	struct address_space *mapping = page->mapping;
> +	struct address_space *mapping = (struct address_space *)page->mapping;
>  
>  	VM_BUG_ON(PageSlab(page));
>  	if (unlikely(PageSwapCache(page)))
> @@ -579,7 +579,21 @@ static inline struct address_space *page
>  
>  static inline int PageAnon(struct page *page)
>   
Change to bool? Then "you" can also remove the '!!' from:
mm/memory.c:483:                rss[!!PageAnon(page)]++;
>  {
> -	return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0;
> +	return (page->mapping & PAGE_MAPPING_ANON) != 0;
> +}
> +
>   
<snip>

If you don't mind bool(eans) (for some reason), I can/will check out the 
rest.

Richard Knutsson

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2007-09-13 20:19 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-10  9:40 [PATCH] add page->mapping handling interface [0/35] intro KAMEZAWA Hiroyuki
2007-09-10  9:42 ` [PATCH] add page->mapping handling interface [1/35] interface definitions KAMEZAWA Hiroyuki
2007-09-13 20:19   ` Richard Knutsson [this message]
2007-09-14  1:06     ` KAMEZAWA Hiroyuki
2007-09-10  9:43 ` [PATCH] add page->mapping handling interface [2/35] changes in /mm KAMEZAWA Hiroyuki
2007-09-10  9:44 ` [PATCH] add page->mapping handling interface [3/35] changes in generic parts KAMEZAWA Hiroyuki
2007-09-10  9:46 ` [PATCH] add page->mapping handling interface [4/35] changes in AFFS KAMEZAWA Hiroyuki
2007-09-10  9:49 ` [PATCH] add page->mapping handling interface [5/35] changes in AFS KAMEZAWA Hiroyuki
2007-09-10  9:50 ` [PATCH] add page->mapping handling interface [6/35] changes in CIFS KAMEZAWA Hiroyuki
2007-09-10  9:51 ` [PATCH] add page->mapping handling interface [7/35] changes in CODA KAMEZAWA Hiroyuki
2007-09-10  9:53 ` [PATCH] add page->mapping handling interface [8/35] changes in CRAMFS KAMEZAWA Hiroyuki
2007-09-10  9:55 ` [PATCH] add page->mapping handling interface [9/35] changes in ECRYPTFS KAMEZAWA Hiroyuki
2007-09-10  9:56 ` [PATCH] add page->mapping handling interface [10/35] changes in EFS KAMEZAWA Hiroyuki
2007-09-10  9:57 ` [PATCH] add page->mapping handling interface [11/35] changes in EXT2 KAMEZAWA Hiroyuki
2007-09-10  9:59 ` [PATCH] add page->mapping handling interface [12/35] changes in EXT3 KAMEZAWA Hiroyuki
2007-09-10 10:00 ` [PATCH] add page->mapping handling interface [13/35] changes in EXT4 KAMEZAWA Hiroyuki
2007-09-10 10:02 ` [PATCH] add page->mapping handling interface [14/35] changes in freevxfs KAMEZAWA Hiroyuki
2007-09-10 10:04 ` [PATCH] add page->mapping handling interface [15/35] changes in FUSE KAMEZAWA Hiroyuki
2007-09-10 10:06 ` [PATCH] add page->mapping handling interface [16/35] changes in GFS2 KAMEZAWA Hiroyuki
2007-09-10 10:07 ` [PATCH] add page->mapping handling interface [17/35] changes in HFS KAMEZAWA Hiroyuki
2007-09-10 10:09 ` [PATCH] add page->mapping handling interface [18/35] changes in HFSPLUS KAMEZAWA Hiroyuki
2007-09-10 10:11 ` [PATCH] add page->mapping handling interface [19/35] changes in HPFS KAMEZAWA Hiroyuki
2007-09-10 10:13 ` [PATCH] add page->mapping handling interface [20/35] changes in ISOFS KAMEZAWA Hiroyuki
2007-09-10 10:15 ` [PATCH] add page->mapping handling interface [21/35] changes in JBD KAMEZAWA Hiroyuki
2007-09-10 10:16 ` [PATCH] add page->mapping handling interface [22/35] changes in JFFS2 KAMEZAWA Hiroyuki
2007-09-10 10:19   ` David Woodhouse
2007-09-10 10:41     ` KAMEZAWA Hiroyuki
2007-09-10 10:17 ` [PATCH] add page->mapping handling interface [23/35] changes in JFS KAMEZAWA Hiroyuki
2007-09-10 10:18 ` [PATCH] add page->mapping handling interface [24/35] changes in MINIX FS KAMEZAWA Hiroyuki
2007-09-10 10:20 ` [PATCH] add page->mapping handling interface [25/35] changes in NCPFS KAMEZAWA Hiroyuki
2007-09-10 10:21 ` [PATCH] add page->mapping handling interface [26/35] changes in NFS KAMEZAWA Hiroyuki
2007-09-10 10:23 ` [PATCH] add page->mapping handling interface [27/35] changes in NTFS KAMEZAWA Hiroyuki
2007-09-10 10:25 ` [PATCH] add page->mapping handling interface [28/35] changes in OCFS2 KAMEZAWA Hiroyuki
2007-09-10 10:27 ` [PATCH] add page->mapping handling interface [29/35] changes in REISER4/REISERFS KAMEZAWA Hiroyuki
2007-09-10 10:28 ` [PATCH] add page->mapping handling interface [30/35] changes ROMFS KAMEZAWA Hiroyuki
2007-09-10 10:29 ` [PATCH] add page->mapping handling interface [31/35] changes in SYSVFS KAMEZAWA Hiroyuki
2007-09-10 10:32 ` [PATCH] add page->mapping handling interface [32/35] changes in UDFFS KAMEZAWA Hiroyuki
2007-09-10 10:33 ` [PATCH] add page->mapping handling interface [33/35] changes in UFS KAMEZAWA Hiroyuki
2007-09-10 10:35 ` [PATCH] add page->mapping handling interface [34/35] changes in UNIONFS KAMEZAWA Hiroyuki
2007-09-10 10:36 ` [PATCH] add page->mapping handling interface [35/35] changes in XFS KAMEZAWA Hiroyuki

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=46E99B48.6050106@student.ltu.se \
    --to=ricknu-0@student.ltu.se \
    --cc=akpm@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nickpiggin@yahoo.com.au \
    /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