[Libguestfs] [PATCH libnbd 1/2] copy: Add temporary debugging messages
Nir Soffer
nsoffer at redhat.com
Tue Feb 23 13:46:26 UTC 2021
On Tue, Feb 23, 2021 at 3:41 PM Nir Soffer <nirsof at gmail.com> wrote:
>
> To help diagnose the abort during sparsify. We probably need to have
> similar messages when using --verbose.
> ---
> copy/multi-thread-copying.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/copy/multi-thread-copying.c b/copy/multi-thread-copying.c
> index c36a165..a1f4b19 100644
> --- a/copy/multi-thread-copying.c
> +++ b/copy/multi-thread-copying.c
> @@ -393,12 +393,16 @@ finished_read (void *vp, int *error)
> uint64_t i;
> struct command *newcommand;
>
> + fprintf(stderr, "sparsifying range start=%ld end=%ld len=%ld\n",
> + start, end, end - start);
> +
> /* Iterate over whole blocks in the command, starting on a block
> * boundary.
> */
> for (i = ROUND_UP (start, sparse_size);
> i + sparse_size <= end;
> i += sparse_size) {
> +
> if (is_zero (slice_ptr (command->slice) + i-start, sparse_size)) {
> /* It's a hole. If the last was a hole too then we do nothing
> * here which coalesces. Otherwise write the last data and
> @@ -407,6 +411,8 @@ finished_read (void *vp, int *error)
> if (!last_is_hole) {
> /* Write the last data (if any). */
> if (i - last_offset > 0) {
> + fprintf(stderr, "write last data start=%ld end=%ld len=%ld\n",
> + last_offset, i, i - last_offset);
> newcommand = copy_subcommand (command,
> last_offset, i - last_offset,
> false);
> @@ -429,6 +435,8 @@ finished_read (void *vp, int *error)
> if (last_is_hole) {
> /* Write the last hole (if any). */
> if (i - last_offset > 0) {
> + fprintf(stderr, "write last hole start=%ld end=%ld len=%ld\n",
> + last_offset, i, i - last_offset);
> newcommand = copy_subcommand (command,
> last_offset, i - last_offset,
> true);
> @@ -444,6 +452,8 @@ finished_read (void *vp, int *error)
> /* Write the last_offset up to i. */
> if (i - last_offset > 0) {
> if (!last_is_hole) {
> + fprintf(stderr, "write last data start=%ld end=%ld len=%ld\n",
> + last_offset, i, i - last_offset);
> newcommand = copy_subcommand (command,
> last_offset, i - last_offset,
> false);
> @@ -454,6 +464,8 @@ finished_read (void *vp, int *error)
> });
> }
> else {
> + fprintf(stderr, "write last hole start=%ld end=%ld len=%ld\n",
> + last_offset, i, i - last_offset);
> newcommand = copy_subcommand (command,
> last_offset, i - last_offset,
> true);
> @@ -463,6 +475,8 @@ finished_read (void *vp, int *error)
>
> /* There may be an unaligned tail, so write that. */
> if (end - i > 0) {
> + fprintf(stderr, "write unaligned tail offset=%ld end=%ld len=%ld\n",
> + i, end, end - i);
> newcommand = copy_subcommand (command, i, end - i, false);
> dst->ops->asynch_write (dst, newcommand,
> (nbd_completion_callback) {
> --
> 2.26.2
>
Attaching output of the debugging messages with this patch.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nbdcopy.log
Type: text/x-log
Size: 143333 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20210223/38a2e91e/attachment.bin>
More information about the Libguestfs
mailing list