diff options
author | Zhao Lei <zhaolei@cn.fujitsu.com> | 2016-01-06 18:56:36 +0800 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2016-01-20 07:22:13 -0800 |
commit | 0bc19f9031e0c59770286f82b8561c1d35064a65 (patch) | |
tree | 2469a01dbf180d1e95d6aebd5f61271dd877ea0a /fs/btrfs/inode.c | |
parent | ee22f0c4ec428e7f16d3c5fa1d55fd7860cb304a (diff) |
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/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 8ad9e2200442..b8bb7591ff9f 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -4871,26 +4871,6 @@ next: return err; } -static int wait_snapshoting_atomic_t(atomic_t *a) -{ - schedule(); - return 0; -} - -static void 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); - } -} - static int btrfs_setsize(struct inode *inode, struct iattr *attr) { struct btrfs_root *root = BTRFS_I(inode)->root; @@ -4922,7 +4902,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr) * truncation, it must capture all writes that happened before * this truncation. */ - wait_for_snapshot_creation(root); + btrfs_wait_for_snapshot_creation(root); ret = btrfs_cont_expand(inode, oldsize, newsize); if (ret) { btrfs_end_write_no_snapshoting(root); |