Commit 54955e3b authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-5.4-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux

Pull btrfs fixes from David Sterba:

 - fixes of error handling cleanup of metadata accounting with qgroups
   enabled

 - fix swapped values for qgroup tracepoints

 - fix race when handling full sync flag

 - don't start unused worker thread, functionality removed already

* tag 'for-5.4-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
  Btrfs: check for the full sync flag while holding the inode lock during fsync
  Btrfs: fix qgroup double free after failure to reserve metadata for delalloc
  btrfs: tracepoints: Fix bad entry members of qgroup events
  btrfs: tracepoints: Fix wrong parameter order for qgroup events
  btrfs: qgroup: Always free PREALLOC META reserve in btrfs_delalloc_release_extents()
  btrfs: don't needlessly create extent-refs kernel thread
  btrfs: block-group: Fix a memory leak due to missing btrfs_put_block_group()
  Btrfs: add missing extents release on file extent cluster relocation error
parents 3b7c59a1 ba0b084a
...@@ -1761,6 +1761,7 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info) ...@@ -1761,6 +1761,7 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info)
btrfs_err(info, btrfs_err(info,
"bg %llu is a mixed block group but filesystem hasn't enabled mixed block groups", "bg %llu is a mixed block group but filesystem hasn't enabled mixed block groups",
cache->key.objectid); cache->key.objectid);
btrfs_put_block_group(cache);
ret = -EINVAL; ret = -EINVAL;
goto error; goto error;
} }
......
...@@ -734,8 +734,6 @@ struct btrfs_fs_info { ...@@ -734,8 +734,6 @@ struct btrfs_fs_info {
struct btrfs_workqueue *fixup_workers; struct btrfs_workqueue *fixup_workers;
struct btrfs_workqueue *delayed_workers; struct btrfs_workqueue *delayed_workers;
/* the extent workers do delayed refs on the extent allocation tree */
struct btrfs_workqueue *extent_workers;
struct task_struct *transaction_kthread; struct task_struct *transaction_kthread;
struct task_struct *cleaner_kthread; struct task_struct *cleaner_kthread;
u32 thread_pool_size; u32 thread_pool_size;
...@@ -2489,8 +2487,7 @@ int btrfs_subvolume_reserve_metadata(struct btrfs_root *root, ...@@ -2489,8 +2487,7 @@ int btrfs_subvolume_reserve_metadata(struct btrfs_root *root,
int nitems, bool use_global_rsv); int nitems, bool use_global_rsv);
void btrfs_subvolume_release_metadata(struct btrfs_fs_info *fs_info, void btrfs_subvolume_release_metadata(struct btrfs_fs_info *fs_info,
struct btrfs_block_rsv *rsv); struct btrfs_block_rsv *rsv);
void btrfs_delalloc_release_extents(struct btrfs_inode *inode, u64 num_bytes, void btrfs_delalloc_release_extents(struct btrfs_inode *inode, u64 num_bytes);
bool qgroup_free);
int btrfs_delalloc_reserve_metadata(struct btrfs_inode *inode, u64 num_bytes); int btrfs_delalloc_reserve_metadata(struct btrfs_inode *inode, u64 num_bytes);
u64 btrfs_account_ro_block_groups_free_space(struct btrfs_space_info *sinfo); u64 btrfs_account_ro_block_groups_free_space(struct btrfs_space_info *sinfo);
......
...@@ -381,7 +381,6 @@ int btrfs_delalloc_reserve_metadata(struct btrfs_inode *inode, u64 num_bytes) ...@@ -381,7 +381,6 @@ int btrfs_delalloc_reserve_metadata(struct btrfs_inode *inode, u64 num_bytes)
out_qgroup: out_qgroup:
btrfs_qgroup_free_meta_prealloc(root, qgroup_reserve); btrfs_qgroup_free_meta_prealloc(root, qgroup_reserve);
out_fail: out_fail:
btrfs_inode_rsv_release(inode, true);
if (delalloc_lock) if (delalloc_lock)
mutex_unlock(&inode->delalloc_mutex); mutex_unlock(&inode->delalloc_mutex);
return ret; return ret;
...@@ -418,7 +417,6 @@ void btrfs_delalloc_release_metadata(struct btrfs_inode *inode, u64 num_bytes, ...@@ -418,7 +417,6 @@ void btrfs_delalloc_release_metadata(struct btrfs_inode *inode, u64 num_bytes,
* btrfs_delalloc_release_extents - release our outstanding_extents * btrfs_delalloc_release_extents - release our outstanding_extents
* @inode: the inode to balance the reservation for. * @inode: the inode to balance the reservation for.
* @num_bytes: the number of bytes we originally reserved with * @num_bytes: the number of bytes we originally reserved with
* @qgroup_free: do we need to free qgroup meta reservation or convert them.
* *
* When we reserve space we increase outstanding_extents for the extents we may * When we reserve space we increase outstanding_extents for the extents we may
* add. Once we've set the range as delalloc or created our ordered extents we * add. Once we've set the range as delalloc or created our ordered extents we
...@@ -426,8 +424,7 @@ void btrfs_delalloc_release_metadata(struct btrfs_inode *inode, u64 num_bytes, ...@@ -426,8 +424,7 @@ void btrfs_delalloc_release_metadata(struct btrfs_inode *inode, u64 num_bytes,
* temporarily tracked outstanding_extents. This _must_ be used in conjunction * temporarily tracked outstanding_extents. This _must_ be used in conjunction
* with btrfs_delalloc_reserve_metadata. * with btrfs_delalloc_reserve_metadata.
*/ */
void btrfs_delalloc_release_extents(struct btrfs_inode *inode, u64 num_bytes, void btrfs_delalloc_release_extents(struct btrfs_inode *inode, u64 num_bytes)
bool qgroup_free)
{ {
struct btrfs_fs_info *fs_info = inode->root->fs_info; struct btrfs_fs_info *fs_info = inode->root->fs_info;
unsigned num_extents; unsigned num_extents;
...@@ -441,7 +438,7 @@ void btrfs_delalloc_release_extents(struct btrfs_inode *inode, u64 num_bytes, ...@@ -441,7 +438,7 @@ void btrfs_delalloc_release_extents(struct btrfs_inode *inode, u64 num_bytes,
if (btrfs_is_testing(fs_info)) if (btrfs_is_testing(fs_info))
return; return;
btrfs_inode_rsv_release(inode, qgroup_free); btrfs_inode_rsv_release(inode, true);
} }
/** /**
......
...@@ -2008,7 +2008,6 @@ static void btrfs_stop_all_workers(struct btrfs_fs_info *fs_info) ...@@ -2008,7 +2008,6 @@ static void btrfs_stop_all_workers(struct btrfs_fs_info *fs_info)
btrfs_destroy_workqueue(fs_info->readahead_workers); btrfs_destroy_workqueue(fs_info->readahead_workers);
btrfs_destroy_workqueue(fs_info->flush_workers); btrfs_destroy_workqueue(fs_info->flush_workers);
btrfs_destroy_workqueue(fs_info->qgroup_rescan_workers); btrfs_destroy_workqueue(fs_info->qgroup_rescan_workers);
btrfs_destroy_workqueue(fs_info->extent_workers);
/* /*
* Now that all other work queues are destroyed, we can safely destroy * Now that all other work queues are destroyed, we can safely destroy
* the queues used for metadata I/O, since tasks from those other work * the queues used for metadata I/O, since tasks from those other work
...@@ -2214,10 +2213,6 @@ static int btrfs_init_workqueues(struct btrfs_fs_info *fs_info, ...@@ -2214,10 +2213,6 @@ static int btrfs_init_workqueues(struct btrfs_fs_info *fs_info,
max_active, 2); max_active, 2);
fs_info->qgroup_rescan_workers = fs_info->qgroup_rescan_workers =
btrfs_alloc_workqueue(fs_info, "qgroup-rescan", flags, 1, 0); btrfs_alloc_workqueue(fs_info, "qgroup-rescan", flags, 1, 0);
fs_info->extent_workers =
btrfs_alloc_workqueue(fs_info, "extent-refs", flags,
min_t(u64, fs_devices->num_devices,
max_active), 8);
if (!(fs_info->workers && fs_info->delalloc_workers && if (!(fs_info->workers && fs_info->delalloc_workers &&
fs_info->submit_workers && fs_info->flush_workers && fs_info->submit_workers && fs_info->flush_workers &&
...@@ -2228,7 +2223,6 @@ static int btrfs_init_workqueues(struct btrfs_fs_info *fs_info, ...@@ -2228,7 +2223,6 @@ static int btrfs_init_workqueues(struct btrfs_fs_info *fs_info,
fs_info->endio_freespace_worker && fs_info->rmw_workers && fs_info->endio_freespace_worker && fs_info->rmw_workers &&
fs_info->caching_workers && fs_info->readahead_workers && fs_info->caching_workers && fs_info->readahead_workers &&
fs_info->fixup_workers && fs_info->delayed_workers && fs_info->fixup_workers && fs_info->delayed_workers &&
fs_info->extent_workers &&
fs_info->qgroup_rescan_workers)) { fs_info->qgroup_rescan_workers)) {
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -1692,7 +1692,7 @@ static noinline ssize_t btrfs_buffered_write(struct kiocb *iocb, ...@@ -1692,7 +1692,7 @@ static noinline ssize_t btrfs_buffered_write(struct kiocb *iocb,
force_page_uptodate); force_page_uptodate);
if (ret) { if (ret) {
btrfs_delalloc_release_extents(BTRFS_I(inode), btrfs_delalloc_release_extents(BTRFS_I(inode),
reserve_bytes, true); reserve_bytes);
break; break;
} }
...@@ -1704,7 +1704,7 @@ static noinline ssize_t btrfs_buffered_write(struct kiocb *iocb, ...@@ -1704,7 +1704,7 @@ static noinline ssize_t btrfs_buffered_write(struct kiocb *iocb,
if (extents_locked == -EAGAIN) if (extents_locked == -EAGAIN)
goto again; goto again;
btrfs_delalloc_release_extents(BTRFS_I(inode), btrfs_delalloc_release_extents(BTRFS_I(inode),
reserve_bytes, true); reserve_bytes);
ret = extents_locked; ret = extents_locked;
break; break;
} }
...@@ -1772,8 +1772,7 @@ static noinline ssize_t btrfs_buffered_write(struct kiocb *iocb, ...@@ -1772,8 +1772,7 @@ static noinline ssize_t btrfs_buffered_write(struct kiocb *iocb,
else else
free_extent_state(cached_state); free_extent_state(cached_state);
btrfs_delalloc_release_extents(BTRFS_I(inode), reserve_bytes, btrfs_delalloc_release_extents(BTRFS_I(inode), reserve_bytes);
true);
if (ret) { if (ret) {
btrfs_drop_pages(pages, num_pages); btrfs_drop_pages(pages, num_pages);
break; break;
...@@ -2068,25 +2067,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) ...@@ -2068,25 +2067,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
struct btrfs_trans_handle *trans; struct btrfs_trans_handle *trans;
struct btrfs_log_ctx ctx; struct btrfs_log_ctx ctx;
int ret = 0, err; int ret = 0, err;
u64 len;
/*
* If the inode needs a full sync, make sure we use a full range to
* avoid log tree corruption, due to hole detection racing with ordered
* extent completion for adjacent ranges, and assertion failures during
* hole detection.
*/
if (test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
&BTRFS_I(inode)->runtime_flags)) {
start = 0;
end = LLONG_MAX;
}
/*
* The range length can be represented by u64, we have to do the typecasts
* to avoid signed overflow if it's [0, LLONG_MAX] eg. from fsync()
*/
len = (u64)end - (u64)start + 1;
trace_btrfs_sync_file(file, datasync); trace_btrfs_sync_file(file, datasync);
btrfs_init_log_ctx(&ctx, inode); btrfs_init_log_ctx(&ctx, inode);
...@@ -2112,6 +2093,19 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) ...@@ -2112,6 +2093,19 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
atomic_inc(&root->log_batch); atomic_inc(&root->log_batch);
/*
* If the inode needs a full sync, make sure we use a full range to
* avoid log tree corruption, due to hole detection racing with ordered
* extent completion for adjacent ranges, and assertion failures during
* hole detection. Do this while holding the inode lock, to avoid races
* with other tasks.
*/
if (test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
&BTRFS_I(inode)->runtime_flags)) {
start = 0;
end = LLONG_MAX;
}
/* /*
* Before we acquired the inode's lock, someone may have dirtied more * Before we acquired the inode's lock, someone may have dirtied more
* pages in the target range. We need to make sure that writeback for * pages in the target range. We need to make sure that writeback for
...@@ -2139,8 +2133,11 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) ...@@ -2139,8 +2133,11 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
/* /*
* We have to do this here to avoid the priority inversion of waiting on * We have to do this here to avoid the priority inversion of waiting on
* IO of a lower priority task while holding a transaction open. * IO of a lower priority task while holding a transaction open.
*
* Also, the range length can be represented by u64, we have to do the
* typecasts to avoid signed overflow if it's [0, LLONG_MAX].
*/ */
ret = btrfs_wait_ordered_range(inode, start, len); ret = btrfs_wait_ordered_range(inode, start, (u64)end - (u64)start + 1);
if (ret) { if (ret) {
up_write(&BTRFS_I(inode)->dio_sem); up_write(&BTRFS_I(inode)->dio_sem);
inode_unlock(inode); inode_unlock(inode);
......
...@@ -501,13 +501,13 @@ int btrfs_save_ino_cache(struct btrfs_root *root, ...@@ -501,13 +501,13 @@ int btrfs_save_ino_cache(struct btrfs_root *root,
ret = btrfs_prealloc_file_range_trans(inode, trans, 0, 0, prealloc, ret = btrfs_prealloc_file_range_trans(inode, trans, 0, 0, prealloc,
prealloc, prealloc, &alloc_hint); prealloc, prealloc, &alloc_hint);
if (ret) { if (ret) {
btrfs_delalloc_release_extents(BTRFS_I(inode), prealloc, true); btrfs_delalloc_release_extents(BTRFS_I(inode), prealloc);
btrfs_delalloc_release_metadata(BTRFS_I(inode), prealloc, true); btrfs_delalloc_release_metadata(BTRFS_I(inode), prealloc, true);
goto out_put; goto out_put;
} }
ret = btrfs_write_out_ino_cache(root, trans, path, inode); ret = btrfs_write_out_ino_cache(root, trans, path, inode);
btrfs_delalloc_release_extents(BTRFS_I(inode), prealloc, false); btrfs_delalloc_release_extents(BTRFS_I(inode), prealloc);
out_put: out_put:
iput(inode); iput(inode);
out_release: out_release:
......
...@@ -2206,7 +2206,7 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work) ...@@ -2206,7 +2206,7 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work)
ClearPageChecked(page); ClearPageChecked(page);
set_page_dirty(page); set_page_dirty(page);
btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE, false); btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE);
out: out:
unlock_extent_cached(&BTRFS_I(inode)->io_tree, page_start, page_end, unlock_extent_cached(&BTRFS_I(inode)->io_tree, page_start, page_end,
&cached_state); &cached_state);
...@@ -4951,7 +4951,7 @@ int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len, ...@@ -4951,7 +4951,7 @@ int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len,
if (!page) { if (!page) {
btrfs_delalloc_release_space(inode, data_reserved, btrfs_delalloc_release_space(inode, data_reserved,
block_start, blocksize, true); block_start, blocksize, true);
btrfs_delalloc_release_extents(BTRFS_I(inode), blocksize, true); btrfs_delalloc_release_extents(BTRFS_I(inode), blocksize);
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
...@@ -5018,7 +5018,7 @@ int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len, ...@@ -5018,7 +5018,7 @@ int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len,
if (ret) if (ret)
btrfs_delalloc_release_space(inode, data_reserved, block_start, btrfs_delalloc_release_space(inode, data_reserved, block_start,
blocksize, true); blocksize, true);
btrfs_delalloc_release_extents(BTRFS_I(inode), blocksize, (ret != 0)); btrfs_delalloc_release_extents(BTRFS_I(inode), blocksize);
unlock_page(page); unlock_page(page);
put_page(page); put_page(page);
out: out:
...@@ -8709,7 +8709,7 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter) ...@@ -8709,7 +8709,7 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
} else if (ret >= 0 && (size_t)ret < count) } else if (ret >= 0 && (size_t)ret < count)
btrfs_delalloc_release_space(inode, data_reserved, btrfs_delalloc_release_space(inode, data_reserved,
offset, count - (size_t)ret, true); offset, count - (size_t)ret, true);
btrfs_delalloc_release_extents(BTRFS_I(inode), count, false); btrfs_delalloc_release_extents(BTRFS_I(inode), count);
} }
out: out:
if (wakeup) if (wakeup)
...@@ -9059,7 +9059,7 @@ vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf) ...@@ -9059,7 +9059,7 @@ vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf)
unlock_extent_cached(io_tree, page_start, page_end, &cached_state); unlock_extent_cached(io_tree, page_start, page_end, &cached_state);
if (!ret2) { if (!ret2) {
btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE, true); btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE);
sb_end_pagefault(inode->i_sb); sb_end_pagefault(inode->i_sb);
extent_changeset_free(data_reserved); extent_changeset_free(data_reserved);
return VM_FAULT_LOCKED; return VM_FAULT_LOCKED;
...@@ -9068,7 +9068,7 @@ vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf) ...@@ -9068,7 +9068,7 @@ vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf)
out_unlock: out_unlock:
unlock_page(page); unlock_page(page);
out: out:
btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE, (ret != 0)); btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE);
btrfs_delalloc_release_space(inode, data_reserved, page_start, btrfs_delalloc_release_space(inode, data_reserved, page_start,
reserved_space, (ret != 0)); reserved_space, (ret != 0));
out_noreserve: out_noreserve:
......
...@@ -1360,8 +1360,7 @@ static int cluster_pages_for_defrag(struct inode *inode, ...@@ -1360,8 +1360,7 @@ static int cluster_pages_for_defrag(struct inode *inode,
unlock_page(pages[i]); unlock_page(pages[i]);
put_page(pages[i]); put_page(pages[i]);
} }
btrfs_delalloc_release_extents(BTRFS_I(inode), page_cnt << PAGE_SHIFT, btrfs_delalloc_release_extents(BTRFS_I(inode), page_cnt << PAGE_SHIFT);
false);
extent_changeset_free(data_reserved); extent_changeset_free(data_reserved);
return i_done; return i_done;
out: out:
...@@ -1372,8 +1371,7 @@ static int cluster_pages_for_defrag(struct inode *inode, ...@@ -1372,8 +1371,7 @@ static int cluster_pages_for_defrag(struct inode *inode,
btrfs_delalloc_release_space(inode, data_reserved, btrfs_delalloc_release_space(inode, data_reserved,
start_index << PAGE_SHIFT, start_index << PAGE_SHIFT,
page_cnt << PAGE_SHIFT, true); page_cnt << PAGE_SHIFT, true);
btrfs_delalloc_release_extents(BTRFS_I(inode), page_cnt << PAGE_SHIFT, btrfs_delalloc_release_extents(BTRFS_I(inode), page_cnt << PAGE_SHIFT);
true);
extent_changeset_free(data_reserved); extent_changeset_free(data_reserved);
return ret; return ret;
......
...@@ -3629,7 +3629,7 @@ int __btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes, ...@@ -3629,7 +3629,7 @@ int __btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes,
return 0; return 0;
BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize)); BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize));
trace_qgroup_meta_reserve(root, type, (s64)num_bytes); trace_qgroup_meta_reserve(root, (s64)num_bytes, type);
ret = qgroup_reserve(root, num_bytes, enforce, type); ret = qgroup_reserve(root, num_bytes, enforce, type);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -3676,7 +3676,7 @@ void __btrfs_qgroup_free_meta(struct btrfs_root *root, int num_bytes, ...@@ -3676,7 +3676,7 @@ void __btrfs_qgroup_free_meta(struct btrfs_root *root, int num_bytes,
*/ */
num_bytes = sub_root_meta_rsv(root, num_bytes, type); num_bytes = sub_root_meta_rsv(root, num_bytes, type);
BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize)); BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize));
trace_qgroup_meta_reserve(root, type, -(s64)num_bytes); trace_qgroup_meta_reserve(root, -(s64)num_bytes, type);
btrfs_qgroup_free_refroot(fs_info, root->root_key.objectid, btrfs_qgroup_free_refroot(fs_info, root->root_key.objectid,
num_bytes, type); num_bytes, type);
} }
......
...@@ -3277,6 +3277,8 @@ static int relocate_file_extent_cluster(struct inode *inode, ...@@ -3277,6 +3277,8 @@ static int relocate_file_extent_cluster(struct inode *inode,
if (!page) { if (!page) {
btrfs_delalloc_release_metadata(BTRFS_I(inode), btrfs_delalloc_release_metadata(BTRFS_I(inode),
PAGE_SIZE, true); PAGE_SIZE, true);
btrfs_delalloc_release_extents(BTRFS_I(inode),
PAGE_SIZE);
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
...@@ -3297,7 +3299,7 @@ static int relocate_file_extent_cluster(struct inode *inode, ...@@ -3297,7 +3299,7 @@ static int relocate_file_extent_cluster(struct inode *inode,
btrfs_delalloc_release_metadata(BTRFS_I(inode), btrfs_delalloc_release_metadata(BTRFS_I(inode),
PAGE_SIZE, true); PAGE_SIZE, true);
btrfs_delalloc_release_extents(BTRFS_I(inode), btrfs_delalloc_release_extents(BTRFS_I(inode),
PAGE_SIZE, true); PAGE_SIZE);
ret = -EIO; ret = -EIO;
goto out; goto out;
} }
...@@ -3326,7 +3328,7 @@ static int relocate_file_extent_cluster(struct inode *inode, ...@@ -3326,7 +3328,7 @@ static int relocate_file_extent_cluster(struct inode *inode,
btrfs_delalloc_release_metadata(BTRFS_I(inode), btrfs_delalloc_release_metadata(BTRFS_I(inode),
PAGE_SIZE, true); PAGE_SIZE, true);
btrfs_delalloc_release_extents(BTRFS_I(inode), btrfs_delalloc_release_extents(BTRFS_I(inode),
PAGE_SIZE, true); PAGE_SIZE);
clear_extent_bits(&BTRFS_I(inode)->io_tree, clear_extent_bits(&BTRFS_I(inode)->io_tree,
page_start, page_end, page_start, page_end,
...@@ -3342,8 +3344,7 @@ static int relocate_file_extent_cluster(struct inode *inode, ...@@ -3342,8 +3344,7 @@ static int relocate_file_extent_cluster(struct inode *inode,
put_page(page); put_page(page);
index++; index++;
btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE, btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE);
false);
balance_dirty_pages_ratelimited(inode->i_mapping); balance_dirty_pages_ratelimited(inode->i_mapping);
btrfs_throttle(fs_info); btrfs_throttle(fs_info);
} }
......
...@@ -1688,6 +1688,7 @@ TRACE_EVENT(qgroup_update_reserve, ...@@ -1688,6 +1688,7 @@ TRACE_EVENT(qgroup_update_reserve,
__entry->qgid = qgroup->qgroupid; __entry->qgid = qgroup->qgroupid;
__entry->cur_reserved = qgroup->rsv.values[type]; __entry->cur_reserved = qgroup->rsv.values[type];
__entry->diff = diff; __entry->diff = diff;
__entry->type = type;
), ),
TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld", TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld",
...@@ -1710,6 +1711,7 @@ TRACE_EVENT(qgroup_meta_reserve, ...@@ -1710,6 +1711,7 @@ TRACE_EVENT(qgroup_meta_reserve,
TP_fast_assign_btrfs(root->fs_info, TP_fast_assign_btrfs(root->fs_info,
__entry->refroot = root->root_key.objectid; __entry->refroot = root->root_key.objectid;
__entry->diff = diff; __entry->diff = diff;
__entry->type = type;
), ),
TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld", TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld",
...@@ -1726,7 +1728,6 @@ TRACE_EVENT(qgroup_meta_convert, ...@@ -1726,7 +1728,6 @@ TRACE_EVENT(qgroup_meta_convert,
TP_STRUCT__entry_btrfs( TP_STRUCT__entry_btrfs(
__field( u64, refroot ) __field( u64, refroot )
__field( s64, diff ) __field( s64, diff )
__field( int, type )
), ),
TP_fast_assign_btrfs(root->fs_info, TP_fast_assign_btrfs(root->fs_info,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment