reiserfs: use buffer_info for leaf_paste_entries
authorJeff Mahoney <jeffm@suse.com>
Mon, 30 Mar 2009 18:02:18 +0000 (14:02 -0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 30 Mar 2009 19:16:35 +0000 (12:16 -0700)
This patch makes leaf_paste_entries more consistent with respect to the
other leaf operations.  Using buffer_info instead of buffer_head
directly allows us to get a superblock pointer for use in error
handling.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/reiserfs/do_balan.c
fs/reiserfs/lbalance.c
include/linux/reiserfs_fs.h

index 2f87f5b14630e2323c9e91c784adc8affb0b1831..99f80538c4bf90a00ef499ae6af8a28615f0c38d 100644 (file)
@@ -449,8 +449,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih,      /* item h
                                                        /* when we have merge directory item, pos_in_item has been changed too */
 
                                                        /* paste new directory entry. 1 is entry number */
-                                                       leaf_paste_entries(bi.
-                                                                          bi_bh,
+                                                       leaf_paste_entries(&bi,
                                                                           n +
                                                                           item_pos
                                                                           -
@@ -699,7 +698,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih,      /* item h
                                                           n + item_pos -
                                                           ret_val);
                                        if (is_direntry_le_ih(pasted))
-                                               leaf_paste_entries(bi.bi_bh,
+                                               leaf_paste_entries(&bi,
                                                                   n +
                                                                   item_pos -
                                                                   ret_val,
@@ -894,8 +893,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih,      /* item h
                                                             tb->insert_size[0],
                                                             body, zeros_num);
                                                        /* paste entry */
-                                                       leaf_paste_entries(bi.
-                                                                          bi_bh,
+                                                       leaf_paste_entries(&bi,
                                                                           0,
                                                                           paste_entry_position,
                                                                           1,
@@ -1096,7 +1094,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih,    /* item h
                                                           tb->rnum[0]);
                                        if (is_direntry_le_ih(pasted)
                                            && pos_in_item >= 0) {
-                                               leaf_paste_entries(bi.bi_bh,
+                                               leaf_paste_entries(&bi,
                                                                   item_pos -
                                                                   n +
                                                                   tb->rnum[0],
@@ -1339,8 +1337,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih,    /* item h
                                                             tb->insert_size[0],
                                                             body, zeros_num);
                                                        /* paste new directory entry */
-                                                       leaf_paste_entries(bi.
-                                                                          bi_bh,
+                                                       leaf_paste_entries(&bi,
                                                                           0,
                                                                           pos_in_item
                                                                           -
@@ -1505,7 +1502,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih,    /* item h
                                                           item_pos - n +
                                                           snum[i]);
                                        if (is_direntry_le_ih(pasted)) {
-                                               leaf_paste_entries(bi.bi_bh,
+                                               leaf_paste_entries(&bi,
                                                                   item_pos -
                                                                   n + snum[i],
                                                                   pos_in_item,
@@ -1606,7 +1603,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih,    /* item h
                                                                     zeros_num);
 
                                                /* paste entry */
-                                               leaf_paste_entries(bi.bi_bh,
+                                               leaf_paste_entries(&bi,
                                                                   item_pos,
                                                                   pos_in_item,
                                                                   1,
index 6de060a6aa7fc79c04a6f1d3d3a6b70648bd2af6..41bdd8c75887a4ae60be077f3231d08a3c0cb313 100644 (file)
@@ -111,7 +111,7 @@ static void leaf_copy_dir_entries(struct buffer_info *dest_bi,
        item_num_in_dest =
            (last_first == FIRST_TO_LAST) ? (B_NR_ITEMS(dest) - 1) : 0;
 
-       leaf_paste_entries(dest_bi->bi_bh, item_num_in_dest,
+       leaf_paste_entries(dest_bi, item_num_in_dest,
                           (last_first ==
                            FIRST_TO_LAST) ? I_ENTRY_COUNT(B_N_PITEM_HEAD(dest,
                                                                          item_num_in_dest))
@@ -1191,7 +1191,7 @@ static void leaf_delete_items_entirely(struct buffer_info *bi,
 }
 
 /* paste new_entry_count entries (new_dehs, records) into position before to item_num-th item */
-void leaf_paste_entries(struct buffer_head *bh,
+void leaf_paste_entries(struct buffer_info *bi,
                        int item_num,
                        int before,
                        int new_entry_count,
@@ -1203,6 +1203,7 @@ void leaf_paste_entries(struct buffer_head *bh,
        struct reiserfs_de_head *deh;
        char *insert_point;
        int i, old_entry_num;
+       struct buffer_head *bh = bi->bi_bh;
 
        if (new_entry_count == 0)
                return;
index bd52b949f8c90cbc6c294fc5c97c28f5198ac361..65bb5e3e3abeb65e569be839df0b61adcc535c44 100644 (file)
@@ -2026,7 +2026,7 @@ void leaf_paste_in_buffer(struct buffer_info *bi, int pasted_item_num,
                          int zeros_number);
 void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num,
                          int pos_in_item, int cut_size);
-void leaf_paste_entries(struct buffer_head *bh, int item_num, int before,
+void leaf_paste_entries(struct buffer_info *bi, int item_num, int before,
                        int new_entry_count, struct reiserfs_de_head *new_dehs,
                        const char *records, int paste_size);
 /* ibalance.c */