diff mbox series

[v2,04/11] block/file-posix: add trace event for fallocate() calls

Message ID 20240513063203.113911-5-andrey.drobyshev@virtuozzo.com (mailing list archive)
State New, archived
Headers show
Series qcow2: make subclusters discardable | expand

Commit Message

Andrey Drobyshev May 13, 2024, 6:31 a.m. UTC
This would ease debugging of write zeroes and discard operations.

Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
---
 block/file-posix.c | 1 +
 block/trace-events | 1 +
 2 files changed, 2 insertions(+)

Comments

Alexander Ivanov May 21, 2024, 8:54 a.m. UTC | #1
On 5/13/24 08:31, Andrey Drobyshev wrote:
> This would ease debugging of write zeroes and discard operations.
>
> Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
> ---
>   block/file-posix.c | 1 +
>   block/trace-events | 1 +
>   2 files changed, 2 insertions(+)
>
> diff --git a/block/file-posix.c b/block/file-posix.c
> index 35684f7e21..45134f0eef 100644
> --- a/block/file-posix.c
> +++ b/block/file-posix.c
> @@ -1859,6 +1859,7 @@ static int translate_err(int err)
>   static int do_fallocate(int fd, int mode, off_t offset, off_t len)
>   {
>       do {
> +        trace_file_do_fallocate(fd, mode, offset, len);
>           if (fallocate(fd, mode, offset, len) == 0) {
>               return 0;
>           }
> diff --git a/block/trace-events b/block/trace-events
> index 8e789e1f12..2f7ad28996 100644
> --- a/block/trace-events
> +++ b/block/trace-events
> @@ -203,6 +203,7 @@ curl_setup_preadv(uint64_t bytes, uint64_t start, const char *range) "reading %"
>   curl_close(void) "close"
>   
>   # file-posix.c
> +file_do_fallocate(int fd, int mode, int64_t offset, int64_t len) "fd=%d mode=0x%02x offset=%" PRIi64 " len=%" PRIi64
>   file_copy_file_range(void *bs, int src, int64_t src_off, int dst, int64_t dst_off, int64_t bytes, int flags, int64_t ret) "bs %p src_fd %d offset %"PRIu64" dst_fd %d offset %"PRIu64" bytes %"PRIu64" flags %d ret %"PRId64
>   file_FindEjectableOpticalMedia(const char *media) "Matching using %s"
>   file_setup_cdrom(const char *partition) "Using %s as optical disc"
Reviewed-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
Alberto Garcia May 24, 2024, 6:40 a.m. UTC | #2
On Mon 13 May 2024 09:31:56 AM +03, Andrey Drobyshev wrote:
> This would ease debugging of write zeroes and discard operations.
>
> Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>

Reviewed-by: Alberto Garcia <berto@igalia.com>

Berto
diff mbox series

Patch

diff --git a/block/file-posix.c b/block/file-posix.c
index 35684f7e21..45134f0eef 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -1859,6 +1859,7 @@  static int translate_err(int err)
 static int do_fallocate(int fd, int mode, off_t offset, off_t len)
 {
     do {
+        trace_file_do_fallocate(fd, mode, offset, len);
         if (fallocate(fd, mode, offset, len) == 0) {
             return 0;
         }
diff --git a/block/trace-events b/block/trace-events
index 8e789e1f12..2f7ad28996 100644
--- a/block/trace-events
+++ b/block/trace-events
@@ -203,6 +203,7 @@  curl_setup_preadv(uint64_t bytes, uint64_t start, const char *range) "reading %"
 curl_close(void) "close"
 
 # file-posix.c
+file_do_fallocate(int fd, int mode, int64_t offset, int64_t len) "fd=%d mode=0x%02x offset=%" PRIi64 " len=%" PRIi64
 file_copy_file_range(void *bs, int src, int64_t src_off, int dst, int64_t dst_off, int64_t bytes, int flags, int64_t ret) "bs %p src_fd %d offset %"PRIu64" dst_fd %d offset %"PRIu64" bytes %"PRIu64" flags %d ret %"PRId64
 file_FindEjectableOpticalMedia(const char *media) "Matching using %s"
 file_setup_cdrom(const char *partition) "Using %s as optical disc"