diff mbox series

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

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

Commit Message

Andrey Drobyshev Sept. 13, 2024, 4:39 p.m. UTC
This would ease debugging of write zeroes and discard operations.

Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Reviewed-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
---
 block/file-posix.c | 1 +
 block/trace-events | 1 +
 2 files changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/block/file-posix.c b/block/file-posix.c
index ff928b5e85..9016057926 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -1862,6 +1862,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"