From nobody Fri Dec 19 06:16:02 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548896926060208.30725422920523; Wed, 30 Jan 2019 17:08:46 -0800 (PST) Received: from localhost ([127.0.0.1]:46939 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gp0qN-000624-8G for importer@patchew.org; Wed, 30 Jan 2019 20:08:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gp0i8-00083E-7w for qemu-devel@nongnu.org; Wed, 30 Jan 2019 20:00:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gp0i5-0007kL-UD for qemu-devel@nongnu.org; Wed, 30 Jan 2019 20:00:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35294) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gp0i3-0007h5-82; Wed, 30 Jan 2019 20:00:03 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7047C88317; Thu, 31 Jan 2019 01:00:02 +0000 (UTC) Received: from localhost (ovpn-204-20.brq.redhat.com [10.40.204.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CCAF15D717; Thu, 31 Jan 2019 01:00:01 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Thu, 31 Jan 2019 01:59:37 +0100 Message-Id: <20190131005945.20149-6-mreitz@redhat.com> In-Reply-To: <20190131005945.20149-1-mreitz@redhat.com> References: <20190131005945.20149-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 31 Jan 2019 01:00:02 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 05/13] block/file-posix: Convert from DPRINTF() macro to trace events X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Laurent Vivier Signed-off-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20181213162727.17438-4-lvivier@redhat.com Signed-off-by: Max Reitz --- 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 8aee7a3fb8..ba6ab62a38 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -102,19 +102,7 @@ #include #endif =20 -//#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" =20 /* OS X does not have O_DSYNC */ #ifndef O_DSYNC @@ -1411,7 +1399,7 @@ static int xfs_write_zeroes(BDRVRawState *s, int64_t = offset, uint64_t bytes) =20 if (xfsctl(NULL, s->fd, XFS_IOC_ZERO_RANGE, &fl) < 0) { err =3D errno; - DPRINTF("cannot write zero range (%s)\n", strerror(errno)); + trace_file_xfs_write_zeroes(strerror(errno)); return -err; } =20 @@ -1430,7 +1418,7 @@ static int xfs_discard(BDRVRawState *s, int64_t offse= t, uint64_t bytes) =20 if (xfsctl(NULL, s->fd, XFS_IOC_UNRESVSP64, &fl) < 0) { err =3D errno; - DPRINTF("cannot punch hole (%s)\n", strerror(errno)); + trace_file_xfs_discard(strerror(errno)); return -err; } =20 @@ -2819,7 +2807,7 @@ static char *FindEjectableOpticalMedia(io_iterator_t = *mediaIterator) =20 /* If a match was found, leave the loop */ if (*mediaIterator !=3D 0) { - DPRINTF("Matching using %s\n", matching_array[index]); + trace_file_FindEjectableOpticalMedia(matching_array[index]); mediaType =3D g_strdup(matching_array[index]); break; } @@ -2879,7 +2867,7 @@ static bool setup_cdrom(char *bsd_path, Error **errp) if (partition_found =3D=3D 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; @@ -2974,8 +2962,7 @@ static bool hdev_is_sg(BlockDriverState *bs) =20 ret =3D ioctl(s->fd, SG_GET_SCSI_ID, &scsiid); if (ret >=3D 0) { - DPRINTF("SG device found: type=3D%d, version=3D%d\n", - scsiid.scsi_type, sg_version); + trace_file_hdev_is_sg(scsiid.scsi_type, sg_version); return true; } =20 diff --git a/block/trace-events b/block/trace-events index 8ea8d1eaeb..41b998b7eb 100644 --- a/block/trace-events +++ b/block/trace-events @@ -186,3 +186,10 @@ curl_open(const char *file) "opening %s" curl_open_size(uint64_t size) "size =3D %" PRIu64 curl_setup_preadv(uint64_t bytes, uint64_t start, const char *range) "read= ing %" 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=3D%d, versio= n=3D%d" --=20 2.20.1