[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH nbdkit 2/6] checkwrite: Simplify trim/zero using nbdkit_extents_full.



On Wed, Feb 03, 2021 at 02:50:43PM -0600, Eric Blake wrote:
> On 1/26/21 3:51 PM, Richard W.M. Jones wrote:
> > ---
> >  filters/checkwrite/checkwrite.c | 96 +++++++++++++--------------------
> >  1 file changed, 38 insertions(+), 58 deletions(-)
> > 
> > diff --git a/filters/checkwrite/checkwrite.c b/filters/checkwrite/checkwrite.c
> > index 68c57c37..2792d4d8 100644
> > --- a/filters/checkwrite/checkwrite.c
> > +++ b/filters/checkwrite/checkwrite.c
> > @@ -150,67 +150,47 @@ checkwrite_trim_zero (struct nbdkit_next_ops *next_ops, void *nxdata,
> >  {
> >    /* If the plugin supports extents, speed this up by using them. */
> >    if (next_ops->can_extents (nxdata)) {
> 
> > +    size_t i, n;
> > +    CLEANUP_EXTENTS_FREE struct nbdkit_extents *exts =
> > +      nbdkit_extents_full (next_ops, nxdata, count, offset, 0, err);
> > +    if (exts == NULL)
> > +      return -1;
> 
> Should we instead behave like the entire region is data, instead of
> reflecting back the error?

After thinking about this, I think if plugin.extents is returning
errors then we should return an error.  But that's only because this
filter is designed to test copying tools, and so it should be
extra-cautious and prefer failing over trying to continue.  In a
different kind of filter the trade-off would be different, and trying
to continue would make sense.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]