[Libguestfs] [PATCH nbdkit v4 05/15] cow: Disable extents information in this filter.

Richard W.M. Jones rjones at redhat.com
Tue Mar 26 21:17:14 UTC 2019


The cow filter doesn't support trimming and we should assume the
underlying plugin is fully allocated too.  Note that both of these
limitations might be lifted with a more advanced filter
implementation.

However we ought to support this in future because xz files contain
sparseness information, so add a note.
---
 filters/cow/cow.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/filters/cow/cow.c b/filters/cow/cow.c
index b8f08c4..570a65f 100644
--- a/filters/cow/cow.c
+++ b/filters/cow/cow.c
@@ -114,7 +114,7 @@ cow_prepare (struct nbdkit_next_ops *next_ops, void *nxdata,
 }
 
 /* Whatever the underlying plugin can or can't do, we can write, we
- * cannot trim, and we can flush.
+ * cannot trim or detect extents, and we can flush.
  */
 static int
 cow_can_write (struct nbdkit_next_ops *next_ops, void *nxdata, void *handle)
@@ -128,6 +128,12 @@ cow_can_trim (struct nbdkit_next_ops *next_ops, void *nxdata, void *handle)
   return 0;
 }
 
+static int
+cow_can_extents (struct nbdkit_next_ops *next_ops, void *nxdata, void *handle)
+{
+  return 0;
+}
+
 static int
 cow_can_flush (struct nbdkit_next_ops *next_ops, void *nxdata, void *handle)
 {
@@ -316,6 +322,7 @@ static struct nbdkit_filter filter = {
   .can_write         = cow_can_write,
   .can_flush         = cow_can_flush,
   .can_trim          = cow_can_trim,
+  .can_extents       = cow_can_extents,
   .can_fua           = cow_can_fua,
   .pread             = cow_pread,
   .pwrite            = cow_pwrite,
-- 
2.20.1




More information about the Libguestfs mailing list