librados, osd: add flags to COPY_FROM

If we initiate a COPY_FROM as part of a FLUSH operation, we will need to
set a flag so that the read-side of the copy and join the existing
in-progress operation without taknig additional locks.

Similarly, we need to pass flags from the client indicating whether we
should ignore overlay or cache logic while performing the copy.  These are
used by the promote and flush logic.

Note that none of these flags are exposed through librados (at least not
at this time).

Signed-off-by: Sage Weil <sage@inktank.com>
osd: make obc copyfrom blocking generic

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: implement cache-flush, cache-try-flush

Implement a rados operation that will flush a dirty object in the cache
tier by writing it back to the base tier.

Signed-off-by: Sage Weil <sage@inktank.com>
rados: add cache-flush, cache-evict, cache-flush-evict-all commands

Signed-off-by: Sage Weil <sage@inktank.com>
qa/workunits/rados: test cache-{flush,evict,flush-evict-all}

Signed-off-by: Sage Weil <sage@inktank.com>
qa/workunits/rados: rename cache pool tests

Signed-off-by: Sage Weil <sage@inktank.com>
qa/workunits/rados/test_cache_pool.sh: fixes

Signed-off-by: Sage Weil <sage@inktank.com>
vstart.sh: --cache <pool> to set up pool cache(s) on startup

Signed-off-by: Sage Weil <sage@inktank.com>
osd/osd_types: include user_version in operator<< object_info_t

Signed-off-by: Sage Weil <sage@inktank.com>
osd/osd_types: make object_info_t::dump() dump user_version

Backport: emperor
Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: uninline CopyFromCallback, PromoteCallback

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: handle ECANCELED in C_CopyFrom, C_Flush

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: fix user_version preservation for copy_from

In the process of fixing this for flush, we break promote, so we need to
adjust them both here.  Basic strategy: do not set user_modify, but handle
the user_version explicitly in the callbacks.

For copy_from, we don't have a clean way to pass the result through to
finish_copyfrom in do_osd_ops; do so by putting it in user_at_version. (If
we were to call finish_copyfrom directly from the callback this might
be simpler, but let's not go there right now.)

For promote, it is a trivial fix.

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: fix locking for promote

After we get the copy-from data and unblock the obc, we still need to take
the RWWRITE lock on the object for the duration of the repop while we
actually apply the change locally.

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: debug: add an assert for copy-get

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: debug: clean up oi printout

Signed-off-by: Sage Weil <sage@inktank.com>
osd/osd_types: debug: include size in object_info_t operator<<

Signed-off-by: Sage Weil <sage@inktank.com>
ceph_test_rados: test cache_flush, cache_try_flush, cache_evict

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: EBUSY on cache-evict when watchers are present

Linger operations will follow the object to the cache pool when the pool
overlay process is set.  If we evict the object, the object_info_t will
go away along with the watch state and confusing things will happen.
Prevent that from happening by returning EBUSY when you try to evict a
watched object.

Note that you *can* flush a watched object, and the dirty flag will be
cleared.  But you still can't evict it.

Signed-off-by: Sage Weil <sage@inktank.com>
osd/osd_types: include num_objects_dirty, num_whiteouts in object_stat_sum_t

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