summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.h
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-06-27 19:22:46 +0200
committerJosef Bacik <jbacik@fusionio.com>2013-07-02 17:50:53 +0200
commit6df9a95e63395f595d0d1eb5d561dd6c91c40270 (patch)
tree4636de10454ab03afac3a0d33fdc82e9dbeb44b8 /fs/btrfs/transaction.h
parentBtrfs: cleanup orphaned root orphan item (diff)
downloadlinux-6df9a95e63395f595d0d1eb5d561dd6c91c40270.tar.xz
linux-6df9a95e63395f595d0d1eb5d561dd6c91c40270.zip
Btrfs: make the chunk allocator completely tree lockless
When adjusting the enospc rules for relocation I ran into a deadlock because we were relocating the only system chunk and that forced us to try and allocate a new system chunk while holding locks in the chunk tree, which caused us to deadlock. To fix this I've moved all of the dev extent addition and chunk addition out to the delayed chunk completion stuff. We still keep the in-memory stuff which makes sure everything is consistent. One change I had to make was to search the commit root of the device tree to find a free dev extent, and hold onto any chunk em's that we allocated in that transaction so we do not allocate the same dev extent twice. This has the side effect of fixing a bug with balance that has been there ever since balance existed. Basically you can free a block group and it's dev extent and then immediately allocate that dev extent for a new block group and write stuff to that dev extent, all within the same transaction. So if you happen to crash during a balance you could come back to a completely broken file system. This patch should keep these sort of things from happening in the future since we won't be able to allocate free'd dev extents until after the transaction commits. This has passed all of the xfstests and my super annoying stress test followed by a balance. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/transaction.h')
-rw-r--r--fs/btrfs/transaction.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h
index 66d2a6ccbf05..005b0375d18c 100644
--- a/fs/btrfs/transaction.h
+++ b/fs/btrfs/transaction.h
@@ -56,6 +56,7 @@ struct btrfs_transaction {
wait_queue_head_t commit_wait;
struct list_head pending_snapshots;
struct list_head ordered_operations;
+ struct list_head pending_chunks;
struct btrfs_delayed_ref_root delayed_refs;
int aborted;
};