aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLiu Hui <onlyflyer@gmail.com>2008-11-18 11:30:10 -0500
committerChris Mason <chris.mason@oracle.com>2008-11-18 11:30:10 -0500
commitb4eec2ca1167bae46295aeb66abd15fd52387845 (patch)
treebad79258bb437341611116d951f7a8711c4473a0 /fs
parentea9e8b11bd1252dcbc23afefcf1a52ec6aa3c113 (diff)
Btrfs: Some fixes for batching extent insert.
In insert_extents(), when ret==1 and last is not zero, it should check if the current inserted item is the last item in this batching inserts. If so, it should just break from loop. If not, 'cur = insert_list->next' will make no sense because the list is empty now, and 'op' will point to an unexpectable place. There are also some trivial fixs in this patch including one comment typo error and deleting two redundant lines. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/ctree.c2
-rw-r--r--fs/btrfs/extent-tree.c10
2 files changed, 7 insertions, 5 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index dd1c03aea2df..71ef0a2e2daa 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -3041,7 +3041,6 @@ int btrfs_insert_some_items(struct btrfs_trans_handle *trans,
3041 struct btrfs_item *item; 3041 struct btrfs_item *item;
3042 int ret = 0; 3042 int ret = 0;
3043 int slot; 3043 int slot;
3044 int slot_orig;
3045 int i; 3044 int i;
3046 u32 nritems; 3045 u32 nritems;
3047 u32 total_data = 0; 3046 u32 total_data = 0;
@@ -3064,7 +3063,6 @@ int btrfs_insert_some_items(struct btrfs_trans_handle *trans,
3064 if (ret < 0) 3063 if (ret < 0)
3065 goto out; 3064 goto out;
3066 3065
3067 slot_orig = path->slots[0];
3068 leaf = path->nodes[0]; 3066 leaf = path->nodes[0];
3069 3067
3070 nritems = btrfs_header_nritems(leaf); 3068 nritems = btrfs_header_nritems(leaf);
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index b0f2241274fd..1121d518bf8c 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -798,9 +798,12 @@ static int noinline insert_extents(struct btrfs_trans_handle *trans,
798 */ 798 */
799 i = last; 799 i = last;
800 last = 0; 800 last = 0;
801 cur = insert_list->next;
802 op = list_entry(cur, struct pending_extent_op, list);
803 total--; 801 total--;
802 if (i < total) {
803 cur = insert_list->next;
804 op = list_entry(cur, struct pending_extent_op,
805 list);
806 }
804 } else { 807 } else {
805 i += ret; 808 i += ret;
806 } 809 }
@@ -2150,6 +2153,7 @@ again:
2150 if (ret) { 2153 if (ret) {
2151 if (skipped && all && !num_inserts) { 2154 if (skipped && all && !num_inserts) {
2152 skipped = 0; 2155 skipped = 0;
2156 search = 0;
2153 continue; 2157 continue;
2154 } 2158 }
2155 mutex_unlock(&info->extent_ins_mutex); 2159 mutex_unlock(&info->extent_ins_mutex);
@@ -2189,7 +2193,7 @@ again:
2189 } 2193 }
2190 2194
2191 /* 2195 /*
2192 * process teh update list, clear the writeback bit for it, and if 2196 * process the update list, clear the writeback bit for it, and if
2193 * somebody marked this thing for deletion then just unlock it and be 2197 * somebody marked this thing for deletion then just unlock it and be
2194 * done, the free_extents will handle it 2198 * done, the free_extents will handle it
2195 */ 2199 */