mds: Add LogEvent::get_type_str()

Signed-off-by: John Spray <john.spray@inktank.com>
common: Add write_stream(ostream) to bufferlist

Enable C++ style file I/O when writing binary output
from bufferlists.

Signed-off-by: John Spray <john.spray@inktank.com>
objecter: Don't warn on multiple admin sockets

Suppress messages about failure to register admin sockets
if they are EEXIST, because this is a case that can occur
naturally if multiple objecter/librados clients are instantiated
within the same process.

Signed-off-by: John Spray <john.spray@inktank.com>
mds: Fix typo 'Sesion'

Signed-off-by: John Spray <john.spray@inktank.com>
osdc: Revise Journaler format

* Separate journal encoding/envelope format
  code (JournalStream) from I/O code (Journaler)
* Add new sentinel and start_ptr fields to
  prefix and suffix of log events.
* Add journal encoding version to journal header

Signed-off-by: John Spray <john.spray@inktank.com>
mds: Add get_paths method to EMetaBlob

Used by cephfs-journal-tool to filter events
by path fragment.

Signed-off-by: John Spray <john.spray@inktank.com>
mds: Add ENoOp for padding journals

This allows us to implement journal splicing
without moving blocks around, and without modifying
the outer journal syntax.

Signed-off-by: John Spray <john.spray@inktank.com>
mds: Add get_metablob to LogEvent

Previously the only way to get at the payload
of things like EUpdate and EOpen was to replay() them
(required a full running MDS) or to use downcasting
(yuck).

Signed-off-by: John Spray <john.spray@inktank.com>
mds: Refactor CINode encoding into CInodeStore

CInode itself combined the on-disk format and
encode/decode logic with lots of other complex
behaviours.  This separates the simple parts
out so that they can be used by other tools that
are interested in looking at inodes outside of
a running MDS.

There is a small overhead because CInodeStore
can't decode a SnapRealm inline, so it keeps
a temporary copy of the encoded bufferlist.

Signed-off-by: John Spray <john.spray@inktank.com>
mds: Publicize some EMetaBlob members

This makes them accessible for JournalTool.

Signed-off-by: John Spray <john.spray@inktank.com>
mds: Add EMetaBlob::get_inodes

Used for filtering in journal tool

Signed-off-by: John Spray <john.spray@inktank.com>
mds: Fix Dumper::undump (missing lock)

Two problems were causing undump to fail:
* Objecter lock was not being taken around call to
  .write() and .write_full() calls, causing assertion.
* Once that is fixed, it is necessary to use a separate,
  local lock to protect the completion condition for
  write operations

Signed-off-by: John Spray <john.spray@inktank.com>
mds: Add LogEvent::str_to_type

For cephfs-journal-tool to resolve user input to a EVENT_* constant

Signed-off-by: John Spray <john.spray@inktank.com>
mds: switch __u32 with LogEvent::EventType typedef

Signed-off-by: John Spray <john.spray@inktank.com>
mds: Add EMetaBlob::get_dentries

For tools that would like to know which dentries are
touched by a metablob, without understanding its
internal format.

Signed-off-by: John Spray <john.spray@inktank.com>
mds: Add getter for EMetablob.client_name

Signed-off-by: John Spray <john.spray@inktank.com>
mds: add getter for ESession.client_inst

Signed-off-by: John Spray <john.spray@inktank.com>
tools: Create cephfs-journal-tool

This is for debugging/repairing CephFS journals.

Signed-off-by: John Spray <john.spray@inktank.com>
rpm: add cephfs-journal-tool to RPM build

Signed-off-by: John Spray <john.spray@inktank.com>
debian: add cephfs-journal-tool to ceph-mds

Signed-off-by: John Spray <john.spray@inktank.com>