librados: add cache_flush(), cache_try_flus(), cache_evict() methods

Not yet implemented by the OSD.

Signed-off-by: Sage Weil <sage@inktank.com>
librados, osd: add IGNORE_OVERLAY flag

Add a flag that will make the OSD bypass the cache overlay logic.  This is
needed in order to handle operations like CACHE_EVICT and CACHE_FLUSH.

Signed-off-by: Sage Weil <sage@inktank.com>
osd/osd_types: introduce helper for osd op flags -> string conversion

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

Conflicts:

	src/osd/osd_types.h
librados: add an aio_operate that takes a write and flags

Until now you could only pass flags to read operations.

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: implement cache_evict

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

If an op starts with DELETE there is no need to promote the old content
from the base tier.  Note that this only works if the FAILOK flag is
set.  Otherwise, we need to know whether the object existed or not to
return either 0 or -ENOENT.

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplcatedPG: maybe_handle_cache style

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: allow osds to issue writes to osds

We asserted that the client was not an OSD years ago when we separated out
the client and cluster networks.  Now, we are about to allow an OSD to
trigger a copy_from on another pool (for cache flush) and the assert can
go away.  We've long since verified that the messages are going out on
the correct interfaces.

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: drop unnecessary temp vars in execute_ctx()

Both of these are pulled out of ctx->obs, which is not updated until the
very end; use that instead!

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: be consistent about ctx->obs vs ctx->obc->obs

Just for consistency (ctx->obs =- &ctx->obc->obs).

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

Conflicts:

	src/osd/ReplicatedPG.cc
osd/ReplicatedPG: add SKIPRWLOCKS flag

Flush puts us in an conundrum:

 - the flush eventually writes, behaving like a write
 - writes take the write lock at the start
 - to flush, we send copy-from to the base pool, which does a copy-get on
   our object
 - the copy-get is a read, that blocks on the write.

This flag will allow an op to skip the initial locking step.  It will need
to take it later, of course.

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

Conflicts:

	src/osd/ReplicatedPG.cc
osd/ReplicatedPG: split off finish_ctx from execute_ctx

The second part of execute_ctx() is doing some somewhat generic work to
make the prepared updates in the ctx apply, updating the obc's cached
values.  Factor it out.

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: use get_next_version() in finish_promote

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: use finish_ctx for finish_promote

Use the common code here to avoid duplicating this logic.

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: set ctx->obc in simple_repop_create

Strangely nobody hss needed this yet, but we will shortly.

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: more verbose heading for process_copy_chunk

Signed-off-by: Sage Weil <sage@inktank.com>
osd/osd_types: operator<< for ObjectContext::RWState

Signed-off-by: Sage Weil <sage@inktank.com>
osd: rename IGNORE_OVERLAY -> IGNORE_CACHE

This is about skipping cache logic, not the tier pool overlay property.

Signed-off-by: Sage Weil <sage@inktank.com>
osdc/Objecter: add CEPH_OSD_FLAG_IGNORE_OVERLAY flag

If the flag is set, send the op to the pool specified and ignore the
overlay.  Note that this obsoletes the global Objecter flag.

It also makes these EINVAL correctly:

  rados -p base cache-flush
  rados -p base cache-evict

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: use IGNORE_OVERLAY flag for copy-from

No need to use the Objecter-wide setting now.

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