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>
此提交包含在:
Li Hong
2010-04-06 00:54:11 +08:00
提交者 Ryusuke Konishi
父節點 aaed1d5bfa
當前提交 41c88bd74d
共有 7 個檔案被更改,包括 98 行新增165 行删除

查看文件

@@ -40,35 +40,10 @@ struct nilfs_write_info {
sector_t blocknr;
};
static int nilfs_segbuf_write(struct nilfs_segment_buffer *segbuf,
struct the_nilfs *nilfs);
static int nilfs_segbuf_wait(struct nilfs_segment_buffer *segbuf);
static struct kmem_cache *nilfs_segbuf_cachep;
static void nilfs_segbuf_init_once(void *obj)
{
memset(obj, 0, sizeof(struct nilfs_segment_buffer));
}
int __init nilfs_init_segbuf_cache(void)
{
nilfs_segbuf_cachep =
kmem_cache_create("nilfs2_segbuf_cache",
sizeof(struct nilfs_segment_buffer),
0, SLAB_RECLAIM_ACCOUNT,
nilfs_segbuf_init_once);
return (nilfs_segbuf_cachep == NULL) ? -ENOMEM : 0;
}
void nilfs_destroy_segbuf_cache(void)
{
kmem_cache_destroy(nilfs_segbuf_cachep);
}
struct nilfs_segment_buffer *nilfs_segbuf_new(struct super_block *sb)
{
struct nilfs_segment_buffer *segbuf;