librbd: reimplement striping

This replaces most of the existing striping code with use of the Filer
striping helper methods and a more general ceph_file_layout that can
handle more sophisticated striping patterns that the previous uniform
object approach.

This patch is not fully complete; there are a few additional patches that
follow that clean up some of the support functions.  However, most of the
IO path is covered here.

Signed-off-by: Sage Weil <sage@inktank.com>
librbd/ImageCtx: accessors

Signed-off-by: Sage Weil <sage@inktank.com>
librbd: make read_iterate iterate over periods

Object sizes no longer make sense since we are iterating over the logical
device image space, and the striping may make that unrelated to the size
of the individual objects.

Signed-off-by: Sage Weil <sage@inktank.com>
librbd: generate format_string in ImageCtx

Prebuild the format string on image load so that it is handy at all times.

Signed-off-by: Sage Weil <sage@inktank.com>
librbd: make trim_image() behave with new world striping order

Signed-off-by: Sage Weil <sage@inktank.com>
librbd: make rollback use new striping accessors

Signed-off-by: Sage Weil <sage@inktank.com>
librbd: write sync read over an extent list

Signed-off-by: Sage Weil <sage@inktank.com>
librbd: reimplement flatten in terms of child objects

Iterate over child *objects*, and map each one to the parent extents it
represents.

Signed-off-by: Sage Weil <sage@inktank.com>
librbd: kill legacy striping helpers

These are replaced by ImageCtx accessors or the use of the Filer striping
helper.

Signed-off-by: Sage Weil <sage@inktank.com>
rbd: implement bench-write command (INCOMPLETE)

TODO: fix up man page, clean up command line args

Signed-off-by: Sage Weil <sage@inktank.com>
librbd: kill unused get_block_osd()

Replaced by ImageCtx::get_object_name().

Signed-off-by: Sage Weil <sage@inktank.com>
librbd: make read methods target buffers or bufferlists

This will let us transition much of the read code to move bufferlists
around instead of copying data between buffers.

Signed-off-by: Sage Weil <sage@inktank.com>
librbd: use bufferlist target for read_iterate()

Save ourselves a copy for read_iterate.

Signed-off-by: Sage Weil <sage@inktank.com>
librbd: read_from_parent into a bufferlist

This avoids a copy.

Signed-off-by: Sage Weil <sage@inktank.com>
librbd: avoid read copy for c++ api read

Read directly into the user's bufferlist instead of copying the buffer
contents.

NOTE: this potentially exposes cached buffers to C++ API users.  Document
this!

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

Signed-off-by: Sage Weil <sage@inktank.com>
filer: add debug printability for striped read result stuff

Signed-off-by: Sage Weil <sage@inktank.com>
librbd: allow striping to be specified for clones

Signed-off-by: Sage Weil <sage@inktank.com>
test_librbd_fsx: randomly vary striping on clone

This exercises the io paths that read from the parent for client reads and
for cloning.

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

Fix advancement of bl_off, and handling of case where bl has no more bytes
to consume.

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