aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorQinghuang Feng <qhfeng.kernel@gmail.com>2009-01-21 10:59:08 -0500
committerChris Mason <chris.mason@oracle.com>2009-01-21 10:59:08 -0500
commitc6e308713a47527f88a277ee95b7c5d1db80f77b (patch)
tree0a890bb3ac2ae1bb8733cf8679d1441e1b85eb81 /fs/btrfs/disk-io.c
parent57506d50ed6db7b0e7ddc9845e86e81f140983d5 (diff)
Btrfs: simplify iteration codes
Merge list_for_each* and list_entry to list_for_each_entry* Signed-off-by: Qinghuang Feng <qhfeng.kernel@gmail.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 0d8ccd625ba2..26a18779e84b 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1135,7 +1135,6 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits)
1135{ 1135{
1136 struct btrfs_fs_info *info = (struct btrfs_fs_info *)congested_data; 1136 struct btrfs_fs_info *info = (struct btrfs_fs_info *)congested_data;
1137 int ret = 0; 1137 int ret = 0;
1138 struct list_head *cur;
1139 struct btrfs_device *device; 1138 struct btrfs_device *device;
1140 struct backing_dev_info *bdi; 1139 struct backing_dev_info *bdi;
1141#if 0 1140#if 0
@@ -1143,8 +1142,7 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits)
1143 btrfs_congested_async(info, 0)) 1142 btrfs_congested_async(info, 0))
1144 return 1; 1143 return 1;
1145#endif 1144#endif
1146 list_for_each(cur, &info->fs_devices->devices) { 1145 list_for_each_entry(device, &info->fs_devices->devices, dev_list) {
1147 device = list_entry(cur, struct btrfs_device, dev_list);
1148 if (!device->bdev) 1146 if (!device->bdev)
1149 continue; 1147 continue;
1150 bdi = blk_get_backing_dev_info(device->bdev); 1148 bdi = blk_get_backing_dev_info(device->bdev);
@@ -1162,13 +1160,11 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits)
1162 */ 1160 */
1163static void __unplug_io_fn(struct backing_dev_info *bdi, struct page *page) 1161static void __unplug_io_fn(struct backing_dev_info *bdi, struct page *page)
1164{ 1162{
1165 struct list_head *cur;
1166 struct btrfs_device *device; 1163 struct btrfs_device *device;
1167 struct btrfs_fs_info *info; 1164 struct btrfs_fs_info *info;
1168 1165
1169 info = (struct btrfs_fs_info *)bdi->unplug_io_data; 1166 info = (struct btrfs_fs_info *)bdi->unplug_io_data;
1170 list_for_each(cur, &info->fs_devices->devices) { 1167 list_for_each_entry(device, &info->fs_devices->devices, dev_list) {
1171 device = list_entry(cur, struct btrfs_device, dev_list);
1172 if (!device->bdev) 1168 if (!device->bdev)
1173 continue; 1169 continue;
1174 1170
@@ -1994,7 +1990,6 @@ static int write_dev_supers(struct btrfs_device *device,
1994 1990
1995int write_all_supers(struct btrfs_root *root, int max_mirrors) 1991int write_all_supers(struct btrfs_root *root, int max_mirrors)
1996{ 1992{
1997 struct list_head *cur;
1998 struct list_head *head = &root->fs_info->fs_devices->devices; 1993 struct list_head *head = &root->fs_info->fs_devices->devices;
1999 struct btrfs_device *dev; 1994 struct btrfs_device *dev;
2000 struct btrfs_super_block *sb; 1995 struct btrfs_super_block *sb;
@@ -2010,8 +2005,7 @@ int write_all_supers(struct btrfs_root *root, int max_mirrors)
2010 2005
2011 sb = &root->fs_info->super_for_commit; 2006 sb = &root->fs_info->super_for_commit;
2012 dev_item = &sb->dev_item; 2007 dev_item = &sb->dev_item;
2013 list_for_each(cur, head) { 2008 list_for_each_entry(dev, head, dev_list) {
2014 dev = list_entry(cur, struct btrfs_device, dev_list);
2015 if (!dev->bdev) { 2009 if (!dev->bdev) {
2016 total_errors++; 2010 total_errors++;
2017 continue; 2011 continue;
@@ -2044,8 +2038,7 @@ int write_all_supers(struct btrfs_root *root, int max_mirrors)
2044 } 2038 }
2045 2039
2046 total_errors = 0; 2040 total_errors = 0;
2047 list_for_each(cur, head) { 2041 list_for_each_entry(dev, head, dev_list) {
2048 dev = list_entry(cur, struct btrfs_device, dev_list);
2049 if (!dev->bdev) 2042 if (!dev->bdev)
2050 continue; 2043 continue;
2051 if (!dev->in_fs_metadata || !dev->writeable) 2044 if (!dev->in_fs_metadata || !dev->writeable)