|
|
@@ -10005,7 +10005,7 @@ static struct btrfs_delalloc_work *btrfs_alloc_delalloc_work(struct inode *inode
|
|
|
* some fairly slow code that needs optimization. This walks the list
|
|
|
* of all the inodes with pending delalloc and forces them to disk.
|
|
|
*/
|
|
|
-static int start_delalloc_inodes(struct btrfs_root *root, int nr)
|
|
|
+static int start_delalloc_inodes(struct btrfs_root *root, int nr, bool snapshot)
|
|
|
{
|
|
|
struct btrfs_inode *binode;
|
|
|
struct inode *inode;
|
|
|
@@ -10033,6 +10033,9 @@ static int start_delalloc_inodes(struct btrfs_root *root, int nr)
|
|
|
}
|
|
|
spin_unlock(&root->delalloc_lock);
|
|
|
|
|
|
+ if (snapshot)
|
|
|
+ set_bit(BTRFS_INODE_SNAPSHOT_FLUSH,
|
|
|
+ &binode->runtime_flags);
|
|
|
work = btrfs_alloc_delalloc_work(inode);
|
|
|
if (!work) {
|
|
|
iput(inode);
|
|
|
@@ -10066,7 +10069,7 @@ out:
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-int btrfs_start_delalloc_inodes(struct btrfs_root *root)
|
|
|
+int btrfs_start_delalloc_snapshot(struct btrfs_root *root)
|
|
|
{
|
|
|
struct btrfs_fs_info *fs_info = root->fs_info;
|
|
|
int ret;
|
|
|
@@ -10074,7 +10077,7 @@ int btrfs_start_delalloc_inodes(struct btrfs_root *root)
|
|
|
if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state))
|
|
|
return -EROFS;
|
|
|
|
|
|
- ret = start_delalloc_inodes(root, -1);
|
|
|
+ ret = start_delalloc_inodes(root, -1, true);
|
|
|
if (ret > 0)
|
|
|
ret = 0;
|
|
|
return ret;
|
|
|
@@ -10103,7 +10106,7 @@ int btrfs_start_delalloc_roots(struct btrfs_fs_info *fs_info, int nr)
|
|
|
&fs_info->delalloc_roots);
|
|
|
spin_unlock(&fs_info->delalloc_root_lock);
|
|
|
|
|
|
- ret = start_delalloc_inodes(root, nr);
|
|
|
+ ret = start_delalloc_inodes(root, nr, false);
|
|
|
btrfs_put_fs_root(root);
|
|
|
if (ret < 0)
|
|
|
goto out;
|