From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oren Laadan Subject: [C/R v20][PATCH 47/96] c/r: export shmem_getpage() to support shared memory Date: Wed, 17 Mar 2010 12:08:35 -0400 Message-ID: <1268842164-5590-48-git-send-email-orenl@cs.columbia.edu> References: <1268842164-5590-1-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-2-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-3-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-4-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-5-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-6-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-7-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-8-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-9-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-10-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-11-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-12-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-13-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-14-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-15-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-16-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-17-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-18-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-19-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-20-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-21-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-22-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-23-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-24-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-25-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-26-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-27-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-28-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-29-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-30-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-31-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-32-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-33-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-34-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-35-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-36-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-37-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-38-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-39-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-40-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-41-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-42-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-43-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-44-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-45-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-46-git-send-email-orenl@cs.columbia.edu> <1268842164-5590-47-git-send-email-orenl@cs.columbia.edu> Return-path: In-Reply-To: <1268842164-5590-47-git-send-email-orenl@cs.columbia.edu> Sender: owner-linux-mm@kvack.org To: Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org, Serge Hallyn , Ingo Molnar , containers@lists.linux-foundation.org, Oren Laadan List-Id: linux-api@vger.kernel.org Export functionality to retrieve specific pages from shared memory given an inode in shmem-fs; this will be used in the next two patches to provide support for c/r of shared memory. mm/shmem.c: - shmem_getpage() and 'enum sgp_type' moved to linux/mm.h Signed-off-by: Oren Laadan Acked-by: Serge E. Hallyn Tested-by: Serge E. Hallyn --- include/linux/mm.h | 11 +++++++++++ mm/shmem.c | 15 ++------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index bdeb0b5..b37a9f1 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -337,6 +337,17 @@ void put_pages_list(struct list_head *pages); void split_page(struct page *page, unsigned int order); +/* Flag allocation requirements to shmem_getpage and shmem_swp_alloc */ +enum sgp_type { + SGP_READ, /* don't exceed i_size, don't allocate page */ + SGP_CACHE, /* don't exceed i_size, may allocate page */ + SGP_DIRTY, /* like SGP_CACHE, but set new page dirty */ + SGP_WRITE, /* may exceed i_size, may allocate page */ +}; + +extern int shmem_getpage(struct inode *inode, unsigned long idx, + struct page **pagep, enum sgp_type sgp, int *type); + /* * Compound pages have a destructor function. Provide a * prototype for that function and accessor functions. diff --git a/mm/shmem.c b/mm/shmem.c index eef4ebe..d93c394 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -98,14 +98,6 @@ static struct vfsmount *shm_mnt; /* Pretend that each entry is of this size in directory's i_size */ #define BOGO_DIRENT_SIZE 20 -/* Flag allocation requirements to shmem_getpage and shmem_swp_alloc */ -enum sgp_type { - SGP_READ, /* don't exceed i_size, don't allocate page */ - SGP_CACHE, /* don't exceed i_size, may allocate page */ - SGP_DIRTY, /* like SGP_CACHE, but set new page dirty */ - SGP_WRITE, /* may exceed i_size, may allocate page */ -}; - #ifdef CONFIG_TMPFS static unsigned long shmem_default_max_blocks(void) { @@ -118,9 +110,6 @@ static unsigned long shmem_default_max_inodes(void) } #endif -static int shmem_getpage(struct inode *inode, unsigned long idx, - struct page **pagep, enum sgp_type sgp, int *type); - static inline struct page *shmem_dir_alloc(gfp_t gfp_mask) { /* @@ -1213,8 +1202,8 @@ static inline struct mempolicy *shmem_get_sbmpol(struct shmem_sb_info *sbinfo) * vm. If we swap it in we mark it dirty since we also free the swap * entry since a page cannot live in both the swap and page cache */ -static int shmem_getpage(struct inode *inode, unsigned long idx, - struct page **pagep, enum sgp_type sgp, int *type) +int shmem_getpage(struct inode *inode, unsigned long idx, + struct page **pagep, enum sgp_type sgp, int *type) { struct address_space *mapping = inode->i_mapping; struct shmem_inode_info *info = SHMEM_I(inode); -- 1.6.3.3 -- 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: email@kvack.org