qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>, qemu-devel@nongnu.org
Cc: "Kevin Wolf" <kwolf@redhat.com>,
	qemu-block@nongnu.org, qemu-trivial@nongnu.org,
	"Richard W.M. Jones" <rjones@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Liu Yuan" <namei.unix@gmail.com>,
	"Max Reitz" <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/4] block/file-posix: Convert from DPRINTF() macro to trace events
Date: Thu, 13 Dec 2018 10:18:15 +0100	[thread overview]
Message-ID: <2282b7a4-70fb-bcb1-bc06-3265a2ab6a67@redhat.com> (raw)
In-Reply-To: <20181212194009.2951-4-lvivier@redhat.com>

On 12/12/18 8:40 PM, Laurent Vivier wrote:
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  block/file-posix.c | 25 ++++++-------------------
>  block/trace-events |  7 +++++++
>  2 files changed, 13 insertions(+), 19 deletions(-)
> 
> diff --git a/block/file-posix.c b/block/file-posix.c
> index 07bbdab953..cf90899a6e 100644
> --- a/block/file-posix.c
> +++ b/block/file-posix.c
> @@ -102,19 +102,7 @@
>  #include <xfs/xfs.h>
>  #endif
>  
> -//#define DEBUG_BLOCK
> -
> -#ifdef DEBUG_BLOCK
> -# define DEBUG_BLOCK_PRINT 1
> -#else
> -# define DEBUG_BLOCK_PRINT 0
> -#endif
> -#define DPRINTF(fmt, ...) \
> -do { \
> -    if (DEBUG_BLOCK_PRINT) { \
> -        printf(fmt, ## __VA_ARGS__); \
> -    } \
> -} while (0)
> +#include "trace.h"
>  
>  /* OS X does not have O_DSYNC */
>  #ifndef O_DSYNC
> @@ -1386,7 +1374,7 @@ static int xfs_write_zeroes(BDRVRawState *s, int64_t offset, uint64_t bytes)
>  
>      if (xfsctl(NULL, s->fd, XFS_IOC_ZERO_RANGE, &fl) < 0) {
>          err = errno;
> -        DPRINTF("cannot write zero range (%s)\n", strerror(errno));
> +        trace_file_xfs_write_zeroes(strerror(errno));
>          return -err;
>      }
>  
> @@ -1405,7 +1393,7 @@ static int xfs_discard(BDRVRawState *s, int64_t offset, uint64_t bytes)
>  
>      if (xfsctl(NULL, s->fd, XFS_IOC_UNRESVSP64, &fl) < 0) {
>          err = errno;
> -        DPRINTF("cannot punch hole (%s)\n", strerror(errno));
> +        trace_file_xfs_discard(strerror(errno));
>          return -err;
>      }
>  
> @@ -2798,7 +2786,7 @@ static char *FindEjectableOpticalMedia(io_iterator_t *mediaIterator)
>  
>          /* If a match was found, leave the loop */
>          if (*mediaIterator != 0) {
> -            DPRINTF("Matching using %s\n", matching_array[index]);
> +            trace_file_FindEjectableOpticalMedia(matching_array[index]);
>              mediaType = g_strdup(matching_array[index]);
>              break;
>          }
> @@ -2858,7 +2846,7 @@ static bool setup_cdrom(char *bsd_path, Error **errp)
>      if (partition_found == false) {
>          error_setg(errp, "Failed to find a working partition on disc");
>      } else {
> -        DPRINTF("Using %s as optical disc\n", test_partition);
> +        trace_file_setup_cdrom(test_partition);
>          pstrcpy(bsd_path, MAXPATHLEN, test_partition);
>      }
>      return partition_found;
> @@ -2953,8 +2941,7 @@ static bool hdev_is_sg(BlockDriverState *bs)
>  
>      ret = ioctl(s->fd, SG_GET_SCSI_ID, &scsiid);
>      if (ret >= 0) {
> -        DPRINTF("SG device found: type=%d, version=%d\n",
> -            scsiid.scsi_type, sg_version);
> +        trace_file_hdev_is_sg(scsiid.scsi_type, sg_version);
>          return true;
>      }
>  
> diff --git a/block/trace-events b/block/trace-events
> index 5b83280b02..49f31966e7 100644
> --- a/block/trace-events
> +++ b/block/trace-events
> @@ -182,3 +182,10 @@ curl_open(const char *file) "opening %s"
>  curl_open_size(uint64_t size) "size = %" PRIu64
>  curl_setup_preadv(uint64_t bytes, uint64_t start, const char *range) "reading %" PRIu64 " at %" PRIu64 " (%s)"
>  curl_close(void) "close"
> +
> +# block/file-posix.c
> +file_xfs_write_zeroes(const char *error) "cannot write zero range (%s)"
> +file_xfs_discard(const char* error) "cannot punch hole (%s)"
> +file_FindEjectableOpticalMedia(const char *media) "Matching using %s"
> +file_setup_cdrom(const char *partition) "Using %s as optical disc"
> +file_hdev_is_sg(int type, int version) "SG device found: type=%d, version=%d"
> 

  reply	other threads:[~2018-12-13  9:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-12 19:40 [Qemu-devel] [PATCH 0/4] block: Convert from DPRINTF() macro to trace event Laurent Vivier
2018-12-12 19:40 ` [Qemu-devel] [PATCH 1/4] block/ssh: Convert from DPRINTF() macro to trace events Laurent Vivier
2018-12-12 21:19   ` Richard W.M. Jones
2018-12-13  9:17   ` Philippe Mathieu-Daudé
2018-12-12 19:40 ` [Qemu-devel] [PATCH 2/4] block/curl: " Laurent Vivier
2018-12-12 21:20   ` Richard W.M. Jones
2018-12-13  9:23   ` Philippe Mathieu-Daudé
2018-12-12 19:40 ` [Qemu-devel] [PATCH 3/4] block/file-posix: " Laurent Vivier
2018-12-13  9:18   ` Philippe Mathieu-Daudé [this message]
2018-12-12 19:40 ` [Qemu-devel] [PATCH 4/4] block/sheepdog: " Laurent Vivier
2018-12-13  9:21   ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2282b7a4-70fb-bcb1-bc06-3265a2ab6a67@redhat.com \
    --to=philmd@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=kwolf@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=namei.unix@gmail.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=rjones@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).