2021-08-19 07:53:56 +00:00
|
|
|
From a22248e3075e782d28542f8f6acd046c9dfa8998 Mon Sep 17 00:00:00 2001
|
2021-08-10 15:09:59 +00:00
|
|
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
|
Date: Mon, 9 Aug 2021 14:09:31 +0100
|
|
|
|
Subject: [PATCH] cow: Add some more debugging especially for blk_read_multiple
|
|
|
|
and cow-on-read
|
|
|
|
|
|
|
|
Only activated when we use -D cow.verbose=1
|
|
|
|
|
|
|
|
(cherry picked from commit 2da1ae0ca966af955d8fcf3feffffc80d07142fd)
|
|
|
|
---
|
|
|
|
filters/cow/blk.c | 11 +++++++++--
|
|
|
|
1 file changed, 9 insertions(+), 2 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/filters/cow/blk.c b/filters/cow/blk.c
|
2021-08-19 07:53:56 +00:00
|
|
|
index 4f84e092..c22d5886 100644
|
2021-08-10 15:09:59 +00:00
|
|
|
--- a/filters/cow/blk.c
|
|
|
|
+++ b/filters/cow/blk.c
|
2021-08-19 07:53:56 +00:00
|
|
|
@@ -254,8 +254,10 @@ blk_read_multiple (nbdkit_next *next,
|
2021-08-10 15:09:59 +00:00
|
|
|
|
|
|
|
if (cow_debug_verbose)
|
|
|
|
nbdkit_debug ("cow: blk_read_multiple block %" PRIu64
|
|
|
|
- " (offset %" PRIu64 ") is %s",
|
|
|
|
- blknum, (uint64_t) offset, state_to_string (state));
|
|
|
|
+ " (offset %" PRIu64 ") run of length %" PRIu64
|
|
|
|
+ " is %s",
|
|
|
|
+ blknum, (uint64_t) offset, runblocks,
|
|
|
|
+ state_to_string (state));
|
|
|
|
|
|
|
|
if (state == BLOCK_NOT_ALLOCATED) { /* Read underlying plugin. */
|
|
|
|
unsigned n, tail = 0;
|
2021-08-19 07:53:56 +00:00
|
|
|
@@ -281,6 +283,11 @@ blk_read_multiple (nbdkit_next *next,
|
2021-08-10 15:09:59 +00:00
|
|
|
* set them as allocated.
|
|
|
|
*/
|
|
|
|
if (cow_on_read) {
|
|
|
|
+ if (cow_debug_verbose)
|
|
|
|
+ nbdkit_debug ("cow: cow-on-read saving %" PRIu64 " blocks "
|
|
|
|
+ "at offset %" PRIu64 " into the cache",
|
|
|
|
+ runblocks, offset);
|
|
|
|
+
|
|
|
|
if (full_pwrite (fd, block, BLKSIZE * runblocks, offset) == -1) {
|
|
|
|
*err = errno;
|
|
|
|
nbdkit_error ("pwrite: %m");
|
|
|
|
--
|
|
|
|
2.31.1
|
|
|
|
|