[PATCH nbdkit] log: Decode the extent type in output.
by Richard W.M. Jones
Instead of printing something like ‘type=0’ or ‘type=3’, this changes
the output to show the hole and zero flags separately. For example:
$ ./nbdkit -U - --filter=log sh - logfile=/dev/stdout \
--run 'qemu-img map $nbd' <<'EOF'
case "$1" in
get_size) echo 1M ;;
pread) dd if=/dev/zero count=$3 iflag=count_bytes ;;
can_extents) exit 0 ;;
extents)
echo "0 32K zero"
echo "32K 32K hole,zero"
echo "64K 983040 "
;;
*) exit 2 ;;
esac
EOF
[...]
2019-04-01 11:49:40.818357 connection=1 Extents id=2 offset=0x0 count=0x100000 req_one=1 ...
2019-04-01 11:49:40.819848 connection=1 ...Extents id=2 extents=[{ offset=0x0, length=0x8000, hole=0, zero=1 }, { offset=0x8000, length=0x8000, hole=1, zero=1 }, { offset=0x10000, length=0xf0000, hole=0, zero=0 }] return=0
Updates commit ed868b00f192cd72e91265e4fcdf3c3fbe8b7613.
Thanks: Martin Kletzander
---
filters/log/log.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/filters/log/log.c b/filters/log/log.c
index 4878db2..02a2522 100644
--- a/filters/log/log.c
+++ b/filters/log/log.c
@@ -382,8 +382,10 @@ log_extents (struct nbdkit_next_ops *next_ops, void *nxdata,
if (i > 0)
fprintf (fp, ", ");
fprintf (fp, "{ offset=0x%" PRIx64 ", length=0x%" PRIx64 ", "
- "type=%" PRIu32 " }",
- e.offset, e.length, e.type);
+ "hole=%d, zero=%d }",
+ e.offset, e.length,
+ !!(e.type & NBDKIT_EXTENT_HOLE),
+ !!(e.type & NBDKIT_EXTENT_ZERO));
}
fclose (fp);
--
2.20.1
5 years, 8 months
[PATCH nbdkit] error: Fix all error-*-file parameters.
by Richard W.M. Jones
These didn't work because of copy and paste errors in
commit 086a1ceaeb8da4c67787c31580548f7a607b7a7c
and commit f649b53c037681e897471aa438758a07f067d624.
Thanks: Martin Kletzander
---
filters/error/error.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/filters/error/error.c b/filters/error/error.c
index bf7b442..0f84f12 100644
--- a/filters/error/error.c
+++ b/filters/error/error.c
@@ -213,27 +213,27 @@ error_config (nbdkit_next_config *next, void *nxdata,
extents_settings.file = nbdkit_absolute_path (value);
return 0;
}
- else if (strcmp (key, "error-pread-rate") == 0) {
+ else if (strcmp (key, "error-pread-file") == 0) {
free (pread_settings.file);
pread_settings.file = nbdkit_absolute_path (value);
return 0;
}
- else if (strcmp (key, "error-pwrite-rate") == 0) {
+ else if (strcmp (key, "error-pwrite-file") == 0) {
free (pwrite_settings.file);
pwrite_settings.file = nbdkit_absolute_path (value);
return 0;
}
- else if (strcmp (key, "error-trim-rate") == 0) {
+ else if (strcmp (key, "error-trim-file") == 0) {
free (trim_settings.file);
trim_settings.file = nbdkit_absolute_path (value);
return 0;
}
- else if (strcmp (key, "error-zero-rate") == 0) {
+ else if (strcmp (key, "error-zero-file") == 0) {
free (zero_settings.file);
zero_settings.file = nbdkit_absolute_path (value);
return 0;
}
- else if (strcmp (key, "error-extents-rate") == 0) {
+ else if (strcmp (key, "error-extents-file") == 0) {
free (extents_settings.file);
extents_settings.file = nbdkit_absolute_path (value);
return 0;
--
2.20.1
5 years, 8 months