aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-09-05 16:09:51 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:07 -0400
commita1b32a5932cfac7c38b442582285f3da2a09dfd8 (patch)
treed468c51c7391ee1a0cfcc6ff1e76e11c01646efe /fs/btrfs/volumes.c
parent95819c05732c511338b43c115ffbcee978c02888 (diff)
Btrfs: Add debugging checks to track down corrupted metadata
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 5b1b60839d21..37a8ea23e81d 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -94,8 +94,8 @@ int btrfs_cleanup_fs_uuids(void)
94 return 0; 94 return 0;
95} 95}
96 96
97static struct btrfs_device *__find_device(struct list_head *head, u64 devid, 97static noinline struct btrfs_device *__find_device(struct list_head *head,
98 u8 *uuid) 98 u64 devid, u8 *uuid)
99{ 99{
100 struct btrfs_device *dev; 100 struct btrfs_device *dev;
101 struct list_head *cur; 101 struct list_head *cur;
@@ -110,7 +110,7 @@ static struct btrfs_device *__find_device(struct list_head *head, u64 devid,
110 return NULL; 110 return NULL;
111} 111}
112 112
113static struct btrfs_fs_devices *find_fsid(u8 *fsid) 113static noinline struct btrfs_fs_devices *find_fsid(u8 *fsid)
114{ 114{
115 struct list_head *cur; 115 struct list_head *cur;
116 struct btrfs_fs_devices *fs_devices; 116 struct btrfs_fs_devices *fs_devices;
@@ -134,7 +134,7 @@ static struct btrfs_fs_devices *find_fsid(u8 *fsid)
134 * the list if the block device is congested. This way, multiple devices 134 * the list if the block device is congested. This way, multiple devices
135 * can make progress from a single worker thread. 135 * can make progress from a single worker thread.
136 */ 136 */
137int run_scheduled_bios(struct btrfs_device *device) 137static int noinline run_scheduled_bios(struct btrfs_device *device)
138{ 138{
139 struct bio *pending; 139 struct bio *pending;
140 struct backing_dev_info *bdi; 140 struct backing_dev_info *bdi;
@@ -233,7 +233,7 @@ void pending_bios_fn(struct btrfs_work *work)
233 run_scheduled_bios(device); 233 run_scheduled_bios(device);
234} 234}
235 235
236static int device_list_add(const char *path, 236static noinline int device_list_add(const char *path,
237 struct btrfs_super_block *disk_super, 237 struct btrfs_super_block *disk_super,
238 u64 devid, struct btrfs_fs_devices **fs_devices_ret) 238 u64 devid, struct btrfs_fs_devices **fs_devices_ret)
239{ 239{
@@ -480,10 +480,10 @@ error:
480 * called very infrequently and that a given device has a small number 480 * called very infrequently and that a given device has a small number
481 * of extents 481 * of extents
482 */ 482 */
483static int find_free_dev_extent(struct btrfs_trans_handle *trans, 483static noinline int find_free_dev_extent(struct btrfs_trans_handle *trans,
484 struct btrfs_device *device, 484 struct btrfs_device *device,
485 struct btrfs_path *path, 485 struct btrfs_path *path,
486 u64 num_bytes, u64 *start) 486 u64 num_bytes, u64 *start)
487{ 487{
488 struct btrfs_key key; 488 struct btrfs_key key;
489 struct btrfs_root *root = device->dev_root; 489 struct btrfs_root *root = device->dev_root;
@@ -645,7 +645,7 @@ int btrfs_free_dev_extent(struct btrfs_trans_handle *trans,
645 return ret; 645 return ret;
646} 646}
647 647
648int btrfs_alloc_dev_extent(struct btrfs_trans_handle *trans, 648int noinline btrfs_alloc_dev_extent(struct btrfs_trans_handle *trans,
649 struct btrfs_device *device, 649 struct btrfs_device *device,
650 u64 chunk_tree, u64 chunk_objectid, 650 u64 chunk_tree, u64 chunk_objectid,
651 u64 chunk_offset, 651 u64 chunk_offset,
@@ -693,7 +693,8 @@ err:
693 return ret; 693 return ret;
694} 694}
695 695
696static int find_next_chunk(struct btrfs_root *root, u64 objectid, u64 *offset) 696static noinline int find_next_chunk(struct btrfs_root *root,
697 u64 objectid, u64 *offset)
697{ 698{
698 struct btrfs_path *path; 699 struct btrfs_path *path;
699 int ret; 700 int ret;
@@ -735,8 +736,8 @@ error:
735 return ret; 736 return ret;
736} 737}
737 738
738static int find_next_devid(struct btrfs_root *root, struct btrfs_path *path, 739static noinline int find_next_devid(struct btrfs_root *root,
739 u64 *objectid) 740 struct btrfs_path *path, u64 *objectid)
740{ 741{
741 int ret; 742 int ret;
742 struct btrfs_key key; 743 struct btrfs_key key;
@@ -1103,8 +1104,8 @@ out_close_bdev:
1103 goto out; 1104 goto out;
1104} 1105}
1105 1106
1106int btrfs_update_device(struct btrfs_trans_handle *trans, 1107int noinline btrfs_update_device(struct btrfs_trans_handle *trans,
1107 struct btrfs_device *device) 1108 struct btrfs_device *device)
1108{ 1109{
1109 int ret; 1110 int ret;
1110 struct btrfs_path *path; 1111 struct btrfs_path *path;
@@ -1544,8 +1545,8 @@ int btrfs_add_system_chunk(struct btrfs_trans_handle *trans,
1544 return 0; 1545 return 0;
1545} 1546}
1546 1547
1547static u64 chunk_bytes_by_type(u64 type, u64 calc_size, int num_stripes, 1548static u64 noinline chunk_bytes_by_type(u64 type, u64 calc_size,
1548 int sub_stripes) 1549 int num_stripes, int sub_stripes)
1549{ 1550{
1550 if (type & (BTRFS_BLOCK_GROUP_RAID1 | BTRFS_BLOCK_GROUP_DUP)) 1551 if (type & (BTRFS_BLOCK_GROUP_RAID1 | BTRFS_BLOCK_GROUP_DUP))
1551 return calc_size; 1552 return calc_size;
@@ -2141,8 +2142,9 @@ struct async_sched {
2141 * This will add one bio to the pending list for a device and make sure 2142 * This will add one bio to the pending list for a device and make sure
2142 * the work struct is scheduled. 2143 * the work struct is scheduled.
2143 */ 2144 */
2144int schedule_bio(struct btrfs_root *root, struct btrfs_device *device, 2145static int noinline schedule_bio(struct btrfs_root *root,
2145 int rw, struct bio *bio) 2146 struct btrfs_device *device,
2147 int rw, struct bio *bio)
2146{ 2148{
2147 int should_queue = 1; 2149 int should_queue = 1;
2148 2150