|
@@ -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);
|