[Libguestfs] [nbdkit PATCH] sh: Prefer dd bs=1 over iflag=count_bytes

Richard W.M. Jones rjones at redhat.com
Tue Aug 18 14:58:26 UTC 2020


On Mon, Aug 17, 2020 at 11:35:39AM -0500, Eric Blake wrote:
> While iflag=count_bytes combined with bs > 1 allows for more efficient
> operation, it is a feature of GNU dd, and not present on other
> implementations such as BSD.  Sticking to just POSIX features makes
> things more portable.

I'm not very convinced by this.  Maybe we should persuade
the BSD folk to implement this useful feature instead?

As one example:

> diff --git a/docs/nbdkit-loop.pod b/docs/nbdkit-loop.pod
> index 055b5750..b21c2212 100644
> --- a/docs/nbdkit-loop.pod
> +++ b/docs/nbdkit-loop.pod
> @@ -120,7 +120,7 @@ creates a disk which contains a bad sector:
>               echo EIO Bad block >&2
>               exit 1
>           else
> -             dd if=/dev/zero count=$3 iflag=count_bytes
> +             dd bs=1 if=/dev/zero count=$3
>           fi ;;
>       *) exit 2 ;;
>   esac

this change could be a killer for performance since the suggested size
of the disk is 64M.

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/




More information about the Libguestfs mailing list