1 ext4: improve some code in rb tree part of dir.c
3 From: Shen Feng <shen@cn.fujitsu.com>
5 *remove unnecessary code in free_rb_tree_fname
6 *rename free_rb_tree_fname to ext4_htree_create_dir_info
7 since it and ext4_htree_free_dir_info are a pair
8 *replace kmalloc with kzalloc in ext4_htree_free_dir_info
10 All these make the code more readable and simple.
11 PS: this patch is also suitable for ext3.
13 Signed-off-by: Shen Feng <shen@cn.fujitsu.com>
14 Signed-off-by: Mingming Cao <cmm@us.ibm.com>
16 fs/ext4/dir.c | 14 ++++----------
17 1 file changed, 4 insertions(+), 10 deletions(-)
19 Index: linux-2.6.26-rc4/fs/ext4/dir.c
20 ===================================================================
21 --- linux-2.6.26-rc4.orig/fs/ext4/dir.c 2008-05-29 10:52:29.000000000 -0700
22 +++ linux-2.6.26-rc4/fs/ext4/dir.c 2008-05-29 10:52:33.000000000 -0700
23 @@ -272,7 +272,7 @@ static void free_rb_tree_fname(struct rb
26 /* Do the node's children first */
32 @@ -301,24 +301,18 @@ static void free_rb_tree_fname(struct rb
33 parent->rb_right = NULL;
36 - root->rb_node = NULL;
40 -static struct dir_private_info *create_dir_info(loff_t pos)
41 +static struct dir_private_info *ext4_htree_create_dir_info(loff_t pos)
43 struct dir_private_info *p;
45 - p = kmalloc(sizeof(struct dir_private_info), GFP_KERNEL);
46 + p = kzalloc(sizeof(struct dir_private_info), GFP_KERNEL);
49 - p->root.rb_node = NULL;
50 - p->curr_node = NULL;
51 - p->extra_fname = NULL;
53 p->curr_hash = pos2maj_hash(pos);
54 p->curr_minor_hash = pos2min_hash(pos);
59 @@ -433,7 +427,7 @@ static int ext4_dx_readdir(struct file *
63 - info = create_dir_info(filp->f_pos);
64 + info = ext4_htree_create_dir_info(filp->f_pos);
67 filp->private_data = info;