f2fs: move extent_node list operations being coupled with rbtree operation
This patch moves extent_node list operations to be handled together with its rbtree operations. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
a03f01f267
commit
43a2fa180e
|
@ -360,10 +360,16 @@ static struct extent_node *__try_merge_extent_node(struct f2fs_sb_info *sbi,
|
||||||
en = next_ex;
|
en = next_ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (en) {
|
if (!en)
|
||||||
__try_update_largest_extent(et, en);
|
return NULL;
|
||||||
et->cached_en = en;
|
|
||||||
}
|
__try_update_largest_extent(et, en);
|
||||||
|
et->cached_en = en;
|
||||||
|
|
||||||
|
spin_lock(&sbi->extent_lock);
|
||||||
|
if (!list_empty(&en->list))
|
||||||
|
list_move_tail(&en->list, &sbi->extent_list);
|
||||||
|
spin_unlock(&sbi->extent_lock);
|
||||||
return en;
|
return en;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,6 +406,11 @@ do_insert:
|
||||||
|
|
||||||
__try_update_largest_extent(et, en);
|
__try_update_largest_extent(et, en);
|
||||||
et->cached_en = en;
|
et->cached_en = en;
|
||||||
|
|
||||||
|
/* update in global extent list */
|
||||||
|
spin_lock(&sbi->extent_lock);
|
||||||
|
list_add_tail(&en->list, &sbi->extent_list);
|
||||||
|
spin_unlock(&sbi->extent_lock);
|
||||||
return en;
|
return en;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,13 +509,6 @@ static unsigned int f2fs_update_extent_tree_range(struct inode *inode,
|
||||||
insert_p = NULL;
|
insert_p = NULL;
|
||||||
insert_parent = NULL;
|
insert_parent = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update in global extent list */
|
|
||||||
spin_lock(&sbi->extent_lock);
|
|
||||||
if (en1)
|
|
||||||
list_add_tail(&en1->list, &sbi->extent_list);
|
|
||||||
spin_unlock(&sbi->extent_lock);
|
|
||||||
|
|
||||||
en = next_en;
|
en = next_en;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,9 +516,8 @@ static unsigned int f2fs_update_extent_tree_range(struct inode *inode,
|
||||||
if (blkaddr) {
|
if (blkaddr) {
|
||||||
|
|
||||||
set_extent_info(&ei, fofs, blkaddr, len);
|
set_extent_info(&ei, fofs, blkaddr, len);
|
||||||
en1 = __try_merge_extent_node(sbi, et, &ei, prev_en, next_en);
|
if (!__try_merge_extent_node(sbi, et, &ei, prev_en, next_en))
|
||||||
if (!en1)
|
__insert_extent_tree(sbi, et, &ei,
|
||||||
en1 = __insert_extent_tree(sbi, et, &ei,
|
|
||||||
insert_p, insert_parent);
|
insert_p, insert_parent);
|
||||||
|
|
||||||
/* give up extent_cache, if split and small updates happen */
|
/* give up extent_cache, if split and small updates happen */
|
||||||
|
@ -524,15 +527,6 @@ static unsigned int f2fs_update_extent_tree_range(struct inode *inode,
|
||||||
et->largest.len = 0;
|
et->largest.len = 0;
|
||||||
set_inode_flag(F2FS_I(inode), FI_NO_EXTENT);
|
set_inode_flag(F2FS_I(inode), FI_NO_EXTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_lock(&sbi->extent_lock);
|
|
||||||
if (en1) {
|
|
||||||
if (list_empty(&en1->list))
|
|
||||||
list_add_tail(&en1->list, &sbi->extent_list);
|
|
||||||
else
|
|
||||||
list_move_tail(&en1->list, &sbi->extent_list);
|
|
||||||
}
|
|
||||||
spin_unlock(&sbi->extent_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_inode_flag_set(F2FS_I(inode), FI_NO_EXTENT))
|
if (is_inode_flag_set(F2FS_I(inode), FI_NO_EXTENT))
|
||||||
|
|
Loading…
Reference in New Issue