Add journal checksum patches. Also move
[ext4-patch-queue.git] / ext4-code-cleanup-in-rb-tree-and-dir.patch
blobaef01d24526eb01aedfe95fe23b391cd28020905
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>
15 ---
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
25 while (n) {
26 /* Do the node's children first */
27 - if ((n)->rb_left) {
28 + if (n->rb_left) {
29 n = n->rb_left;
30 continue;
32 @@ -301,24 +301,18 @@ static void free_rb_tree_fname(struct rb
33 parent->rb_right = NULL;
34 n = parent;
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);
47 if (!p)
48 return NULL;
49 - p->root.rb_node = NULL;
50 - p->curr_node = NULL;
51 - p->extra_fname = NULL;
52 - p->last_pos = 0;
53 p->curr_hash = pos2maj_hash(pos);
54 p->curr_minor_hash = pos2min_hash(pos);
55 - p->next_hash = 0;
56 return p;
59 @@ -433,7 +427,7 @@ static int ext4_dx_readdir(struct file *
60 int ret;
62 if (!info) {
63 - info = create_dir_info(filp->f_pos);
64 + info = ext4_htree_create_dir_info(filp->f_pos);
65 if (!info)
66 return -ENOMEM;
67 filp->private_data = info;