···4425442544264426 write_lock(&info->block_group_cache_lock);44274427 while (!list_empty(&info->caching_block_groups)) {44284428- caching_ctl = list_entry(info->caching_block_groups.next,44294429- struct btrfs_caching_control, list);44284428+ caching_ctl = list_first_entry(&info->caching_block_groups,44294429+ struct btrfs_caching_control, list);44304430 list_del(&caching_ctl->list);44314431 btrfs_put_caching_control(caching_ctl);44324432 }···44974497 btrfs_release_global_block_rsv(info);4498449844994499 while (!list_empty(&info->space_info)) {45004500- space_info = list_entry(info->space_info.next,45014501- struct btrfs_space_info,45024502- list);45004500+ space_info = list_first_entry(&info->space_info,45014501+ struct btrfs_space_info, list);4503450245044503 /*45054504 * Do not hide this behind enospc_debug, this is actually
+2-2
fs/btrfs/disk-io.c
···18571857 int i;1858185818591859 while (!list_empty(&fs_info->dead_roots)) {18601860- gang[0] = list_entry(fs_info->dead_roots.next,18611861- struct btrfs_root, root_list);18601860+ gang[0] = list_first_entry(&fs_info->dead_roots,18611861+ struct btrfs_root, root_list);18621862 list_del(&gang[0]->root_list);1863186318641864 if (test_bit(BTRFS_ROOT_IN_RADIX, &gang[0]->state))
+1-1
fs/btrfs/extent-io-tree.c
···4242 struct extent_state *state;43434444 while (!list_empty(&states)) {4545- state = list_entry(states.next, struct extent_state, leak_list);4545+ state = list_first_entry(&states, struct extent_state, leak_list);4646 pr_err("BTRFS: state leak: start %llu end %llu state %u in tree %d refs %d\n",4747 state->start, state->end, state->state,4848 extent_state_in_tree(state),
+4-6
fs/btrfs/free-space-cache.c
···1080108010811081 /* Get the cluster for this block_group if it exists */10821082 if (block_group && !list_empty(&block_group->cluster_list)) {10831083- cluster = list_entry(block_group->cluster_list.next,10841084- struct btrfs_free_cluster,10851085- block_group_list);10831083+ cluster = list_first_entry(&block_group->cluster_list,10841084+ struct btrfs_free_cluster, block_group_list);10861085 }1087108610881087 if (!node && cluster) {···23412342 struct rb_node *node;23422343 struct btrfs_free_space *entry;2343234423442344- cluster = list_entry(block_group->cluster_list.next,23452345- struct btrfs_free_cluster,23462346- block_group_list);23452345+ cluster = list_first_entry(&block_group->cluster_list,23462346+ struct btrfs_free_cluster, block_group_list);23472347 spin_lock(&cluster->lock);23482348 node = rb_first(&cluster->root);23492349 if (!node) {
···30983098 struct recorded_ref *cur;3099309931003100 while (!list_empty(head)) {31013101- cur = list_entry(head->next, struct recorded_ref, list);31013101+ cur = list_first_entry(head, struct recorded_ref, list);31023102 recorded_ref_free(cur);31033103 }31043104}···45604560 /*45614561 * We have a moved dir. Add the old parent to check_dirs45624562 */45634563- cur = list_entry(sctx->deleted_refs.next, struct recorded_ref,45644564- list);45634563+ cur = list_first_entry(&sctx->deleted_refs, struct recorded_ref, list);45654564 ret = dup_ref(cur, &check_dirs);45664565 if (ret < 0)45674566 goto out;
+7-7
fs/btrfs/tree-log.c
···860860 struct btrfs_ordered_sum *sums;861861 struct btrfs_root *csum_root;862862863863- sums = list_entry(ordered_sums.next,864864- struct btrfs_ordered_sum,865865- list);863863+ sums = list_first_entry(&ordered_sums,864864+ struct btrfs_ordered_sum,865865+ list);866866 csum_root = btrfs_csum_root(fs_info,867867 sums->logical);868868 if (!ret)···46674667 ret = 0;4668466846694669 while (!list_empty(&ordered_sums)) {46704670- struct btrfs_ordered_sum *sums = list_entry(ordered_sums.next,46714671- struct btrfs_ordered_sum,46724672- list);46704670+ struct btrfs_ordered_sum *sums = list_first_entry(&ordered_sums,46714671+ struct btrfs_ordered_sum,46724672+ list);46734673 if (!ret)46744674 ret = log_csums(trans, inode, log_root, sums);46754675 list_del(&sums->list);···49474947 list_sort(NULL, &extents, extent_cmp);49484948process:49494949 while (!list_empty(&extents)) {49504950- em = list_entry(extents.next, struct extent_map, list);49504950+ em = list_first_entry(&extents, struct extent_map, list);4951495149524952 list_del_init(&em->list);49534953