[PATCH] file_ioctl.c: print first two extents for FIDEDUPERANGE in abbrev mode

Dmitry V. Levin ldv at altlinux.org
Mon May 30 12:47:00 UTC 2016


On Fri, May 27, 2016 at 04:07:22PM -0400, Jeff Mahoney wrote:
> * file_ioctl.c (file_ioctl, print_file_dedupe_range_info): print first
>   two elements of info array in abbrev mode
> * tests/btrfs.c (btrfs_test_extent_same_ioctl): handle newly
>   printed elements
> ---
>  file_ioctl.c  | 31 +++++++++++++++----------
>  tests/btrfs.c | 74 ++++++++++++++++++++++++++++++++++++++---------------------
>  2 files changed, 67 insertions(+), 38 deletions(-)
> 
> diff --git a/file_ioctl.c b/file_ioctl.c
> index b065db9..95e526d 100644
> --- a/file_ioctl.c
> +++ b/file_ioctl.c
> @@ -80,6 +80,7 @@ print_file_dedupe_range_info(struct tcb *tcp, void *elem_buf,
>  			     size_t elem_size, void *data)
>  {
>  	const struct file_dedupe_range_info *info = elem_buf;
> +	int *count = data;
>  
>  	if (entering(tcp)) {
>  		tprints("{dest_fd=");
> @@ -91,6 +92,11 @@ print_file_dedupe_range_info(struct tcb *tcp, void *elem_buf,
>  			(uint64_t) info->bytes_deduped, info->status);
>  	}
>  
> +	if (count && --*count == 0) {
> +		tprints(", ...");
> +		return false;
> +	}

As we mostly print ellipsis when we sure that there is something to print,
I've slightly changed this check so it prints ellipsis when *count is zero
before the decrement.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160530/2273e7ab/attachment.bin>


More information about the Strace-devel mailing list