提交 b4eec2ca 编写于 作者: L Liu Hui 提交者: Chris Mason

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: NChris Mason <chris.mason@oracle.com>
上级 ea9e8b11
...@@ -3041,7 +3041,6 @@ int btrfs_insert_some_items(struct btrfs_trans_handle *trans, ...@@ -3041,7 +3041,6 @@ int btrfs_insert_some_items(struct btrfs_trans_handle *trans,
struct btrfs_item *item; struct btrfs_item *item;
int ret = 0; int ret = 0;
int slot; int slot;
int slot_orig;
int i; int i;
u32 nritems; u32 nritems;
u32 total_data = 0; u32 total_data = 0;
...@@ -3064,7 +3063,6 @@ int btrfs_insert_some_items(struct btrfs_trans_handle *trans, ...@@ -3064,7 +3063,6 @@ int btrfs_insert_some_items(struct btrfs_trans_handle *trans,
if (ret < 0) if (ret < 0)
goto out; goto out;
slot_orig = path->slots[0];
leaf = path->nodes[0]; leaf = path->nodes[0];
nritems = btrfs_header_nritems(leaf); nritems = btrfs_header_nritems(leaf);
......
...@@ -798,9 +798,12 @@ static int noinline insert_extents(struct btrfs_trans_handle *trans, ...@@ -798,9 +798,12 @@ static int noinline insert_extents(struct btrfs_trans_handle *trans,
*/ */
i = last; i = last;
last = 0; last = 0;
cur = insert_list->next;
op = list_entry(cur, struct pending_extent_op, list);
total--; total--;
if (i < total) {
cur = insert_list->next;
op = list_entry(cur, struct pending_extent_op,
list);
}
} else { } else {
i += ret; i += ret;
} }
...@@ -2150,6 +2153,7 @@ static int finish_current_insert(struct btrfs_trans_handle *trans, ...@@ -2150,6 +2153,7 @@ static int finish_current_insert(struct btrfs_trans_handle *trans,
if (ret) { if (ret) {
if (skipped && all && !num_inserts) { if (skipped && all && !num_inserts) {
skipped = 0; skipped = 0;
search = 0;
continue; continue;
} }
mutex_unlock(&info->extent_ins_mutex); mutex_unlock(&info->extent_ins_mutex);
...@@ -2189,7 +2193,7 @@ static int finish_current_insert(struct btrfs_trans_handle *trans, ...@@ -2189,7 +2193,7 @@ static int finish_current_insert(struct btrfs_trans_handle *trans,
} }
/* /*
* process teh update list, clear the writeback bit for it, and if * process the update list, clear the writeback bit for it, and if
* somebody marked this thing for deletion then just unlock it and be * somebody marked this thing for deletion then just unlock it and be
* done, the free_extents will handle it * done, the free_extents will handle it
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册