Commit 3150b699 authored by Xiao Guangrong's avatar Xiao Guangrong Committed by Chris Mason

Btrfs: clean up for insert_state()

Don't duplicate set_state_bits().
Signed-off-by: default avatarXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 3a6d457e
...@@ -303,6 +303,9 @@ static void clear_state_cb(struct extent_io_tree *tree, ...@@ -303,6 +303,9 @@ static void clear_state_cb(struct extent_io_tree *tree,
tree->ops->clear_bit_hook(tree->mapping->host, state, bits); tree->ops->clear_bit_hook(tree->mapping->host, state, bits);
} }
static void set_state_bits(struct extent_io_tree *tree,
struct extent_state *state, int *bits);
/* /*
* insert an extent_state struct into the tree. 'bits' are set on the * insert an extent_state struct into the tree. 'bits' are set on the
* struct before it is inserted. * struct before it is inserted.
...@@ -318,7 +321,6 @@ static int insert_state(struct extent_io_tree *tree, ...@@ -318,7 +321,6 @@ static int insert_state(struct extent_io_tree *tree,
int *bits) int *bits)
{ {
struct rb_node *node; struct rb_node *node;
int bits_to_set = *bits & ~EXTENT_CTLBITS;
if (end < start) { if (end < start) {
printk(KERN_ERR "btrfs end < start %llu %llu\n", printk(KERN_ERR "btrfs end < start %llu %llu\n",
...@@ -328,11 +330,9 @@ static int insert_state(struct extent_io_tree *tree, ...@@ -328,11 +330,9 @@ static int insert_state(struct extent_io_tree *tree,
} }
state->start = start; state->start = start;
state->end = end; state->end = end;
set_state_cb(tree, state, bits);
if (bits_to_set & EXTENT_DIRTY) set_state_bits(tree, state, bits);
tree->dirty_bytes += end - start + 1;
state->state |= bits_to_set;
node = tree_insert(&tree->state, end, &state->rb_node); node = tree_insert(&tree->state, end, &state->rb_node);
if (node) { if (node) {
struct extent_state *found; struct extent_state *found;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment