ReplicatedPG: add a Context *ondone to RepGathers

Make a few changes to make sure we trigger it when appropriate. We'll use
this shortly for object promotion, and perhaps for other things in future.

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: copy: add a C_KickBlockedObject

As the name says, you give it an obc and it kicks the block list
when finish()ed.

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: cache: don't handle cache if the obc is blocked

Right now the only way that can happen is if we're in the middle of a
promote!

Signed-off-by: Greg Farnum <greg@inktank.com>
osd: Add a new object_copy_data_t, and use it in the OSD/Objecter

Right now this is very primitive, but we're about to extend it to
deal with request versioning appropriately, and adding in some
extra fields.
Sadly we are doing a little extra copying in the Objecter as a result, but
too bad -- being able to do updates will be worth it.

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: copy: move the COPY_GET implementation into its own function

It was getting long, isn't terribly dependent on access to do_osd_ops()
state, and will be easier to make generic as its own function.

Signed-off-by: Greg Farnum <greg@inktank.com>
OSD: rename CEPH_OSD_OP_COPY_GET -> CEPH_OSD_OP_COPY_GET_CLASSIC

In order to introduce versioning of copy-get, we need to make it a
different op that has the versioning infrastructure from the start.

Signed-off-by: Greg Farnum <greg@inktank.com>
OSD: add back CEPH_OSD_OP_COPY_GET, and use it in the Objecter

This one is encoded with version information. We are not doing anything
to control which op gets sent by the client, but after discussion with
Sam we think this op isn't accessible enough to clients (right now it's
only triggered by a client sending copy-from, which can only happen via
ceph-test-rados) to require compatibility versioning.

Signed-off-by: Greg Farnum <greg@inktank.com>
osd: add category to object_copy_data_t

We don't bump the encoding version -- and stick it in the middle --
since it's still brand-new. For simplicity, we encode it unconditionally
rather than trying to embed it alongside the attrs or with its own
"complete" flag in the cursor.

Signed-off-by: Greg Farnum <greg@inktank.com>
Objecter: expose the copy-get()'ed object's category

In the OSD, store the category in the CopyOp using this.

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: copy: switch out the CopyCallback interface

The tuple was already unwieldy with 4 members; I didn't want to add
more. Instead, create a new CopyResults struct which contains all the
object info and completion data, and pass the retval and a CopyResults*
in the CopyCallbackResults tuple.
ReplicatedPG: promote: first draft pass at doing object promotion

This is not yet at all complete -- among other things, it will
retry forever on any object which doesn't exist in the underlying
pool. But it demonstrates the approach reasonably clearly.

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: copy: don't return from finish_copyfrom

The return value is meaningless; nothing in this function can fail.

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: promote: move the promote functionality into finish_promote

This way we can have a couple of functions that handle each type of
case, and let the PromoteCallback choose between them. That's much
better than doing it all inline in the callback.

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: promote: add the OpRequest to the Callback

This way we can do stuff to it, and we're about to.

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: promote: handle failed promotes

If we get an error back, reply to the client directly and remove
the op which triggered promotion from our blocked op queue.

Signed-off-by: Greg Farnum <greg@inktank.com>
workunits: check errors propagate on cache pools in caching_redirects.sh

Signed-off-by: Greg Farnum <greg@inktank.com>
workunits: break down cache pool tests to be more precise; expand some

Signed-off-by: Greg Farnum <greg@inktank.com>
ObjectStore: add a bufferlist-based getattrs() function

Signed-off-by: Greg Farnum <greg@inktank.com>
OSD: object_copy_data_t should take advantage of bufferlist-based getattrs

Now we don't need to do the silly bufferlist-bufferptr non-magic.

Signed-off-by: Greg Farnum <greg@inktank.com>