ReplicatedPG: update pg stats correctly when doing a copy

The obs.oi.size needs to updated in the middle so that we actually
change the stats -- this got set backwards by mistake during one
of the refactors to support large objects!
(See 4e29e362e7981634d751ee982144fbf602782a9a)

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: copy: do not use an OpContext in _copy_some

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: copy: remove most references to OpContext from process_copy_chunk

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: follow the same finish path for failed copy ops

We don't necessarily want to respond to clients with a failure if
a copy got an error code. Instead, conditionally execute the success
path and always launch back into execute_ctx() when the copy has
stopped (either due to completion or failure).

Update the COPY_FROM section so it returns the CopyOp::rval (instead
of always zero) and only launches finish_copy() on success.

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: copy: add an ObjectContextRef to CopyOp

Use that instead of the OpContext::obc in copy codepaths.

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: copy: take an ObjectContextRef in start_copy and use that

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: copy: specify the temp_oid in the caller

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: copy: split up the transaction generation from the PG management

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: copy: start defining CopyCallback structures

Outline the basic interfaces we're going to use, and implement
the more obvious ones.

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: copy: add CopyCallback pointer to CopyOp, and set it up

We'll start using it in the next commit; eventually we can use the interfaces
we're putting their to replace our link to the OpContext.

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: copy: implement CopyFromCallback::finish, remove CopyOp::ctx

We implement enough of the CopyFromCallback that CopyOp no longer needs
a direct reference to the OpContext, so we remove it and replace all
references with calls to cop->cb->complete().

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: copy: use CopyCallback instead of CopyOp in OpContext

In order to make this happen, we make the switch to generate the complete
transaction in the generic copy code and save it into the Callback. Then
in finish_copy() we just take that transaction and prepend it to the existing
transaction.
With that change, and by making use of the existing CopyCallback data,
we no longer need to access the CopyOp from the OpContext, so we can remove it.
Hurray, the pipelines are now independent!

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: rename finish_copy -> finish_copyfrom

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: copy: switch CopyCallback to use a GenContext

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: assert that we have succeeded in do_osd_ops on copyfrom repeats

Our callback is handling errors on its own at this point.

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: copy: don't leak a ctx on failed copy ops

Signed-off-by: Greg Farnum <greg@inktank.com>
ReplicatedPG: copy: add op progression output

Signed-off-by: Greg Farnum <greg@inktank.com>
Merge pull request #676 from ceph/wip-start-copy

Reviewed-by: Samuel Just <sam.just@inktank.com>
Merge git://github.com/ceph/ceph