aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/fscache.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /fs/cifs/fscache.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'fs/cifs/fscache.c')
-rw-r--r--fs/cifs/fscache.c73
1 files changed, 36 insertions, 37 deletions
diff --git a/fs/cifs/fscache.c b/fs/cifs/fscache.c
index 9f3f5c4be161..42e5363b4102 100644
--- a/fs/cifs/fscache.c
+++ b/fs/cifs/fscache.c
@@ -2,7 +2,7 @@
2 * fs/cifs/fscache.c - CIFS filesystem cache interface 2 * fs/cifs/fscache.c - CIFS filesystem cache interface
3 * 3 *
4 * Copyright (c) 2010 Novell, Inc. 4 * Copyright (c) 2010 Novell, Inc.
5 * Author(s): Suresh Jayaraman (sjayaraman@suse.de> 5 * Author(s): Suresh Jayaraman <sjayaraman@suse.de>
6 * 6 *
7 * This library is free software; you can redistribute it and/or modify 7 * This library is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published 8 * it under the terms of the GNU Lesser General Public License as published
@@ -28,32 +28,32 @@ void cifs_fscache_get_client_cookie(struct TCP_Server_Info *server)
28 server->fscache = 28 server->fscache =
29 fscache_acquire_cookie(cifs_fscache_netfs.primary_index, 29 fscache_acquire_cookie(cifs_fscache_netfs.primary_index,
30 &cifs_fscache_server_index_def, server); 30 &cifs_fscache_server_index_def, server);
31 cFYI(1, "CIFS: get client cookie (0x%p/0x%p)", server, 31 cFYI(1, "%s: (0x%p/0x%p)", __func__, server,
32 server->fscache); 32 server->fscache);
33} 33}
34 34
35void cifs_fscache_release_client_cookie(struct TCP_Server_Info *server) 35void cifs_fscache_release_client_cookie(struct TCP_Server_Info *server)
36{ 36{
37 cFYI(1, "CIFS: release client cookie (0x%p/0x%p)", server, 37 cFYI(1, "%s: (0x%p/0x%p)", __func__, server,
38 server->fscache); 38 server->fscache);
39 fscache_relinquish_cookie(server->fscache, 0); 39 fscache_relinquish_cookie(server->fscache, 0);
40 server->fscache = NULL; 40 server->fscache = NULL;
41} 41}
42 42
43void cifs_fscache_get_super_cookie(struct cifsTconInfo *tcon) 43void cifs_fscache_get_super_cookie(struct cifs_tcon *tcon)
44{ 44{
45 struct TCP_Server_Info *server = tcon->ses->server; 45 struct TCP_Server_Info *server = tcon->ses->server;
46 46
47 tcon->fscache = 47 tcon->fscache =
48 fscache_acquire_cookie(server->fscache, 48 fscache_acquire_cookie(server->fscache,
49 &cifs_fscache_super_index_def, tcon); 49 &cifs_fscache_super_index_def, tcon);
50 cFYI(1, "CIFS: get superblock cookie (0x%p/0x%p)", 50 cFYI(1, "%s: (0x%p/0x%p)", __func__, server->fscache,
51 server->fscache, tcon->fscache); 51 tcon->fscache);
52} 52}
53 53
54void cifs_fscache_release_super_cookie(struct cifsTconInfo *tcon) 54void cifs_fscache_release_super_cookie(struct cifs_tcon *tcon)
55{ 55{
56 cFYI(1, "CIFS: releasing superblock cookie (0x%p)", tcon->fscache); 56 cFYI(1, "%s: (0x%p)", __func__, tcon->fscache);
57 fscache_relinquish_cookie(tcon->fscache, 0); 57 fscache_relinquish_cookie(tcon->fscache, 0);
58 tcon->fscache = NULL; 58 tcon->fscache = NULL;
59} 59}
@@ -62,15 +62,17 @@ static void cifs_fscache_enable_inode_cookie(struct inode *inode)
62{ 62{
63 struct cifsInodeInfo *cifsi = CIFS_I(inode); 63 struct cifsInodeInfo *cifsi = CIFS_I(inode);
64 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 64 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
65 struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
65 66
66 if (cifsi->fscache) 67 if (cifsi->fscache)
67 return; 68 return;
68 69
69 cifsi->fscache = fscache_acquire_cookie(cifs_sb->tcon->fscache, 70 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_FSCACHE) {
70 &cifs_fscache_inode_object_def, 71 cifsi->fscache = fscache_acquire_cookie(tcon->fscache,
71 cifsi); 72 &cifs_fscache_inode_object_def, cifsi);
72 cFYI(1, "CIFS: got FH cookie (0x%p/0x%p)", 73 cFYI(1, "%s: got FH cookie (0x%p/0x%p)", __func__,
73 cifs_sb->tcon->fscache, cifsi->fscache); 74 tcon->fscache, cifsi->fscache);
75 }
74} 76}
75 77
76void cifs_fscache_release_inode_cookie(struct inode *inode) 78void cifs_fscache_release_inode_cookie(struct inode *inode)
@@ -78,8 +80,7 @@ void cifs_fscache_release_inode_cookie(struct inode *inode)
78 struct cifsInodeInfo *cifsi = CIFS_I(inode); 80 struct cifsInodeInfo *cifsi = CIFS_I(inode);
79 81
80 if (cifsi->fscache) { 82 if (cifsi->fscache) {
81 cFYI(1, "CIFS releasing inode cookie (0x%p)", 83 cFYI(1, "%s: (0x%p)", __func__, cifsi->fscache);
82 cifsi->fscache);
83 fscache_relinquish_cookie(cifsi->fscache, 0); 84 fscache_relinquish_cookie(cifsi->fscache, 0);
84 cifsi->fscache = NULL; 85 cifsi->fscache = NULL;
85 } 86 }
@@ -90,8 +91,8 @@ static void cifs_fscache_disable_inode_cookie(struct inode *inode)
90 struct cifsInodeInfo *cifsi = CIFS_I(inode); 91 struct cifsInodeInfo *cifsi = CIFS_I(inode);
91 92
92 if (cifsi->fscache) { 93 if (cifsi->fscache) {
93 cFYI(1, "CIFS disabling inode cookie (0x%p)", 94 cFYI(1, "%s: (0x%p)", __func__, cifsi->fscache);
94 cifsi->fscache); 95 fscache_uncache_all_inode_pages(cifsi->fscache, inode);
95 fscache_relinquish_cookie(cifsi->fscache, 1); 96 fscache_relinquish_cookie(cifsi->fscache, 1);
96 cifsi->fscache = NULL; 97 cifsi->fscache = NULL;
97 } 98 }
@@ -101,10 +102,8 @@ void cifs_fscache_set_inode_cookie(struct inode *inode, struct file *filp)
101{ 102{
102 if ((filp->f_flags & O_ACCMODE) != O_RDONLY) 103 if ((filp->f_flags & O_ACCMODE) != O_RDONLY)
103 cifs_fscache_disable_inode_cookie(inode); 104 cifs_fscache_disable_inode_cookie(inode);
104 else { 105 else
105 cifs_fscache_enable_inode_cookie(inode); 106 cifs_fscache_enable_inode_cookie(inode);
106 cFYI(1, "CIFS: fscache inode cookie set");
107 }
108} 107}
109 108
110void cifs_fscache_reset_inode_cookie(struct inode *inode) 109void cifs_fscache_reset_inode_cookie(struct inode *inode)
@@ -117,11 +116,12 @@ void cifs_fscache_reset_inode_cookie(struct inode *inode)
117 /* retire the current fscache cache and get a new one */ 116 /* retire the current fscache cache and get a new one */
118 fscache_relinquish_cookie(cifsi->fscache, 1); 117 fscache_relinquish_cookie(cifsi->fscache, 1);
119 118
120 cifsi->fscache = fscache_acquire_cookie(cifs_sb->tcon->fscache, 119 cifsi->fscache = fscache_acquire_cookie(
120 cifs_sb_master_tcon(cifs_sb)->fscache,
121 &cifs_fscache_inode_object_def, 121 &cifs_fscache_inode_object_def,
122 cifsi); 122 cifsi);
123 cFYI(1, "CIFS: new cookie 0x%p oldcookie 0x%p", 123 cFYI(1, "%s: new cookie 0x%p oldcookie 0x%p",
124 cifsi->fscache, old); 124 __func__, cifsi->fscache, old);
125 } 125 }
126} 126}
127 127
@@ -131,8 +131,8 @@ int cifs_fscache_release_page(struct page *page, gfp_t gfp)
131 struct inode *inode = page->mapping->host; 131 struct inode *inode = page->mapping->host;
132 struct cifsInodeInfo *cifsi = CIFS_I(inode); 132 struct cifsInodeInfo *cifsi = CIFS_I(inode);
133 133
134 cFYI(1, "CIFS: fscache release page (0x%p/0x%p)", 134 cFYI(1, "%s: (0x%p/0x%p)", __func__, page,
135 page, cifsi->fscache); 135 cifsi->fscache);
136 if (!fscache_maybe_release_page(cifsi->fscache, page, gfp)) 136 if (!fscache_maybe_release_page(cifsi->fscache, page, gfp))
137 return 0; 137 return 0;
138 } 138 }
@@ -143,8 +143,7 @@ int cifs_fscache_release_page(struct page *page, gfp_t gfp)
143static void cifs_readpage_from_fscache_complete(struct page *page, void *ctx, 143static void cifs_readpage_from_fscache_complete(struct page *page, void *ctx,
144 int error) 144 int error)
145{ 145{
146 cFYI(1, "CFS: readpage_from_fscache_complete (0x%p/%d)", 146 cFYI(1, "%s: (0x%p/%d)", __func__, page, error);
147 page, error);
148 if (!error) 147 if (!error)
149 SetPageUptodate(page); 148 SetPageUptodate(page);
150 unlock_page(page); 149 unlock_page(page);
@@ -157,7 +156,7 @@ int __cifs_readpage_from_fscache(struct inode *inode, struct page *page)
157{ 156{
158 int ret; 157 int ret;
159 158
160 cFYI(1, "CIFS: readpage_from_fscache(fsc:%p, p:%p, i:0x%p", 159 cFYI(1, "%s: (fsc:%p, p:%p, i:0x%p", __func__,
161 CIFS_I(inode)->fscache, page, inode); 160 CIFS_I(inode)->fscache, page, inode);
162 ret = fscache_read_or_alloc_page(CIFS_I(inode)->fscache, page, 161 ret = fscache_read_or_alloc_page(CIFS_I(inode)->fscache, page,
163 cifs_readpage_from_fscache_complete, 162 cifs_readpage_from_fscache_complete,
@@ -166,11 +165,11 @@ int __cifs_readpage_from_fscache(struct inode *inode, struct page *page)
166 switch (ret) { 165 switch (ret) {
167 166
168 case 0: /* page found in fscache, read submitted */ 167 case 0: /* page found in fscache, read submitted */
169 cFYI(1, "CIFS: readpage_from_fscache: submitted"); 168 cFYI(1, "%s: submitted", __func__);
170 return ret; 169 return ret;
171 case -ENOBUFS: /* page won't be cached */ 170 case -ENOBUFS: /* page won't be cached */
172 case -ENODATA: /* page not in cache */ 171 case -ENODATA: /* page not in cache */
173 cFYI(1, "CIFS: readpage_from_fscache %d", ret); 172 cFYI(1, "%s: %d", __func__, ret);
174 return 1; 173 return 1;
175 174
176 default: 175 default:
@@ -189,7 +188,7 @@ int __cifs_readpages_from_fscache(struct inode *inode,
189{ 188{
190 int ret; 189 int ret;
191 190
192 cFYI(1, "CIFS: __cifs_readpages_from_fscache (0x%p/%u/0x%p)", 191 cFYI(1, "%s: (0x%p/%u/0x%p)", __func__,
193 CIFS_I(inode)->fscache, *nr_pages, inode); 192 CIFS_I(inode)->fscache, *nr_pages, inode);
194 ret = fscache_read_or_alloc_pages(CIFS_I(inode)->fscache, mapping, 193 ret = fscache_read_or_alloc_pages(CIFS_I(inode)->fscache, mapping,
195 pages, nr_pages, 194 pages, nr_pages,
@@ -198,12 +197,12 @@ int __cifs_readpages_from_fscache(struct inode *inode,
198 mapping_gfp_mask(mapping)); 197 mapping_gfp_mask(mapping));
199 switch (ret) { 198 switch (ret) {
200 case 0: /* read submitted to the cache for all pages */ 199 case 0: /* read submitted to the cache for all pages */
201 cFYI(1, "CIFS: readpages_from_fscache: submitted"); 200 cFYI(1, "%s: submitted", __func__);
202 return ret; 201 return ret;
203 202
204 case -ENOBUFS: /* some pages are not cached and can't be */ 203 case -ENOBUFS: /* some pages are not cached and can't be */
205 case -ENODATA: /* some pages are not cached */ 204 case -ENODATA: /* some pages are not cached */
206 cFYI(1, "CIFS: readpages_from_fscache: no page"); 205 cFYI(1, "%s: no page", __func__);
207 return 1; 206 return 1;
208 207
209 default: 208 default:
@@ -217,7 +216,7 @@ void __cifs_readpage_to_fscache(struct inode *inode, struct page *page)
217{ 216{
218 int ret; 217 int ret;
219 218
220 cFYI(1, "CIFS: readpage_to_fscache(fsc: %p, p: %p, i: %p", 219 cFYI(1, "%s: (fsc: %p, p: %p, i: %p)", __func__,
221 CIFS_I(inode)->fscache, page, inode); 220 CIFS_I(inode)->fscache, page, inode);
222 ret = fscache_write_page(CIFS_I(inode)->fscache, page, GFP_KERNEL); 221 ret = fscache_write_page(CIFS_I(inode)->fscache, page, GFP_KERNEL);
223 if (ret != 0) 222 if (ret != 0)
@@ -229,7 +228,7 @@ void __cifs_fscache_invalidate_page(struct page *page, struct inode *inode)
229 struct cifsInodeInfo *cifsi = CIFS_I(inode); 228 struct cifsInodeInfo *cifsi = CIFS_I(inode);
230 struct fscache_cookie *cookie = cifsi->fscache; 229 struct fscache_cookie *cookie = cifsi->fscache;
231 230
232 cFYI(1, "CIFS: fscache invalidatepage (0x%p/0x%p)", page, cookie); 231 cFYI(1, "%s: (0x%p/0x%p)", __func__, page, cookie);
233 fscache_wait_on_page_write(cookie, page); 232 fscache_wait_on_page_write(cookie, page);
234 fscache_uncache_page(cookie, page); 233 fscache_uncache_page(cookie, page);
235} 234}