aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2009-01-28 20:29:43 -0500
committerChris Mason <chris.mason@oracle.com>2009-01-28 20:29:43 -0500
commite4f722fa42537bcb0ff14322a57dc3870d093cab (patch)
tree315920ade3b68bf20c4080bcd1bf2bc34a5d5ab7 /fs/btrfs/volumes.c
parent18e352e4a73465349711a9324767e1b2453383e2 (diff)
parenta717531942f488209dded30f6bc648167bcefa72 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
Fix fs/btrfs/super.c conflict around #includes
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c38
1 files changed, 10 insertions, 28 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 3451e1cca2b5..fd0bedb07a64 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -20,7 +20,6 @@
20#include <linux/buffer_head.h> 20#include <linux/buffer_head.h>
21#include <linux/blkdev.h> 21#include <linux/blkdev.h>
22#include <linux/random.h> 22#include <linux/random.h>
23#include <linux/version.h>
24#include <asm/div64.h> 23#include <asm/div64.h>
25#include "compat.h" 24#include "compat.h"
26#include "ctree.h" 25#include "ctree.h"
@@ -104,10 +103,8 @@ static noinline struct btrfs_device *__find_device(struct list_head *head,
104 u64 devid, u8 *uuid) 103 u64 devid, u8 *uuid)
105{ 104{
106 struct btrfs_device *dev; 105 struct btrfs_device *dev;
107 struct list_head *cur;
108 106
109 list_for_each(cur, head) { 107 list_for_each_entry(dev, head, dev_list) {
110 dev = list_entry(cur, struct btrfs_device, dev_list);
111 if (dev->devid == devid && 108 if (dev->devid == devid &&
112 (!uuid || !memcmp(dev->uuid, uuid, BTRFS_UUID_SIZE))) { 109 (!uuid || !memcmp(dev->uuid, uuid, BTRFS_UUID_SIZE))) {
113 return dev; 110 return dev;
@@ -118,11 +115,9 @@ static noinline struct btrfs_device *__find_device(struct list_head *head,
118 115
119static noinline struct btrfs_fs_devices *find_fsid(u8 *fsid) 116static noinline struct btrfs_fs_devices *find_fsid(u8 *fsid)
120{ 117{
121 struct list_head *cur;
122 struct btrfs_fs_devices *fs_devices; 118 struct btrfs_fs_devices *fs_devices;
123 119
124 list_for_each(cur, &fs_uuids) { 120 list_for_each_entry(fs_devices, &fs_uuids, list) {
125 fs_devices = list_entry(cur, struct btrfs_fs_devices, list);
126 if (memcmp(fsid, fs_devices->fsid, BTRFS_FSID_SIZE) == 0) 121 if (memcmp(fsid, fs_devices->fsid, BTRFS_FSID_SIZE) == 0)
127 return fs_devices; 122 return fs_devices;
128 } 123 }
@@ -345,14 +340,11 @@ error:
345 340
346int btrfs_close_extra_devices(struct btrfs_fs_devices *fs_devices) 341int btrfs_close_extra_devices(struct btrfs_fs_devices *fs_devices)
347{ 342{
348 struct list_head *tmp; 343 struct btrfs_device *device, *next;
349 struct list_head *cur;
350 struct btrfs_device *device;
351 344
352 mutex_lock(&uuid_mutex); 345 mutex_lock(&uuid_mutex);
353again: 346again:
354 list_for_each_safe(cur, tmp, &fs_devices->devices) { 347 list_for_each_entry_safe(device, next, &fs_devices->devices, dev_list) {
355 device = list_entry(cur, struct btrfs_device, dev_list);
356 if (device->in_fs_metadata) 348 if (device->in_fs_metadata)
357 continue; 349 continue;
358 350
@@ -383,14 +375,12 @@ again:
383 375
384static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices) 376static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
385{ 377{
386 struct list_head *cur;
387 struct btrfs_device *device; 378 struct btrfs_device *device;
388 379
389 if (--fs_devices->opened > 0) 380 if (--fs_devices->opened > 0)
390 return 0; 381 return 0;
391 382
392 list_for_each(cur, &fs_devices->devices) { 383 list_for_each_entry(device, &fs_devices->devices, dev_list) {
393 device = list_entry(cur, struct btrfs_device, dev_list);
394 if (device->bdev) { 384 if (device->bdev) {
395 close_bdev_exclusive(device->bdev, device->mode); 385 close_bdev_exclusive(device->bdev, device->mode);
396 fs_devices->open_devices--; 386 fs_devices->open_devices--;
@@ -439,7 +429,6 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
439{ 429{
440 struct block_device *bdev; 430 struct block_device *bdev;
441 struct list_head *head = &fs_devices->devices; 431 struct list_head *head = &fs_devices->devices;
442 struct list_head *cur;
443 struct btrfs_device *device; 432 struct btrfs_device *device;
444 struct block_device *latest_bdev = NULL; 433 struct block_device *latest_bdev = NULL;
445 struct buffer_head *bh; 434 struct buffer_head *bh;
@@ -450,8 +439,7 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
450 int seeding = 1; 439 int seeding = 1;
451 int ret = 0; 440 int ret = 0;
452 441
453 list_for_each(cur, head) { 442 list_for_each_entry(device, head, dev_list) {
454 device = list_entry(cur, struct btrfs_device, dev_list);
455 if (device->bdev) 443 if (device->bdev)
456 continue; 444 continue;
457 if (!device->name) 445 if (!device->name)
@@ -578,7 +566,7 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
578 *(unsigned long long *)disk_super->fsid, 566 *(unsigned long long *)disk_super->fsid,
579 *(unsigned long long *)(disk_super->fsid + 8)); 567 *(unsigned long long *)(disk_super->fsid + 8));
580 } 568 }
581 printk(KERN_INFO "devid %llu transid %llu %s\n", 569 printk(KERN_CONT "devid %llu transid %llu %s\n",
582 (unsigned long long)devid, (unsigned long long)transid, path); 570 (unsigned long long)devid, (unsigned long long)transid, path);
583 ret = device_list_add(path, disk_super, devid, fs_devices_ret); 571 ret = device_list_add(path, disk_super, devid, fs_devices_ret);
584 572
@@ -1017,14 +1005,12 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
1017 } 1005 }
1018 1006
1019 if (strcmp(device_path, "missing") == 0) { 1007 if (strcmp(device_path, "missing") == 0) {
1020 struct list_head *cur;
1021 struct list_head *devices; 1008 struct list_head *devices;
1022 struct btrfs_device *tmp; 1009 struct btrfs_device *tmp;
1023 1010
1024 device = NULL; 1011 device = NULL;
1025 devices = &root->fs_info->fs_devices->devices; 1012 devices = &root->fs_info->fs_devices->devices;
1026 list_for_each(cur, devices) { 1013 list_for_each_entry(tmp, devices, dev_list) {
1027 tmp = list_entry(cur, struct btrfs_device, dev_list);
1028 if (tmp->in_fs_metadata && !tmp->bdev) { 1014 if (tmp->in_fs_metadata && !tmp->bdev) {
1029 device = tmp; 1015 device = tmp;
1030 break; 1016 break;
@@ -1280,7 +1266,6 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
1280 struct btrfs_trans_handle *trans; 1266 struct btrfs_trans_handle *trans;
1281 struct btrfs_device *device; 1267 struct btrfs_device *device;
1282 struct block_device *bdev; 1268 struct block_device *bdev;
1283 struct list_head *cur;
1284 struct list_head *devices; 1269 struct list_head *devices;
1285 struct super_block *sb = root->fs_info->sb; 1270 struct super_block *sb = root->fs_info->sb;
1286 u64 total_bytes; 1271 u64 total_bytes;
@@ -1304,8 +1289,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
1304 mutex_lock(&root->fs_info->volume_mutex); 1289 mutex_lock(&root->fs_info->volume_mutex);
1305 1290
1306 devices = &root->fs_info->fs_devices->devices; 1291 devices = &root->fs_info->fs_devices->devices;
1307 list_for_each(cur, devices) { 1292 list_for_each_entry(device, devices, dev_list) {
1308 device = list_entry(cur, struct btrfs_device, dev_list);
1309 if (device->bdev == bdev) { 1293 if (device->bdev == bdev) {
1310 ret = -EEXIST; 1294 ret = -EEXIST;
1311 goto error; 1295 goto error;
@@ -1704,7 +1688,6 @@ static u64 div_factor(u64 num, int factor)
1704int btrfs_balance(struct btrfs_root *dev_root) 1688int btrfs_balance(struct btrfs_root *dev_root)
1705{ 1689{
1706 int ret; 1690 int ret;
1707 struct list_head *cur;
1708 struct list_head *devices = &dev_root->fs_info->fs_devices->devices; 1691 struct list_head *devices = &dev_root->fs_info->fs_devices->devices;
1709 struct btrfs_device *device; 1692 struct btrfs_device *device;
1710 u64 old_size; 1693 u64 old_size;
@@ -1723,8 +1706,7 @@ int btrfs_balance(struct btrfs_root *dev_root)
1723 dev_root = dev_root->fs_info->dev_root; 1706 dev_root = dev_root->fs_info->dev_root;
1724 1707
1725 /* step one make some room on all the devices */ 1708 /* step one make some room on all the devices */
1726 list_for_each(cur, devices) { 1709 list_for_each_entry(device, devices, dev_list) {
1727 device = list_entry(cur, struct btrfs_device, dev_list);
1728 old_size = device->total_bytes; 1710 old_size = device->total_bytes;
1729 size_to_free = div_factor(old_size, 1); 1711 size_to_free = div_factor(old_size, 1);
1730 size_to_free = min(size_to_free, (u64)1 * 1024 * 1024); 1712 size_to_free = min(size_to_free, (u64)1 * 1024 * 1024);