strings: add 'list-watchers' to MOSDOp strings

Signed-off-by: Sage Weil <sage@inktank.com>
osd: make LIST_WATCHERS and LIST_SNAPS print nicely for OSDOp

Signed-off-by: Sage Weil <sage@inktank.com>
osd: include SnapSet seq in the list snaps response

It is important to know the latest seq that the object has seen in order
to tell if a response like

 clone 2 snaps=[1,2]
 clone head snaps=[]

was untouched before a hypothetical snap 3, or deleted prior to snap 3,
and then recreated+modified after.

Signed-off-by: Sage Weil <sage@inktank.com>
osd: clean up some whitespace

Signed-off-by: Sage Weil <sage@inktank.com>
osd: do not include snaps with head on list_snaps()

If there is a sequence of snaps 1, 2, 3, 4, 5, and we have a clone
2 with [1,2], and the head reflects content at snap times [3,4,5], then
the snap_list should return

 clone 2 snaps [1,2]
 head snaps
 seq 2

because it never saw a write after snap 2, and therefor has the same
content currently as it did in snaps 3,4,5.  If the SnapSet on the
object lists snaps 3,4,5, and the head exists, it actually means the
object was deleted between 2 and 3, and was recreated after 5:

 clone 2 snaps [1,2]
 head snaps []
 seq 5

The key to telling the two situations apart is the seq number on the
SnapSet (now included in the list_snaps reply) that tells us when the
last update was.

Signed-off-by: Sage Weil <sage@inktank.com>
osd: direct reads on SNAPDIR to either head or snapdir

The list_snaps operation needs to look at the SnapSet, and is logically
querying all revisions of the object.  Make requests to SNAPDIR be
read-only, and grab the head or snapdir obc transparently (whichever one
exists).  This allows us to list snaps when, say, the head does not
exist, but there are in fact snaps.

Signed-off-by: Sage Weil <sage@inktank.com>
osd: wait for all clones on SNAPDIR requests

Wait for all clones to be present.

Signed-off-by: Sage Weil <sage@inktank.com>
osd: fix clone snap list for list-snaps

We need to return the list of snaps that each clone is defined for, not
the list of snaps we know may or may not exist globally over a similar
interval.  This requires looking at the clone's obc, unfortunately.

Signed-off-by: Sage Weil <sage@inktank.com>
osd: fix error codes for list-snaps

Signed-off-by: Sage Weil <sage@inktank.com>
osdc/Objecter: prval optional for listsnaps

Signed-off-by: Sage Weil <sage@inktank.com>
librados: expose snapset seq via list_snaps

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

Implement a diff_iterate() method that will iterate over an image and
report which extents vary between two snapshots (or a snapshot and the
head).  The callback gets an extent and a flag indicating whether it is
full of data or is known to be zero in the ending snapshot.

Signed-off-by: Sage Weil <sage@inktank.com>
rbd: add --io-pattern <seq|rand> option to bench-write

Write to random offsets instead of sequentially.

Signed-off-by: Sage Weil <sage@inktank.com>
rbd: implement 'export-diff' and 'import-diff' commands

Export a diff of an image from a previous snapshot to a file (or stdout).

Import a diff and apply it to an image, and then create the ending
snapshot.

Signed-off-by: Sage Weil <sage@inktank.com>
qa: add rbd/diff_continuous.sh stress test

Stress test that does io on an image while we are mirroring a diff from
earlier snaps to a second copy.  At the end, verify that all snaps have
matching content.

Signed-off-by: Sage Weil <sage@inktank.com>
rbd: send import debug noise to dout, not stdout

Signed-off-by: Sage Weil <sage@inktank.com>
librbd: handle diff from clone

If we have a parent image, and the reference is from snap 0 (beginning of
time) we need to look at the diff on the parent from the beginning of time
and report that when we get an ENOENT.

Signed-off-by: Sage Weil <sage@inktank.com>
rbd: implement simple 'diff' command

Report extents allocated/changed, and whether they contain data or zeros.

Signed-off-by: Sage Weil <sage@inktank.com>
qa: rbd/diff_continuous.sh: base test off a clone

Get a bit of coverage on clones by starting with a clone.

Signed-off-by: Sage Weil <sage@inktank.com>
librbd: fix diff_iterate arithmetic for non-standard striping

This code is confusing because we are moving back and forth between
image offsets, "buffer" offsets (image offsets relative to off), and
object offsets.  Fix the math.

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