[C/R v20][PATCH 47/96] c/r: export shmem_getpage() to support shared memory

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Oren Laadan
Date: Wednesday, March 17, 2010 - 9:08 am

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 <orenl@cs.columbia.edu>
Acked-by: Serge E. Hallyn <serue@us.ibm.com>
Tested-by: Serge E. Hallyn <serue@us.ibm.com>
---
 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

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[C/R v20][PATCH 00/96] Linux Checkpoint-Restart - v20, Oren Laadan, (Wed Mar 17, 9:07 am)
[C/R v20][PATCH 13/96] c/r: break out new_user_ns(), Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 19/96] Namespaces submenu, Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 22/96] c/r: documentation, Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 28/96] c/r: restart-blocks, Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 30/96] c/r: restart multiple processes, Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 38/96] c/r: dump open file descriptors, Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 47/96] c/r: export shmem_getpage() to supp ..., Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 51/96] c/r: support for open pipes, Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 55/96] c/r: support for UTS namespace, Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 60/96] c/r: support semaphore sysv-ipc, Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 62/96] c/r: add CKPT_COPY() macro, Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 66/96] c/r: restore file-&gt;f_cred, Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 73/96] c/r: correctly restore pgid, Oren Laadan, (Wed Mar 17, 9:09 am)
[C/R v20][PATCH 83/96] c/r: checkpoint/restart eventfd, Oren Laadan, (Wed Mar 17, 9:09 am)
[C/R v20][PATCH 95/96] c/r: add selinux support (v6), Oren Laadan, (Wed Mar 17, 9:09 am)
Re: [C/R v20][PATCH 15/96] cgroup freezer: Fix buggy resum ..., Rafael J. Wysocki, (Mon Mar 22, 4:28 pm)
Re: [C/R v20][PATCH 15/96] cgroup freezer: Fix buggy resum ..., Rafael J. Wysocki, (Fri Mar 26, 3:53 pm)
Re: [C/R v20][PATCH 00/96] Linux Checkpoint-Restart - v20, Serge E. Hallyn, (Thu Apr 1, 4:37 pm)