btrfs: use list_for_each_entry* in backref.c
Use list_for_each_entry*() to simplify the code. Signed-off-by: Geliang Tang <geliangtang@163.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
7ae1681e12
commit
a7ca42256d
|
@ -520,13 +520,10 @@ static inline int ref_for_same_block(struct __prelim_ref *ref1,
|
||||||
static int __add_missing_keys(struct btrfs_fs_info *fs_info,
|
static int __add_missing_keys(struct btrfs_fs_info *fs_info,
|
||||||
struct list_head *head)
|
struct list_head *head)
|
||||||
{
|
{
|
||||||
struct list_head *pos;
|
struct __prelim_ref *ref;
|
||||||
struct extent_buffer *eb;
|
struct extent_buffer *eb;
|
||||||
|
|
||||||
list_for_each(pos, head) {
|
list_for_each_entry(ref, head, list) {
|
||||||
struct __prelim_ref *ref;
|
|
||||||
ref = list_entry(pos, struct __prelim_ref, list);
|
|
||||||
|
|
||||||
if (ref->parent)
|
if (ref->parent)
|
||||||
continue;
|
continue;
|
||||||
if (ref->key_for_search.type)
|
if (ref->key_for_search.type)
|
||||||
|
@ -563,23 +560,15 @@ static int __add_missing_keys(struct btrfs_fs_info *fs_info,
|
||||||
*/
|
*/
|
||||||
static void __merge_refs(struct list_head *head, int mode)
|
static void __merge_refs(struct list_head *head, int mode)
|
||||||
{
|
{
|
||||||
struct list_head *pos1;
|
struct __prelim_ref *ref1;
|
||||||
|
|
||||||
list_for_each(pos1, head) {
|
list_for_each_entry(ref1, head, list) {
|
||||||
struct list_head *n2;
|
struct __prelim_ref *ref2 = ref1, *tmp;
|
||||||
struct list_head *pos2;
|
|
||||||
struct __prelim_ref *ref1;
|
|
||||||
|
|
||||||
ref1 = list_entry(pos1, struct __prelim_ref, list);
|
list_for_each_entry_safe_continue(ref2, tmp, head, list) {
|
||||||
|
|
||||||
for (pos2 = pos1->next, n2 = pos2->next; pos2 != head;
|
|
||||||
pos2 = n2, n2 = pos2->next) {
|
|
||||||
struct __prelim_ref *ref2;
|
|
||||||
struct __prelim_ref *xchg;
|
struct __prelim_ref *xchg;
|
||||||
struct extent_inode_elem *eie;
|
struct extent_inode_elem *eie;
|
||||||
|
|
||||||
ref2 = list_entry(pos2, struct __prelim_ref, list);
|
|
||||||
|
|
||||||
if (!ref_for_same_block(ref1, ref2))
|
if (!ref_for_same_block(ref1, ref2))
|
||||||
continue;
|
continue;
|
||||||
if (mode == 1) {
|
if (mode == 1) {
|
||||||
|
|
Loading…
Reference in New Issue