Re: [PATCH] btrfs: qgroup: Fix wrong parameter order for trace events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 16, 2019 at 03:31:49PM +0800, Qu Wenruo wrote:
> --- a/fs/btrfs/qgroup.c
> +++ b/fs/btrfs/qgroup.c
> @@ -3629,7 +3629,7 @@ int __btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes,
>  		return 0;
>  
>  	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);
>  	if (ret < 0)
>  		return ret;
> @@ -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);
>  	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,
>  				  num_bytes, type);
>  }

It would be good to split the changes, one is swapping the order and the
other fixing the uninitialized type.

> diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
> index 5df604de4f11..0ebcaa153f93 100644
> --- a/include/trace/events/btrfs.h
> +++ b/include/trace/events/btrfs.h
> @@ -1710,6 +1710,7 @@ TRACE_EVENT(qgroup_meta_reserve,
>  	TP_fast_assign_btrfs(root->fs_info,
>  		__entry->refroot	= root->root_key.objectid;
>  		__entry->diff		= diff;
> +		__entry->type		= type;

And there's more, missing type assignment in qgroup_update_reserve,
redundant entry::type in qgroup_meta_convert.

I've briefly checked more tracepoint initialization, seems ok. It really
helps to have the same order for definition and for the assignments.



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux