aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeliang Tang <geliangtang@163.com>2015-12-18 09:17:00 -0500
committerDavid Sterba <dsterba@suse.com>2016-01-07 08:39:09 -0500
commit7ae1681e126919e7119cebebde1d42df8d7a49b9 (patch)
tree516c422276938efc71092e0b193ba3b8ed8791f7
parentb69f2bef484844ccd9038a850cdcf562afff9d08 (diff)
btrfs: use list_for_each_entry_safe in free-space-cache.c
Use list_for_each_entry_safe() instead of list_for_each_safe() 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>
-rw-r--r--fs/btrfs/free-space-cache.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 1b2ff8b96968..e5d7ec879f5d 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -1086,14 +1086,11 @@ write_pinned_extent_entries(struct btrfs_root *root,
1086static noinline_for_stack int 1086static noinline_for_stack int
1087write_bitmap_entries(struct btrfs_io_ctl *io_ctl, struct list_head *bitmap_list) 1087write_bitmap_entries(struct btrfs_io_ctl *io_ctl, struct list_head *bitmap_list)
1088{ 1088{
1089 struct list_head *pos, *n; 1089 struct btrfs_free_space *entry, *next;
1090 int ret; 1090 int ret;
1091 1091
1092 /* Write out the bitmaps */ 1092 /* Write out the bitmaps */
1093 list_for_each_safe(pos, n, bitmap_list) { 1093 list_for_each_entry_safe(entry, next, bitmap_list, list) {
1094 struct btrfs_free_space *entry =
1095 list_entry(pos, struct btrfs_free_space, list);
1096
1097 ret = io_ctl_add_bitmap(io_ctl, entry->bitmap); 1094 ret = io_ctl_add_bitmap(io_ctl, entry->bitmap);
1098 if (ret) 1095 if (ret)
1099 return -ENOSPC; 1096 return -ENOSPC;
@@ -1119,13 +1116,10 @@ static int flush_dirty_cache(struct inode *inode)
1119static void noinline_for_stack 1116static void noinline_for_stack
1120cleanup_bitmap_list(struct list_head *bitmap_list) 1117cleanup_bitmap_list(struct list_head *bitmap_list)
1121{ 1118{
1122 struct list_head *pos, *n; 1119 struct btrfs_free_space *entry, *next;
1123 1120
1124 list_for_each_safe(pos, n, bitmap_list) { 1121 list_for_each_entry_safe(entry, next, bitmap_list, list)
1125 struct btrfs_free_space *entry =
1126 list_entry(pos, struct btrfs_free_space, list);
1127 list_del_init(&entry->list); 1122 list_del_init(&entry->list);
1128 }
1129} 1123}
1130 1124
1131static void noinline_for_stack 1125static void noinline_for_stack