diff options
author | Li Hong <lihong.hi@gmail.com> | 2010-04-05 12:54:11 -0400 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-05-09 22:32:30 -0400 |
commit | 41c88bd74d372db5102996a4ea6167a725c24b5e (patch) | |
tree | 98b8e208d41f7760458e82569e297843415bbe7d /fs/nilfs2/segbuf.c | |
parent | aaed1d5bfac459ead9aaad324e7fe3326250f50a (diff) |
nilfs2: cleanup multi kmem_cache_{create,destroy} code
This cleanup patch gives several improvements:
- Moving all kmem_cache_{create_destroy} calls into one place, which removes
some small function calls, cleans up error check code and clarify the logic.
- Mark all initial code in __init section.
- Remove some very obvious comments.
- Adjust some declarations.
- Fix some space-tab issues.
Signed-off-by: Li Hong <lihong.hi@gmail.com>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/segbuf.c')
-rw-r--r-- | fs/nilfs2/segbuf.c | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c index 6bf3b1f3406e..9f83bc02593c 100644 --- a/fs/nilfs2/segbuf.c +++ b/fs/nilfs2/segbuf.c | |||
@@ -40,35 +40,10 @@ struct nilfs_write_info { | |||
40 | sector_t blocknr; | 40 | sector_t blocknr; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | |||
44 | static int nilfs_segbuf_write(struct nilfs_segment_buffer *segbuf, | 43 | static int nilfs_segbuf_write(struct nilfs_segment_buffer *segbuf, |
45 | struct the_nilfs *nilfs); | 44 | struct the_nilfs *nilfs); |
46 | static int nilfs_segbuf_wait(struct nilfs_segment_buffer *segbuf); | 45 | static int nilfs_segbuf_wait(struct nilfs_segment_buffer *segbuf); |
47 | 46 | ||
48 | |||
49 | static struct kmem_cache *nilfs_segbuf_cachep; | ||
50 | |||
51 | static void nilfs_segbuf_init_once(void *obj) | ||
52 | { | ||
53 | memset(obj, 0, sizeof(struct nilfs_segment_buffer)); | ||
54 | } | ||
55 | |||
56 | int __init nilfs_init_segbuf_cache(void) | ||
57 | { | ||
58 | nilfs_segbuf_cachep = | ||
59 | kmem_cache_create("nilfs2_segbuf_cache", | ||
60 | sizeof(struct nilfs_segment_buffer), | ||
61 | 0, SLAB_RECLAIM_ACCOUNT, | ||
62 | nilfs_segbuf_init_once); | ||
63 | |||
64 | return (nilfs_segbuf_cachep == NULL) ? -ENOMEM : 0; | ||
65 | } | ||
66 | |||
67 | void nilfs_destroy_segbuf_cache(void) | ||
68 | { | ||
69 | kmem_cache_destroy(nilfs_segbuf_cachep); | ||
70 | } | ||
71 | |||
72 | struct nilfs_segment_buffer *nilfs_segbuf_new(struct super_block *sb) | 47 | struct nilfs_segment_buffer *nilfs_segbuf_new(struct super_block *sb) |
73 | { | 48 | { |
74 | struct nilfs_segment_buffer *segbuf; | 49 | struct nilfs_segment_buffer *segbuf; |