Blame SOURCES/0012-extentlist-Documentation-and-test-fixes.patch

efa7a1
From 2a3e909e9e1ccb608bde75b76524acd753b33889 Mon Sep 17 00:00:00 2001
efa7a1
From: "Richard W.M. Jones" <rjones@redhat.com>
efa7a1
Date: Sat, 25 Jan 2020 11:38:14 +0000
efa7a1
Subject: [PATCH] extentlist: Documentation and test fixes.
efa7a1
efa7a1
Updates commit 3e770b6d6620a62546849a2863638041c0b00640.
efa7a1
efa7a1
(cherry picked from commit c16709ef663a5ed9fd9ddef4e379f316d84c9a07)
efa7a1
---
efa7a1
 TODO                                          | 12 +++++++----
efa7a1
 .../extentlist/nbdkit-extentlist-filter.pod   | 21 +++++++++++++------
efa7a1
 plugins/curl/nbdkit-curl-plugin.pod           |  1 +
efa7a1
 plugins/ssh/nbdkit-ssh-plugin.pod             |  1 +
efa7a1
 tests/test-extentlist.sh                      |  2 +-
efa7a1
 5 files changed, 26 insertions(+), 11 deletions(-)
efa7a1
efa7a1
diff --git a/TODO b/TODO
efa7a1
index 2a3e89d..e1ac71c 100644
efa7a1
--- a/TODO
efa7a1
+++ b/TODO
efa7a1
@@ -187,10 +187,6 @@ Suggestions for filters
efa7a1
   MBs of extra data)
efa7a1
   https://github.com/facebook/zstd/issues/395#issuecomment-535875379
efa7a1
 
efa7a1
-* nbdkit-extentlist-filter could read the extents generated by
efa7a1
-  qemu-img map, allowing extents to be ported from a qemu block
efa7a1
-  device.
efa7a1
-
efa7a1
 nbdkit-rate-filter:
efa7a1
 
efa7a1
 * allow other kinds of traffic shaping such as VBR
efa7a1
@@ -216,6 +212,14 @@ nbdkit-retry-filter:
efa7a1
 
efa7a1
 * subsecond times
efa7a1
 
efa7a1
+nbdkit-extentlist-filter:
efa7a1
+
efa7a1
+* read the extents generated by qemu-img map, allowing extents to be
efa7a1
+  ported from a qemu block device
efa7a1
+
efa7a1
+* make non-read-only access safe by updating the extent list when the
efa7a1
+  filter sees writes and trims
efa7a1
+
efa7a1
 Filters for security
efa7a1
 --------------------
efa7a1
 
efa7a1
diff --git a/filters/extentlist/nbdkit-extentlist-filter.pod b/filters/extentlist/nbdkit-extentlist-filter.pod
efa7a1
index adfb4ad..5d1a38a 100644
efa7a1
--- a/filters/extentlist/nbdkit-extentlist-filter.pod
efa7a1
+++ b/filters/extentlist/nbdkit-extentlist-filter.pod
efa7a1
@@ -4,7 +4,7 @@ nbdkit-extentlist-filter - place extent list over a plugin
efa7a1
 
efa7a1
 =head1 SYNOPSIS
efa7a1
 
efa7a1
- nbdkit --filter=extentlist plugin extentlist=FILENAME
efa7a1
+ nbdkit -r --filter=extentlist plugin extentlist=FILENAME
efa7a1
 
efa7a1
 =head1 DESCRIPTION
efa7a1
 
efa7a1
@@ -13,11 +13,20 @@ static list of extents on top of an existing plugin.  Extents record
efa7a1
 whether or not specific parts of the disk are allocated or sparse.
efa7a1
 
efa7a1
 You can use this with plugins which cannot get extent information
efa7a1
-themselves, but you can get this information from another source.  One
efa7a1
-place where it is useful is with L<nbdkit-ssh-plugin(1)> because the
efa7a1
-sftp protocol does not support reading sparseness information, but you
efa7a1
-may be able to get this information directly from the source disk on
efa7a1
-the remote server.
efa7a1
+themselves, but where you can get this information from another
efa7a1
+source.  One place where it is useful is with L<nbdkit-ssh-plugin(1)>
efa7a1
+because the sftp protocol does not support reading sparseness
efa7a1
+information, but you may be able to get this information directly from
efa7a1
+the source disk on the remote server using commands such as
efa7a1
+L<xfs_bmap(8)>.  A similar situation applies to
efa7a1
+L<nbdkit-curl-plugin(1)>.
efa7a1
+
efa7a1
+Note that the extent list is read-only.  This filter does not monitor
efa7a1
+writes and trims in order to update the extent list.  What can happen
efa7a1
+is that you would write to a “hole” in the disk, but would not be able
efa7a1
+to read it back because the NBD client would still think that part of
efa7a1
+the disk is a hole.  So it is generally only safe to use this filter
efa7a1
+in read-only mode (I<-r> option).
efa7a1
 
efa7a1
 =head1 FILE FORMAT
efa7a1
 
efa7a1
diff --git a/plugins/curl/nbdkit-curl-plugin.pod b/plugins/curl/nbdkit-curl-plugin.pod
efa7a1
index 827e0bd..d3c8524 100644
efa7a1
--- a/plugins/curl/nbdkit-curl-plugin.pod
efa7a1
+++ b/plugins/curl/nbdkit-curl-plugin.pod
efa7a1
@@ -182,6 +182,7 @@ L<libcurl(3)>,
efa7a1
 L<CURLOPT_COOKIE(3)>
efa7a1
 L<CURLOPT_VERBOSE(3)>,
efa7a1
 L<nbdkit(1)>,
efa7a1
+L<nbdkit-extentlist-filter(1)>,
efa7a1
 L<nbdkit-readahead-filter(1)>,
efa7a1
 L<nbdkit-retry-filter(1)>,
efa7a1
 L<nbdkit-ssh-plugin(1)>,
efa7a1
diff --git a/plugins/ssh/nbdkit-ssh-plugin.pod b/plugins/ssh/nbdkit-ssh-plugin.pod
efa7a1
index 0a0421d..3fc3146 100644
efa7a1
--- a/plugins/ssh/nbdkit-ssh-plugin.pod
efa7a1
+++ b/plugins/ssh/nbdkit-ssh-plugin.pod
efa7a1
@@ -316,6 +316,7 @@ C<nbdkit-ssh-plugin> first appeared in nbdkit 1.12.
efa7a1
 
efa7a1
 L<nbdkit(1)>,
efa7a1
 L<nbdkit-curl-plugin(1)>,
efa7a1
+L<nbdkit-extentlist-filter(1)>,
efa7a1
 L<nbdkit-readahead-filter(1)>,
efa7a1
 L<nbdkit-retry-filter(1)>,
efa7a1
 L<nbdkit-plugin(3)>,
efa7a1
diff --git a/tests/test-extentlist.sh b/tests/test-extentlist.sh
efa7a1
index 7d05de4..73ce3ca 100755
efa7a1
--- a/tests/test-extentlist.sh
efa7a1
+++ b/tests/test-extentlist.sh
efa7a1
@@ -50,7 +50,7 @@ cleanup_fn rm $files
efa7a1
 test ()
efa7a1
 {
efa7a1
     nbdkit -v -D extentlist.lookup=1 \
efa7a1
-           -U - \
efa7a1
+           -r -U - \
efa7a1
            --filter=extentlist \
efa7a1
            null size=$1 extentlist=$input \
efa7a1
            --run 'qemu-img map -f raw --output=json $nbd' |
efa7a1
-- 
efa7a1
2.18.2
efa7a1