Commit 7bdd6277 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: Remove redundant argument of flush_space

All callers of flush_space pass the same number for orig/num_bytes
arguments. Let's remove one of the numbers and also modify the trace
point to show only a single number - bytes requested.

Seems that last point where the two parameters were treated differently
is before the ticketed enospc rework.
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 6c6b5a39
...@@ -4906,7 +4906,7 @@ struct reserve_ticket { ...@@ -4906,7 +4906,7 @@ struct reserve_ticket {
static int flush_space(struct btrfs_fs_info *fs_info, static int flush_space(struct btrfs_fs_info *fs_info,
struct btrfs_space_info *space_info, u64 num_bytes, struct btrfs_space_info *space_info, u64 num_bytes,
u64 orig_bytes, int state) int state)
{ {
struct btrfs_root *root = fs_info->extent_root; struct btrfs_root *root = fs_info->extent_root;
struct btrfs_trans_handle *trans; struct btrfs_trans_handle *trans;
...@@ -4931,7 +4931,7 @@ static int flush_space(struct btrfs_fs_info *fs_info, ...@@ -4931,7 +4931,7 @@ static int flush_space(struct btrfs_fs_info *fs_info,
break; break;
case FLUSH_DELALLOC: case FLUSH_DELALLOC:
case FLUSH_DELALLOC_WAIT: case FLUSH_DELALLOC_WAIT:
shrink_delalloc(fs_info, num_bytes * 2, orig_bytes, shrink_delalloc(fs_info, num_bytes * 2, num_bytes,
state == FLUSH_DELALLOC_WAIT); state == FLUSH_DELALLOC_WAIT);
break; break;
case ALLOC_CHUNK: case ALLOC_CHUNK:
...@@ -4949,15 +4949,15 @@ static int flush_space(struct btrfs_fs_info *fs_info, ...@@ -4949,15 +4949,15 @@ static int flush_space(struct btrfs_fs_info *fs_info,
break; break;
case COMMIT_TRANS: case COMMIT_TRANS:
ret = may_commit_transaction(fs_info, space_info, ret = may_commit_transaction(fs_info, space_info,
orig_bytes, 0); num_bytes, 0);
break; break;
default: default:
ret = -ENOSPC; ret = -ENOSPC;
break; break;
} }
trace_btrfs_flush_space(fs_info, space_info->flags, num_bytes, trace_btrfs_flush_space(fs_info, space_info->flags, num_bytes, state,
orig_bytes, state, ret); ret);
return ret; return ret;
} }
...@@ -5063,8 +5063,7 @@ static void btrfs_async_reclaim_metadata_space(struct work_struct *work) ...@@ -5063,8 +5063,7 @@ static void btrfs_async_reclaim_metadata_space(struct work_struct *work)
struct reserve_ticket *ticket; struct reserve_ticket *ticket;
int ret; int ret;
ret = flush_space(fs_info, space_info, to_reclaim, to_reclaim, ret = flush_space(fs_info, space_info, to_reclaim, flush_state);
flush_state);
spin_lock(&space_info->lock); spin_lock(&space_info->lock);
if (list_empty(&space_info->tickets)) { if (list_empty(&space_info->tickets)) {
space_info->flush = 0; space_info->flush = 0;
...@@ -5120,8 +5119,7 @@ static void priority_reclaim_metadata_space(struct btrfs_fs_info *fs_info, ...@@ -5120,8 +5119,7 @@ static void priority_reclaim_metadata_space(struct btrfs_fs_info *fs_info,
spin_unlock(&space_info->lock); spin_unlock(&space_info->lock);
do { do {
flush_space(fs_info, space_info, to_reclaim, to_reclaim, flush_space(fs_info, space_info, to_reclaim, flush_state);
flush_state);
flush_state++; flush_state++;
spin_lock(&space_info->lock); spin_lock(&space_info->lock);
if (ticket->bytes == 0) { if (ticket->bytes == 0) {
......
...@@ -1011,15 +1011,14 @@ TRACE_EVENT(btrfs_trigger_flush, ...@@ -1011,15 +1011,14 @@ TRACE_EVENT(btrfs_trigger_flush,
TRACE_EVENT(btrfs_flush_space, TRACE_EVENT(btrfs_flush_space,
TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 num_bytes, TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 num_bytes,
u64 orig_bytes, int state, int ret), int state, int ret),
TP_ARGS(fs_info, flags, num_bytes, orig_bytes, state, ret), TP_ARGS(fs_info, flags, num_bytes, state, ret),
TP_STRUCT__entry( TP_STRUCT__entry(
__array( u8, fsid, BTRFS_UUID_SIZE ) __array( u8, fsid, BTRFS_UUID_SIZE )
__field( u64, flags ) __field( u64, flags )
__field( u64, num_bytes ) __field( u64, num_bytes )
__field( u64, orig_bytes )
__field( int, state ) __field( int, state )
__field( int, ret ) __field( int, ret )
), ),
...@@ -1028,19 +1027,17 @@ TRACE_EVENT(btrfs_flush_space, ...@@ -1028,19 +1027,17 @@ TRACE_EVENT(btrfs_flush_space,
memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE); memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE);
__entry->flags = flags; __entry->flags = flags;
__entry->num_bytes = num_bytes; __entry->num_bytes = num_bytes;
__entry->orig_bytes = orig_bytes;
__entry->state = state; __entry->state = state;
__entry->ret = ret; __entry->ret = ret;
), ),
TP_printk("%pU: state=%d(%s) flags=%llu(%s) num_bytes=%llu " TP_printk("%pU: state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d",
"orig_bytes=%llu ret=%d", __entry->fsid, __entry->state, __entry->fsid, __entry->state,
show_flush_state(__entry->state), show_flush_state(__entry->state),
(unsigned long long)__entry->flags, (unsigned long long)__entry->flags,
__print_flags((unsigned long)__entry->flags, "|", __print_flags((unsigned long)__entry->flags, "|",
BTRFS_GROUP_FLAGS), BTRFS_GROUP_FLAGS),
(unsigned long long)__entry->num_bytes, (unsigned long long)__entry->num_bytes, __entry->ret)
(unsigned long long)__entry->orig_bytes, __entry->ret)
); );
DECLARE_EVENT_CLASS(btrfs__reserved_extent, DECLARE_EVENT_CLASS(btrfs__reserved_extent,
......
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