aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.h
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2010-12-13 14:56:23 -0500
committerChris Mason <chris.mason@oracle.com>2010-12-13 20:06:52 -0500
commitcd02dca56442e1504fd6bc5b96f7f1870162b266 (patch)
tree1a38d99fc581974ba6d8136c42ca81f3b1216ea3 /fs/btrfs/volumes.h
parent68433b73b104bff388aac376631d32abbbd872b0 (diff)
Btrfs: account for missing devices in RAID allocation profiles
When we mount in RAID degraded mode without adding a new device to replace the failed one, we can end up using the wrong RAID flags for allocations. This results in strange combinations of block groups (raid1 in a raid10 filesystem) and corruptions when we try to allocate blocks from single spindle chunks on drives that are actually missing. The first device has two small 4MB chunks in it that mkfs creates and these are usually unused in a raid1 or raid10 setup. But, in -o degraded, the allocator will fall back to these because the mask of desired raid groups isn't correct. The fix here is to count the missing devices as we build up the list of devices in the system. This count is used when picking the raid level to make sure we continue using the same levels that were in place before we lost a drive. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/volumes.h')
-rw-r--r--fs/btrfs/volumes.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 31b0fabdd2ea..a668c0116982 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -45,6 +45,7 @@ struct btrfs_device {
45 int barriers; 45 int barriers;
46 int writeable; 46 int writeable;
47 int in_fs_metadata; 47 int in_fs_metadata;
48 int missing;
48 49
49 spinlock_t io_lock; 50 spinlock_t io_lock;
50 51
@@ -94,6 +95,7 @@ struct btrfs_fs_devices {
94 u64 num_devices; 95 u64 num_devices;
95 u64 open_devices; 96 u64 open_devices;
96 u64 rw_devices; 97 u64 rw_devices;
98 u64 missing_devices;
97 u64 total_rw_bytes; 99 u64 total_rw_bytes;
98 struct block_device *latest_bdev; 100 struct block_device *latest_bdev;
99 101