summaryrefslogtreecommitdiff
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorZhao Lei <zhaolei@cn.fujitsu.com>2016-01-06 13:56:36 +0300
committerChris Mason <clm@fb.com>2016-01-20 18:22:13 +0300
commit0bc19f9031e0c59770286f82b8561c1d35064a65 (patch)
tree2469a01dbf180d1e95d6aebd5f61271dd877ea0a /fs/btrfs/extent-tree.c
parentee22f0c4ec428e7f16d3c5fa1d55fd7860cb304a (diff)
downloadlinux-0bc19f9031e0c59770286f82b8561c1d35064a65.tar.xz
btrfs: merge functions for wait snapshot creation
wait_for_snapshot_creation() is in same group with oher two: btrfs_start_write_no_snapshoting() btrfs_end_write_no_snapshoting() Rename wait_for_snapshot_creation() and move it into same place with other two. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index abcffa4b8231..8e8079808728 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -10817,3 +10817,23 @@ int btrfs_start_write_no_snapshoting(struct btrfs_root *root)
}
return 1;
}
+
+static int wait_snapshoting_atomic_t(atomic_t *a)
+{
+ schedule();
+ return 0;
+}
+
+void btrfs_wait_for_snapshot_creation(struct btrfs_root *root)
+{
+ while (true) {
+ int ret;
+
+ ret = btrfs_start_write_no_snapshoting(root);
+ if (ret)
+ break;
+ wait_on_atomic_t(&root->will_be_snapshoted,
+ wait_snapshoting_atomic_t,
+ TASK_UNINTERRUPTIBLE);
+ }
+}