crush: invalidate rmap on create (and thus decode)

If we have an existing CrushWrapper object and decode from a bufferlist,
reset build_rmaps so that they get rebuilt.

Remove the build_rmaps() all in decode that was useless on a redecode
(because have_rmaps == true in that case and it did nothing).

Fixes: #6442
Backport: dumpling, maybe cuttlefish
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
Merge remote-tracking branch 'gh/next'

Conflicts:
	PendingReleaseNotes
Merge pull request #673 from liewegas/wip-usage

make rbd, rados bad command errors more friendly
osd/osd_types: add object_info_t::FLAG_DIRTY

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

Stop adding these ad-hoc to the operator<<.

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: mark objects dirty in make_writeable()

Signed-off-by: Sage Weil <sage@inktank.com>
doc: Incorporated some feedback.

Signed-off-by: John Wilkins <john.wilkins@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>
osdc/Objecter: fix return value for copy_get

We should return the return code even when we don't have an encoding error!

Signed-off-by: Sage Weil <sage@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>
osd: add ISDIRTY, UNDIRTY rados operations

ISDIRTY will query whether the dirty flag is set on an object.  UNDIRTY
will explicitly clear it.  Note that a user doing so will likely run amok
with the caching code.

Signed-off-by: Sage Weil <sage@inktank.com>
Merge pull request #675 from ceph/wip-osd-dirty

osd: add a dirty flag for objects.

Reviewed-by: Samuel Just <sam.just@inktank.com>
osd: remove magical tmap -> omap conversion

This is incomplete and unfortunately unusable in its current state:

 - it would only set USES_TMAP for old encoded object_info_t and tmapput,
   but would NOT set it for tmapup
 - a config option turned that off by default.

That means that the mds conversion from tmap -> omap won't be able to use
this because any existing cluster has tmap objects without the USES_TMAP
flag set.  And we don't want to unconditionally try a tmap->omap conversion
on omap operations because there are lots of existing librados users out
there that will be negatively impacted by this.

Instead, the MDS will need to handle this conversion on the client side by
reading either tmap or omap objects and explicitly rewriting the content
with omap (while truncating the tmap data away).

The auto-conversion function was added in v0.44.

Signed-off-by: Sage Weil <sage@inktank.com>
rados: make 'tmap dump' gracefully handle non-tmap data

Signed-off-by: Sage Weil <sage@inktank.com>
rados: add 'tmap-to-omap' command

Explicitly convert tmap object data to omap keys.  Removes the old tmap
content at the same time.

Signed-off-by: Sage Weil <sage@inktank.com>
test: test_store_tool: add 'crc <prefix> <key>' command

Returns the CRC of contents for a given key with a given prefix.

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>