diff options
Diffstat (limited to 'fs/afs/super.c')
-rw-r--r-- | fs/afs/super.c | 62 |
1 files changed, 22 insertions, 40 deletions
diff --git a/fs/afs/super.c b/fs/afs/super.c index eb7e32349da3..0470a5c0b8a1 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c | |||
@@ -1,4 +1,5 @@ | |||
1 | /* | 1 | /* AFS superblock handling |
2 | * | ||
2 | * Copyright (c) 2002 Red Hat, Inc. All rights reserved. | 3 | * Copyright (c) 2002 Red Hat, Inc. All rights reserved. |
3 | * | 4 | * |
4 | * This software may be freely redistributed under the terms of the | 5 | * This software may be freely redistributed under the terms of the |
@@ -9,7 +10,7 @@ | |||
9 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 10 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
10 | * | 11 | * |
11 | * Authors: David Howells <dhowells@redhat.com> | 12 | * Authors: David Howells <dhowells@redhat.com> |
12 | * David Woodhouse <dwmw2@cambridge.redhat.com> | 13 | * David Woodhouse <dwmw2@redhat.com> |
13 | * | 14 | * |
14 | */ | 15 | */ |
15 | 16 | ||
@@ -68,7 +69,6 @@ static const struct super_operations afs_super_ops = { | |||
68 | static struct kmem_cache *afs_inode_cachep; | 69 | static struct kmem_cache *afs_inode_cachep; |
69 | static atomic_t afs_count_active_inodes; | 70 | static atomic_t afs_count_active_inodes; |
70 | 71 | ||
71 | /*****************************************************************************/ | ||
72 | /* | 72 | /* |
73 | * initialise the filesystem | 73 | * initialise the filesystem |
74 | */ | 74 | */ |
@@ -105,9 +105,8 @@ int __init afs_fs_init(void) | |||
105 | 105 | ||
106 | kleave(" = 0"); | 106 | kleave(" = 0"); |
107 | return 0; | 107 | return 0; |
108 | } /* end afs_fs_init() */ | 108 | } |
109 | 109 | ||
110 | /*****************************************************************************/ | ||
111 | /* | 110 | /* |
112 | * clean up the filesystem | 111 | * clean up the filesystem |
113 | */ | 112 | */ |
@@ -122,10 +121,8 @@ void __exit afs_fs_exit(void) | |||
122 | } | 121 | } |
123 | 122 | ||
124 | kmem_cache_destroy(afs_inode_cachep); | 123 | kmem_cache_destroy(afs_inode_cachep); |
124 | } | ||
125 | 125 | ||
126 | } /* end afs_fs_exit() */ | ||
127 | |||
128 | /*****************************************************************************/ | ||
129 | /* | 126 | /* |
130 | * check that an argument has a value | 127 | * check that an argument has a value |
131 | */ | 128 | */ |
@@ -136,9 +133,8 @@ static int want_arg(char **_value, const char *option) | |||
136 | return 0; | 133 | return 0; |
137 | } | 134 | } |
138 | return 1; | 135 | return 1; |
139 | } /* end want_arg() */ | 136 | } |
140 | 137 | ||
141 | /*****************************************************************************/ | ||
142 | /* | 138 | /* |
143 | * check that there's no subsequent value | 139 | * check that there's no subsequent value |
144 | */ | 140 | */ |
@@ -150,9 +146,8 @@ static int want_no_value(char *const *_value, const char *option) | |||
150 | return 0; | 146 | return 0; |
151 | } | 147 | } |
152 | return 1; | 148 | return 1; |
153 | } /* end want_no_value() */ | 149 | } |
154 | 150 | ||
155 | /*****************************************************************************/ | ||
156 | /* | 151 | /* |
157 | * parse the mount options | 152 | * parse the mount options |
158 | * - this function has been shamelessly adapted from the ext3 fs which | 153 | * - this function has been shamelessly adapted from the ext3 fs which |
@@ -183,14 +178,12 @@ static int afs_super_parse_options(struct afs_mount_params *params, | |||
183 | return -EINVAL; | 178 | return -EINVAL; |
184 | params->rwpath = 1; | 179 | params->rwpath = 1; |
185 | continue; | 180 | continue; |
186 | } | 181 | } else if (strcmp(key, "vol") == 0) { |
187 | else if (strcmp(key, "vol") == 0) { | ||
188 | if (!want_arg(&value, "vol")) | 182 | if (!want_arg(&value, "vol")) |
189 | return -EINVAL; | 183 | return -EINVAL; |
190 | *devname = value; | 184 | *devname = value; |
191 | continue; | 185 | continue; |
192 | } | 186 | } else if (strcmp(key, "cell") == 0) { |
193 | else if (strcmp(key, "cell") == 0) { | ||
194 | if (!want_arg(&value, "cell")) | 187 | if (!want_arg(&value, "cell")) |
195 | return -EINVAL; | 188 | return -EINVAL; |
196 | afs_put_cell(params->default_cell); | 189 | afs_put_cell(params->default_cell); |
@@ -209,12 +202,11 @@ static int afs_super_parse_options(struct afs_mount_params *params, | |||
209 | 202 | ||
210 | ret = 0; | 203 | ret = 0; |
211 | 204 | ||
212 | error: | 205 | error: |
213 | _leave(" = %d", ret); | 206 | _leave(" = %d", ret); |
214 | return ret; | 207 | return ret; |
215 | } /* end afs_super_parse_options() */ | 208 | } |
216 | 209 | ||
217 | /*****************************************************************************/ | ||
218 | /* | 210 | /* |
219 | * check a superblock to see if it's the one we're looking for | 211 | * check a superblock to see if it's the one we're looking for |
220 | */ | 212 | */ |
@@ -224,9 +216,8 @@ static int afs_test_super(struct super_block *sb, void *data) | |||
224 | struct afs_super_info *as = sb->s_fs_info; | 216 | struct afs_super_info *as = sb->s_fs_info; |
225 | 217 | ||
226 | return as->volume == params->volume; | 218 | return as->volume == params->volume; |
227 | } /* end afs_test_super() */ | 219 | } |
228 | 220 | ||
229 | /*****************************************************************************/ | ||
230 | /* | 221 | /* |
231 | * fill in the superblock | 222 | * fill in the superblock |
232 | */ | 223 | */ |
@@ -276,7 +267,7 @@ static int afs_fill_super(struct super_block *sb, void *data, int silent) | |||
276 | kleave(" = 0"); | 267 | kleave(" = 0"); |
277 | return 0; | 268 | return 0; |
278 | 269 | ||
279 | error: | 270 | error: |
280 | iput(inode); | 271 | iput(inode); |
281 | afs_put_volume(as->volume); | 272 | afs_put_volume(as->volume); |
282 | kfree(as); | 273 | kfree(as); |
@@ -285,9 +276,8 @@ static int afs_fill_super(struct super_block *sb, void *data, int silent) | |||
285 | 276 | ||
286 | kleave(" = %d", ret); | 277 | kleave(" = %d", ret); |
287 | return ret; | 278 | return ret; |
288 | } /* end afs_fill_super() */ | 279 | } |
289 | 280 | ||
290 | /*****************************************************************************/ | ||
291 | /* | 281 | /* |
292 | * get an AFS superblock | 282 | * get an AFS superblock |
293 | * - TODO: don't use get_sb_nodev(), but rather call sget() directly | 283 | * - TODO: don't use get_sb_nodev(), but rather call sget() directly |
@@ -354,15 +344,14 @@ static int afs_get_sb(struct file_system_type *fs_type, | |||
354 | _leave(" = 0 [%p]", 0, sb); | 344 | _leave(" = 0 [%p]", 0, sb); |
355 | return 0; | 345 | return 0; |
356 | 346 | ||
357 | error: | 347 | error: |
358 | afs_put_volume(params.volume); | 348 | afs_put_volume(params.volume); |
359 | afs_put_cell(params.default_cell); | 349 | afs_put_cell(params.default_cell); |
360 | afscm_stop(); | 350 | afscm_stop(); |
361 | _leave(" = %d", ret); | 351 | _leave(" = %d", ret); |
362 | return ret; | 352 | return ret; |
363 | } /* end afs_get_sb() */ | 353 | } |
364 | 354 | ||
365 | /*****************************************************************************/ | ||
366 | /* | 355 | /* |
367 | * finish the unmounting process on the superblock | 356 | * finish the unmounting process on the superblock |
368 | */ | 357 | */ |
@@ -376,16 +365,15 @@ static void afs_put_super(struct super_block *sb) | |||
376 | afscm_stop(); | 365 | afscm_stop(); |
377 | 366 | ||
378 | _leave(""); | 367 | _leave(""); |
379 | } /* end afs_put_super() */ | 368 | } |
380 | 369 | ||
381 | /*****************************************************************************/ | ||
382 | /* | 370 | /* |
383 | * initialise an inode cache slab element prior to any use | 371 | * initialise an inode cache slab element prior to any use |
384 | */ | 372 | */ |
385 | static void afs_i_init_once(void *_vnode, struct kmem_cache *cachep, | 373 | static void afs_i_init_once(void *_vnode, struct kmem_cache *cachep, |
386 | unsigned long flags) | 374 | unsigned long flags) |
387 | { | 375 | { |
388 | struct afs_vnode *vnode = (struct afs_vnode *) _vnode; | 376 | struct afs_vnode *vnode = _vnode; |
389 | 377 | ||
390 | if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == | 378 | if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == |
391 | SLAB_CTOR_CONSTRUCTOR) { | 379 | SLAB_CTOR_CONSTRUCTOR) { |
@@ -398,10 +386,8 @@ static void afs_i_init_once(void *_vnode, struct kmem_cache *cachep, | |||
398 | afs_timer_init(&vnode->cb_timeout, | 386 | afs_timer_init(&vnode->cb_timeout, |
399 | &afs_vnode_cb_timed_out_ops); | 387 | &afs_vnode_cb_timed_out_ops); |
400 | } | 388 | } |
389 | } | ||
401 | 390 | ||
402 | } /* end afs_i_init_once() */ | ||
403 | |||
404 | /*****************************************************************************/ | ||
405 | /* | 391 | /* |
406 | * allocate an AFS inode struct from our slab cache | 392 | * allocate an AFS inode struct from our slab cache |
407 | */ | 393 | */ |
@@ -409,8 +395,7 @@ static struct inode *afs_alloc_inode(struct super_block *sb) | |||
409 | { | 395 | { |
410 | struct afs_vnode *vnode; | 396 | struct afs_vnode *vnode; |
411 | 397 | ||
412 | vnode = (struct afs_vnode *) | 398 | vnode = kmem_cache_alloc(afs_inode_cachep, GFP_KERNEL); |
413 | kmem_cache_alloc(afs_inode_cachep, GFP_KERNEL); | ||
414 | if (!vnode) | 399 | if (!vnode) |
415 | return NULL; | 400 | return NULL; |
416 | 401 | ||
@@ -424,9 +409,8 @@ static struct inode *afs_alloc_inode(struct super_block *sb) | |||
424 | vnode->flags = 0; | 409 | vnode->flags = 0; |
425 | 410 | ||
426 | return &vnode->vfs_inode; | 411 | return &vnode->vfs_inode; |
427 | } /* end afs_alloc_inode() */ | 412 | } |
428 | 413 | ||
429 | /*****************************************************************************/ | ||
430 | /* | 414 | /* |
431 | * destroy an AFS inode struct | 415 | * destroy an AFS inode struct |
432 | */ | 416 | */ |
@@ -435,7 +419,5 @@ static void afs_destroy_inode(struct inode *inode) | |||
435 | _enter("{%lu}", inode->i_ino); | 419 | _enter("{%lu}", inode->i_ino); |
436 | 420 | ||
437 | kmem_cache_free(afs_inode_cachep, AFS_FS_I(inode)); | 421 | kmem_cache_free(afs_inode_cachep, AFS_FS_I(inode)); |
438 | |||
439 | atomic_dec(&afs_count_active_inodes); | 422 | atomic_dec(&afs_count_active_inodes); |
440 | 423 | } | |
441 | } /* end afs_destroy_inode() */ | ||