diff options
Diffstat (limited to 'fs/ext4/namei.c')
-rw-r--r-- | fs/ext4/namei.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 77a63ff4aeb9..8cef115ee64a 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -877,6 +877,7 @@ static int htree_dirblock_to_tree(struct file *dir_file, | |||
877 | struct buffer_head *bh; | 877 | struct buffer_head *bh; |
878 | struct ext4_dir_entry_2 *de, *top; | 878 | struct ext4_dir_entry_2 *de, *top; |
879 | int err = 0, count = 0; | 879 | int err = 0, count = 0; |
880 | struct ext4_str tmp_str; | ||
880 | 881 | ||
881 | dxtrace(printk(KERN_INFO "In htree dirblock_to_tree: block %lu\n", | 882 | dxtrace(printk(KERN_INFO "In htree dirblock_to_tree: block %lu\n", |
882 | (unsigned long)block)); | 883 | (unsigned long)block)); |
@@ -903,8 +904,11 @@ static int htree_dirblock_to_tree(struct file *dir_file, | |||
903 | continue; | 904 | continue; |
904 | if (de->inode == 0) | 905 | if (de->inode == 0) |
905 | continue; | 906 | continue; |
906 | if ((err = ext4_htree_store_dirent(dir_file, | 907 | tmp_str.name = de->name; |
907 | hinfo->hash, hinfo->minor_hash, de)) != 0) { | 908 | tmp_str.len = de->name_len; |
909 | err = ext4_htree_store_dirent(dir_file, | ||
910 | hinfo->hash, hinfo->minor_hash, de, &tmp_str); | ||
911 | if (err != 0) { | ||
908 | brelse(bh); | 912 | brelse(bh); |
909 | return err; | 913 | return err; |
910 | } | 914 | } |
@@ -934,6 +938,7 @@ int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash, | |||
934 | int count = 0; | 938 | int count = 0; |
935 | int ret, err; | 939 | int ret, err; |
936 | __u32 hashval; | 940 | __u32 hashval; |
941 | struct ext4_str tmp_str; | ||
937 | 942 | ||
938 | dxtrace(printk(KERN_DEBUG "In htree_fill_tree, start hash: %x:%x\n", | 943 | dxtrace(printk(KERN_DEBUG "In htree_fill_tree, start hash: %x:%x\n", |
939 | start_hash, start_minor_hash)); | 944 | start_hash, start_minor_hash)); |
@@ -969,14 +974,22 @@ int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash, | |||
969 | /* Add '.' and '..' from the htree header */ | 974 | /* Add '.' and '..' from the htree header */ |
970 | if (!start_hash && !start_minor_hash) { | 975 | if (!start_hash && !start_minor_hash) { |
971 | de = (struct ext4_dir_entry_2 *) frames[0].bh->b_data; | 976 | de = (struct ext4_dir_entry_2 *) frames[0].bh->b_data; |
972 | if ((err = ext4_htree_store_dirent(dir_file, 0, 0, de)) != 0) | 977 | tmp_str.name = de->name; |
978 | tmp_str.len = de->name_len; | ||
979 | err = ext4_htree_store_dirent(dir_file, 0, 0, | ||
980 | de, &tmp_str); | ||
981 | if (err != 0) | ||
973 | goto errout; | 982 | goto errout; |
974 | count++; | 983 | count++; |
975 | } | 984 | } |
976 | if (start_hash < 2 || (start_hash ==2 && start_minor_hash==0)) { | 985 | if (start_hash < 2 || (start_hash ==2 && start_minor_hash==0)) { |
977 | de = (struct ext4_dir_entry_2 *) frames[0].bh->b_data; | 986 | de = (struct ext4_dir_entry_2 *) frames[0].bh->b_data; |
978 | de = ext4_next_entry(de, dir->i_sb->s_blocksize); | 987 | de = ext4_next_entry(de, dir->i_sb->s_blocksize); |
979 | if ((err = ext4_htree_store_dirent(dir_file, 2, 0, de)) != 0) | 988 | tmp_str.name = de->name; |
989 | tmp_str.len = de->name_len; | ||
990 | err = ext4_htree_store_dirent(dir_file, 2, 0, | ||
991 | de, &tmp_str); | ||
992 | if (err != 0) | ||
980 | goto errout; | 993 | goto errout; |
981 | count++; | 994 | count++; |
982 | } | 995 | } |