aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
authorArne Jansen <sensille@gmx.net>2011-03-08 08:14:00 -0500
committerArne Jansen <sensille@gmx.net>2011-05-12 08:45:20 -0400
commita2de733c78fa7af51ba9670482fa7d392aa67c57 (patch)
treed88817bc7aba94e7efea530efac5ef190c1b799c /fs/btrfs/transaction.c
parent7cf96da3ec7ca225acf4f284b0e904a1f5f98821 (diff)
btrfs: scrub
This adds an initial implementation for scrub. It works quite straightforward. The usermode issues an ioctl for each device in the fs. For each device, it enumerates the allocated device chunks. For each chunk, the contained extents are enumerated and the data checksums fetched. The extents are read sequentially and the checksums verified. If an error occurs (checksum or EIO), a good copy is searched for. If one is found, the bad copy will be rewritten. All enumerations happen from the commit roots. During a transaction commit, the scrubs get paused and afterwards continue from the new roots. This commit is based on the series originally posted to linux-btrfs with some improvements that resulted from comments from David Sterba, Ilya Dryomov and Jan Schmidt. Signed-off-by: Arne Jansen <sensille@gmx.net>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index c571734d5e5a..37c2302a08d4 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1321,6 +1321,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
1321 1321
1322 WARN_ON(cur_trans != trans->transaction); 1322 WARN_ON(cur_trans != trans->transaction);
1323 1323
1324 btrfs_scrub_pause(root);
1324 /* btrfs_commit_tree_roots is responsible for getting the 1325 /* btrfs_commit_tree_roots is responsible for getting the
1325 * various roots consistent with each other. Every pointer 1326 * various roots consistent with each other. Every pointer
1326 * in the tree of tree roots has to point to the most up to date 1327 * in the tree of tree roots has to point to the most up to date
@@ -1405,6 +1406,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
1405 1406
1406 mutex_unlock(&root->fs_info->trans_mutex); 1407 mutex_unlock(&root->fs_info->trans_mutex);
1407 1408
1409 btrfs_scrub_continue(root);
1410
1408 if (current->journal_info == trans) 1411 if (current->journal_info == trans)
1409 current->journal_info = NULL; 1412 current->journal_info = NULL;
1410 1413