Btrfs: Move snapshot creation to commit time

It is very difficult to create a consistent snapshot of the btree when
other writers may update the btree before the commit is done.

This changes the snapshot creation to happen during the commit, while
no other updates are possible.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
Chris Mason
2008-01-08 15:46:30 -05:00
parent dc17ff8f11
commit 3063d29f2a
3 changed files with 100 additions and 67 deletions

View File

@@ -34,6 +34,7 @@ struct btrfs_transaction {
struct btrfs_ordered_inode_tree ordered_inode_tree;
wait_queue_head_t writer_wait;
wait_queue_head_t commit_wait;
struct list_head pending_snapshots;
};
struct btrfs_trans_handle {
@@ -46,6 +47,12 @@ struct btrfs_trans_handle {
u64 alloc_exclude_nr;
};
struct btrfs_pending_snapshot {
struct btrfs_root *root;
char *name;
struct list_head list;
};
static inline void btrfs_set_trans_block_group(struct btrfs_trans_handle *trans,
struct inode *inode)