summaryrefslogtreecommitdiffstats
path: root/sys-utils/blkdiscard.c
diff options
context:
space:
mode:
authorRuediger Meier2015-12-09 13:01:51 +0100
committerRuediger Meier2015-12-09 18:23:29 +0100
commiteeae448805c0eb2ef130a6ac301750706bb80420 (patch)
tree1a17e848ab67eb98f960577b0ea5190748b4ea3e /sys-utils/blkdiscard.c
parentblkdiscard: fix stats reporting (off by one) (diff)
downloadkernel-qcow2-util-linux-eeae448805c0eb2ef130a6ac301750706bb80420.tar.gz
kernel-qcow2-util-linux-eeae448805c0eb2ef130a6ac301750706bb80420.tar.xz
kernel-qcow2-util-linux-eeae448805c0eb2ef130a6ac301750706bb80420.zip
blkdiscard: don't report "zero range" at the end
We want to address the case that we have printed the last useful stats line already within the loop. Avoiding an additional line "Discarded 0 bytes ..." at the end. Note there is a behavior change now for the edge cases "-v -l 0" and "-v -o blksize" where we don't print any stats line anymore. But actually it's correct, we never make any BLKDISCARD syscall with zero range. Perhaps we should return error in these cases to help people who always want to parse stats output on success. CC: Federico Simoncelli <fsimonce@redhat.com> Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'sys-utils/blkdiscard.c')
-rw-r--r--sys-utils/blkdiscard.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys-utils/blkdiscard.c b/sys-utils/blkdiscard.c
index bb4bae6ea..f36e50492 100644
--- a/sys-utils/blkdiscard.c
+++ b/sys-utils/blkdiscard.c
@@ -211,7 +211,7 @@ int main(int argc, char **argv)
}
}
- if (verbose)
+ if (verbose && stats[1])
print_stats(path, stats);
close(fd);