diff options
author | David Howells <dhowells@redhat.com> | 2007-05-09 05:33:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-09 15:30:50 -0400 |
commit | 416351f28d2b31d15ff73e9aff699b2163704c95 (patch) | |
tree | 4b43838415b2cb95dfc66f9bc5fdb36b0f245e6c /fs/afs/file.c | |
parent | ef71c15c46a053818f7e69098ebb052b31ffa56b (diff) |
AFS: AFS fixups
Make some miscellaneous changes to the AFS filesystem:
(1) Assert RCU barriers on module exit to make sure RCU has finished with
callbacks in this module.
(2) Correctly handle the AFS server returning a zero-length read.
(3) Split out data zapping calls into one function (afs_zap_data).
(4) Rename some afs_file_*() functions to afs_*() where they apply to
non-regular files too.
(5) Be consistent about the presentation of volume ID:vnode ID in debugging
output.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/afs/file.c')
-rw-r--r-- | fs/afs/file.c | 75 |
1 files changed, 26 insertions, 49 deletions
diff --git a/fs/afs/file.c b/fs/afs/file.c index ae256498f4f7..3eb3fc7b36be 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c | |||
@@ -17,9 +17,9 @@ | |||
17 | #include <linux/pagemap.h> | 17 | #include <linux/pagemap.h> |
18 | #include "internal.h" | 18 | #include "internal.h" |
19 | 19 | ||
20 | static int afs_file_readpage(struct file *file, struct page *page); | 20 | static int afs_readpage(struct file *file, struct page *page); |
21 | static void afs_file_invalidatepage(struct page *page, unsigned long offset); | 21 | static void afs_invalidatepage(struct page *page, unsigned long offset); |
22 | static int afs_file_releasepage(struct page *page, gfp_t gfp_flags); | 22 | static int afs_releasepage(struct page *page, gfp_t gfp_flags); |
23 | 23 | ||
24 | const struct file_operations afs_file_operations = { | 24 | const struct file_operations afs_file_operations = { |
25 | .open = afs_open, | 25 | .open = afs_open, |
@@ -32,15 +32,15 @@ const struct file_operations afs_file_operations = { | |||
32 | }; | 32 | }; |
33 | 33 | ||
34 | const struct inode_operations afs_file_inode_operations = { | 34 | const struct inode_operations afs_file_inode_operations = { |
35 | .getattr = afs_inode_getattr, | 35 | .getattr = afs_getattr, |
36 | .permission = afs_permission, | 36 | .permission = afs_permission, |
37 | }; | 37 | }; |
38 | 38 | ||
39 | const struct address_space_operations afs_fs_aops = { | 39 | const struct address_space_operations afs_fs_aops = { |
40 | .readpage = afs_file_readpage, | 40 | .readpage = afs_readpage, |
41 | .set_page_dirty = __set_page_dirty_nobuffers, | 41 | .set_page_dirty = __set_page_dirty_nobuffers, |
42 | .releasepage = afs_file_releasepage, | 42 | .releasepage = afs_releasepage, |
43 | .invalidatepage = afs_file_invalidatepage, | 43 | .invalidatepage = afs_invalidatepage, |
44 | }; | 44 | }; |
45 | 45 | ||
46 | /* | 46 | /* |
@@ -52,7 +52,7 @@ int afs_open(struct inode *inode, struct file *file) | |||
52 | struct key *key; | 52 | struct key *key; |
53 | int ret; | 53 | int ret; |
54 | 54 | ||
55 | _enter("{%x:%x},", vnode->fid.vid, vnode->fid.vnode); | 55 | _enter("{%x:%u},", vnode->fid.vid, vnode->fid.vnode); |
56 | 56 | ||
57 | key = afs_request_key(vnode->volume->cell); | 57 | key = afs_request_key(vnode->volume->cell); |
58 | if (IS_ERR(key)) { | 58 | if (IS_ERR(key)) { |
@@ -78,7 +78,7 @@ int afs_release(struct inode *inode, struct file *file) | |||
78 | { | 78 | { |
79 | struct afs_vnode *vnode = AFS_FS_I(inode); | 79 | struct afs_vnode *vnode = AFS_FS_I(inode); |
80 | 80 | ||
81 | _enter("{%x:%x},", vnode->fid.vid, vnode->fid.vnode); | 81 | _enter("{%x:%u},", vnode->fid.vid, vnode->fid.vnode); |
82 | 82 | ||
83 | key_put(file->private_data); | 83 | key_put(file->private_data); |
84 | _leave(" = 0"); | 84 | _leave(" = 0"); |
@@ -89,10 +89,10 @@ int afs_release(struct inode *inode, struct file *file) | |||
89 | * deal with notification that a page was read from the cache | 89 | * deal with notification that a page was read from the cache |
90 | */ | 90 | */ |
91 | #ifdef AFS_CACHING_SUPPORT | 91 | #ifdef AFS_CACHING_SUPPORT |
92 | static void afs_file_readpage_read_complete(void *cookie_data, | 92 | static void afs_readpage_read_complete(void *cookie_data, |
93 | struct page *page, | 93 | struct page *page, |
94 | void *data, | 94 | void *data, |
95 | int error) | 95 | int error) |
96 | { | 96 | { |
97 | _enter("%p,%p,%p,%d", cookie_data, page, data, error); | 97 | _enter("%p,%p,%p,%d", cookie_data, page, data, error); |
98 | 98 | ||
@@ -109,10 +109,10 @@ static void afs_file_readpage_read_complete(void *cookie_data, | |||
109 | * deal with notification that a page was written to the cache | 109 | * deal with notification that a page was written to the cache |
110 | */ | 110 | */ |
111 | #ifdef AFS_CACHING_SUPPORT | 111 | #ifdef AFS_CACHING_SUPPORT |
112 | static void afs_file_readpage_write_complete(void *cookie_data, | 112 | static void afs_readpage_write_complete(void *cookie_data, |
113 | struct page *page, | 113 | struct page *page, |
114 | void *data, | 114 | void *data, |
115 | int error) | 115 | int error) |
116 | { | 116 | { |
117 | _enter("%p,%p,%p,%d", cookie_data, page, data, error); | 117 | _enter("%p,%p,%p,%d", cookie_data, page, data, error); |
118 | 118 | ||
@@ -121,9 +121,9 @@ static void afs_file_readpage_write_complete(void *cookie_data, | |||
121 | #endif | 121 | #endif |
122 | 122 | ||
123 | /* | 123 | /* |
124 | * AFS read page from file (or symlink) | 124 | * AFS read page from file, directory or symlink |
125 | */ | 125 | */ |
126 | static int afs_file_readpage(struct file *file, struct page *page) | 126 | static int afs_readpage(struct file *file, struct page *page) |
127 | { | 127 | { |
128 | struct afs_vnode *vnode; | 128 | struct afs_vnode *vnode; |
129 | struct inode *inode; | 129 | struct inode *inode; |
@@ -219,30 +219,13 @@ error: | |||
219 | } | 219 | } |
220 | 220 | ||
221 | /* | 221 | /* |
222 | * get a page cookie for the specified page | ||
223 | */ | ||
224 | #ifdef AFS_CACHING_SUPPORT | ||
225 | int afs_cache_get_page_cookie(struct page *page, | ||
226 | struct cachefs_page **_page_cookie) | ||
227 | { | ||
228 | int ret; | ||
229 | |||
230 | _enter(""); | ||
231 | ret = cachefs_page_get_private(page,_page_cookie, GFP_NOIO); | ||
232 | |||
233 | _leave(" = %d", ret); | ||
234 | return ret; | ||
235 | } | ||
236 | #endif | ||
237 | |||
238 | /* | ||
239 | * invalidate part or all of a page | 222 | * invalidate part or all of a page |
240 | */ | 223 | */ |
241 | static void afs_file_invalidatepage(struct page *page, unsigned long offset) | 224 | static void afs_invalidatepage(struct page *page, unsigned long offset) |
242 | { | 225 | { |
243 | int ret = 1; | 226 | int ret = 1; |
244 | 227 | ||
245 | _enter("{%lu},%lu", page->index, offset); | 228 | kenter("{%lu},%lu", page->index, offset); |
246 | 229 | ||
247 | BUG_ON(!PageLocked(page)); | 230 | BUG_ON(!PageLocked(page)); |
248 | 231 | ||
@@ -274,23 +257,17 @@ static void afs_file_invalidatepage(struct page *page, unsigned long offset) | |||
274 | /* | 257 | /* |
275 | * release a page and cleanup its private data | 258 | * release a page and cleanup its private data |
276 | */ | 259 | */ |
277 | static int afs_file_releasepage(struct page *page, gfp_t gfp_flags) | 260 | static int afs_releasepage(struct page *page, gfp_t gfp_flags) |
278 | { | 261 | { |
279 | struct cachefs_page *pageio; | 262 | struct afs_vnode *vnode = AFS_FS_I(page->mapping->host); |
280 | 263 | ||
281 | _enter("{%lu},%x", page->index, gfp_flags); | 264 | _enter("{{%x:%u}[%lu],%lx},%x", |
265 | vnode->fid.vid, vnode->fid.vnode, page->index, page->flags, | ||
266 | gfp_flags); | ||
282 | 267 | ||
283 | if (PagePrivate(page)) { | 268 | if (PagePrivate(page)) { |
284 | #ifdef AFS_CACHING_SUPPORT | ||
285 | struct afs_vnode *vnode = AFS_FS_I(page->mapping->host); | ||
286 | cachefs_uncache_page(vnode->cache, page); | ||
287 | #endif | ||
288 | |||
289 | pageio = (struct cachefs_page *) page_private(page); | ||
290 | set_page_private(page, 0); | 269 | set_page_private(page, 0); |
291 | ClearPagePrivate(page); | 270 | ClearPagePrivate(page); |
292 | |||
293 | kfree(pageio); | ||
294 | } | 271 | } |
295 | 272 | ||
296 | _leave(" = 0"); | 273 | _leave(" = 0"); |