rbd: make diff banner length depend on the banner

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
rbd: remove alway-true else condition in import-diff

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
librbd: change diff_iterate interface to be more C-friendly

Use int instead of bool for the callback, and make it represent
whether the data exists, rather than the opposite, since callers
are likely to test for whether it's data instead of whether its zeroes.

Change the return value to 0, since an int64_t will wrap around
for large reads, and there's no value in reporting the length
read when it will always be the length requested clipped to the
size of the image.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
rbd: initialize random number generator for bench-write

Without this, the same seed is used each time, so multiple runs
of bench-write with the same parameters have the same I/O pattern.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
librbd: return -ENOENT from diff_iterate when the snap doesn't exist

This is a bit more helpful than -EINVAL.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
rbd: add formatted output to diff command

All the other commands that display information have this.
For consistency, add it to this command too.

Also switch the plain output to use a TextTable for better readability.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
librados: don't insert zero length extents in a diff

They're useless, and trigger an assert in interval_set::inesrt.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
librbd: add C and python bindings for diff_iterate

The python interface is a bit awkward since it maps directly
to the C interface, but it'll work well enough and not use
tons of memory.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
rbd.py: add some missing functions

discard, flush, and striping info slipped through the cracks before,
but are useful and trivial to add.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
test_librbd: add diff_iterate test including discard

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
PendingReleaseNotes: note about rbd progress output

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
librbd: fix size arg type for diff_iterate

Fixes build on 32-bit archs.

Signed-off-by: Sage Weil <sage@inktank.com>