fs/9p: [fscache] wait for page write in cached mode
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Mon, 28 Feb 2011 11:33:56 +0000 (17:03 +0530)
committerEric Van Hensbergen <ericvh@gmail.com>
Tue, 15 Mar 2011 14:57:37 +0000 (09:57 -0500)
We need to call fscache_wait_on_page_write in launder_page
for fscache

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
fs/9p/cache.c
fs/9p/cache.h
fs/9p/vfs_addr.c

index 0dbe0d139ac2aa3e03375188f1308c7cbadf6b57..610913d42a28b1eb70c48df88de1824083048293 100644 (file)
@@ -461,3 +461,14 @@ void __v9fs_readpage_to_fscache(struct inode *inode, struct page *page)
        if (ret != 0)
                v9fs_uncache_page(inode, page);
 }
+
+/*
+ * wait for a page to complete writing to the cache
+ */
+void __v9fs_fscache_wait_on_page_write(struct inode *inode, struct page *page)
+{
+       const struct v9fs_cookie *vcookie = v9fs_inode2cookie(inode);
+       P9_DPRINTK(P9_DEBUG_FSC, "inode %p page %p", inode, page);
+       if (PageFsCache(page))
+               fscache_wait_on_page_write(vcookie->fscache, page);
+}
index a94192bfaee843183bbc74f068c1f72dcbc6468d..ec16fcdc3a679907226810d3d9e94bb07217f781 100644 (file)
@@ -64,8 +64,8 @@ extern int __v9fs_readpages_from_fscache(struct inode *inode,
                                         struct list_head *pages,
                                         unsigned *nr_pages);
 extern void __v9fs_readpage_to_fscache(struct inode *inode, struct page *page);
-
-
+extern void __v9fs_fscache_wait_on_page_write(struct inode *inode,
+                                             struct page *page);
 /**
  * v9fs_cache_register - Register v9fs file system with the cache
  */
@@ -131,6 +131,12 @@ static inline void v9fs_vcookie_set_qid(struct inode *inode,
        spin_unlock(&vcookie->lock);
 }
 
+static inline void v9fs_fscache_wait_on_page_write(struct inode *inode,
+                                                  struct page *page)
+{
+       return __v9fs_fscache_wait_on_page_write(inode, page);
+}
+
 #else /* CONFIG_9P_FSCACHE */
 
 static inline int v9fs_cache_register(void)
@@ -172,5 +178,11 @@ static inline void v9fs_vcookie_set_qid(struct inode *inode,
                                        struct p9_qid *qid)
 {}
 
+static inline void v9fs_fscache_wait_on_page_write(struct inode *inode,
+                                                  struct page *page)
+{
+       return;
+}
+
 #endif /* CONFIG_9P_FSCACHE */
 #endif /* _9P_CACHE_H */
index b7f2a8e3863e66296751aa44c40b3b902de13839..637bd703e28ce70e6b2207ed4c3c5e08d4d110ed 100644 (file)
@@ -151,6 +151,8 @@ static void v9fs_invalidate_page(struct page *page, unsigned long offset)
 
 static int v9fs_launder_page(struct page *page)
 {
+       struct inode *inode = page->mapping->host;
+       v9fs_fscache_wait_on_page_write(inode, page);
        return 0;
 }