aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/reiserfs/do_balan.c5
-rw-r--r--fs/reiserfs/lbalance.c10
-rw-r--r--include/linux/reiserfs_fs.h47
3 files changed, 47 insertions, 15 deletions
diff --git a/fs/reiserfs/do_balan.c b/fs/reiserfs/do_balan.c
index 4beb964a2a3e..128d3f7c8aa5 100644
--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -1270,9 +1270,8 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
1270 1270
1271 RFALSE(ih, "PAP-12210: ih must be 0"); 1271 RFALSE(ih, "PAP-12210: ih must be 0");
1272 1272
1273 if (is_direntry_le_ih 1273 aux_ih = B_N_PITEM_HEAD(tbS0, item_pos);
1274 (aux_ih = 1274 if (is_direntry_le_ih(aux_ih)) {
1275 B_N_PITEM_HEAD(tbS0, item_pos))) {
1276 /* we append to directory item */ 1275 /* we append to directory item */
1277 1276
1278 int entry_count; 1277 int entry_count;
diff --git a/fs/reiserfs/lbalance.c b/fs/reiserfs/lbalance.c
index 381750a155f6..03d85cbf90bf 100644
--- a/fs/reiserfs/lbalance.c
+++ b/fs/reiserfs/lbalance.c
@@ -390,7 +390,8 @@ static void leaf_item_bottle(struct buffer_info *dest_bi,
390 390
391 if (last_first == FIRST_TO_LAST) { 391 if (last_first == FIRST_TO_LAST) {
392 /* if ( if item in position item_num in buffer SOURCE is directory item ) */ 392 /* if ( if item in position item_num in buffer SOURCE is directory item ) */
393 if (is_direntry_le_ih(ih = B_N_PITEM_HEAD(src, item_num))) 393 ih = B_N_PITEM_HEAD(src, item_num);
394 if (is_direntry_le_ih(ih))
394 leaf_copy_dir_entries(dest_bi, src, FIRST_TO_LAST, 395 leaf_copy_dir_entries(dest_bi, src, FIRST_TO_LAST,
395 item_num, 0, cpy_bytes); 396 item_num, 0, cpy_bytes);
396 else { 397 else {
@@ -418,7 +419,8 @@ static void leaf_item_bottle(struct buffer_info *dest_bi,
418 } 419 }
419 } else { 420 } else {
420 /* if ( if item in position item_num in buffer SOURCE is directory item ) */ 421 /* if ( if item in position item_num in buffer SOURCE is directory item ) */
421 if (is_direntry_le_ih(ih = B_N_PITEM_HEAD(src, item_num))) 422 ih = B_N_PITEM_HEAD(src, item_num);
423 if (is_direntry_le_ih(ih))
422 leaf_copy_dir_entries(dest_bi, src, LAST_TO_FIRST, 424 leaf_copy_dir_entries(dest_bi, src, LAST_TO_FIRST,
423 item_num, 425 item_num,
424 I_ENTRY_COUNT(ih) - cpy_bytes, 426 I_ENTRY_COUNT(ih) - cpy_bytes,
@@ -774,8 +776,8 @@ void leaf_delete_items(struct buffer_info *cur_bi, int last_first,
774 leaf_delete_items_entirely(cur_bi, first + 1, 776 leaf_delete_items_entirely(cur_bi, first + 1,
775 del_num - 1); 777 del_num - 1);
776 778
777 if (is_direntry_le_ih 779 ih = B_N_PITEM_HEAD(bh, B_NR_ITEMS(bh) - 1);
778 (ih = B_N_PITEM_HEAD(bh, B_NR_ITEMS(bh) - 1))) 780 if (is_direntry_le_ih(ih))
779 /* the last item is directory */ 781 /* the last item is directory */
780 /* len = numbers of directory entries in this item */ 782 /* len = numbers of directory entries in this item */
781 len = ih_entry_count(ih); 783 len = ih_entry_count(ih);
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 2245c78d5876..dd31e7bae35c 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -660,23 +660,54 @@ static inline void set_le_key_k_type(int version, struct reiserfs_key *key,
660 cpu_to_le32(type2uniqueness(type))) 660 cpu_to_le32(type2uniqueness(type)))
661 : (void)(set_offset_v2_k_type(&(key->u.k_offset_v2), type)); 661 : (void)(set_offset_v2_k_type(&(key->u.k_offset_v2), type));
662} 662}
663
663static inline void set_le_ih_k_type(struct item_head *ih, int type) 664static inline void set_le_ih_k_type(struct item_head *ih, int type)
664{ 665{
665 set_le_key_k_type(ih_version(ih), &(ih->ih_key), type); 666 set_le_key_k_type(ih_version(ih), &(ih->ih_key), type);
666} 667}
667 668
668#define is_direntry_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRENTRY) 669static inline int is_direntry_le_key(int version, struct reiserfs_key *key)
669#define is_direct_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRECT) 670{
670#define is_indirect_le_key(version,key) (le_key_k_type (version, key) == TYPE_INDIRECT) 671 return le_key_k_type(version, key) == TYPE_DIRENTRY;
671#define is_statdata_le_key(version,key) (le_key_k_type (version, key) == TYPE_STAT_DATA) 672}
673
674static inline int is_direct_le_key(int version, struct reiserfs_key *key)
675{
676 return le_key_k_type(version, key) == TYPE_DIRECT;
677}
678
679static inline int is_indirect_le_key(int version, struct reiserfs_key *key)
680{
681 return le_key_k_type(version, key) == TYPE_INDIRECT;
682}
683
684static inline int is_statdata_le_key(int version, struct reiserfs_key *key)
685{
686 return le_key_k_type(version, key) == TYPE_STAT_DATA;
687}
672 688
673// 689//
674// item header has version. 690// item header has version.
675// 691//
676#define is_direntry_le_ih(ih) is_direntry_le_key (ih_version (ih), &((ih)->ih_key)) 692static inline int is_direntry_le_ih(struct item_head *ih)
677#define is_direct_le_ih(ih) is_direct_le_key (ih_version (ih), &((ih)->ih_key)) 693{
678#define is_indirect_le_ih(ih) is_indirect_le_key (ih_version(ih), &((ih)->ih_key)) 694 return is_direntry_le_key(ih_version(ih), &ih->ih_key);
679#define is_statdata_le_ih(ih) is_statdata_le_key (ih_version (ih), &((ih)->ih_key)) 695}
696
697static inline int is_direct_le_ih(struct item_head *ih)
698{
699 return is_direct_le_key(ih_version(ih), &ih->ih_key);
700}
701
702static inline int is_indirect_le_ih(struct item_head *ih)
703{
704 return is_indirect_le_key(ih_version(ih), &ih->ih_key);
705}
706
707static inline int is_statdata_le_ih(struct item_head *ih)
708{
709 return is_statdata_le_key(ih_version(ih), &ih->ih_key);
710}
680 711
681// 712//
682// key is pointer to cpu key, result is cpu 713// key is pointer to cpu key, result is cpu