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>
gitignore: Add cephfs-journal-tool

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

Signed-off-by: John Spray <john.spray@inktank.com>
mds/CDir: remove redundant inode enc/dec

Use the new CInode::encode_bare/decode_bare fns
in CDir, so that we only have one implementation
of the inode encode/decode code.

Signed-off-by: John Spray <john.spray@inktank.com>
osdc: Clean up journalstream readable check

Fix redundant (and subtly incorrect) calculation of
the number of bytes needed.  It worked because waiting
for a few more bytes before reading the entry size
of an old-format entry was harmless.

Signed-off-by: John Spray <john.spray@inktank.com>
osdc: fix redundant branch

Signed-off-by: John Spray <john.spray@inktank.com>
osdc/Journaler: privatize members

Many members were unnecessarily public.

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

This is used in subsequent commits to delete journals
that are no longer needed, such as after rewriting
a journal in a different format.

Signed-off-by: John Spray <john.spray@inktank.com>
mds: add atomic log rewrite on format change

Two main pieces to this:
 * A new JournalPointer object that stores two journal
   inodes so that we can do a double-buffered update,
   followed by an atomic swap.
 * An extended recovery process in MDLog that dereferences
   the JournalPointer and conditionally rewrites the
   journal to accomodate format updates.

The JournalPointer indirection should also be useful for
making cephfs-journal-tool do updates more safely.

Signed-off-by: John Spray <john.spray@inktank.com>
dencoder: add JournalPointer to types.h

Signed-off-by: John Spray <john.spray@inktank.com>
mds: Generalize JournalPointer functionality

...so that we can use it places like Resetter too.  And use it
there.

Signed-off-by: John Spray <john.spray@inktank.com>
tools: update Dumper to use JournalPointer

Signed-off-by: John Spray <john.spray@inktank.com>
mds: Introduce mds_journal_format config setting

This is useful for testing, so that we can create an
old-style journal and then test the version migration
by changing the config setting.

Signed-off-by: John Spray <john.spray@inktank.com>
osdc/Journaler: include stream_format in dump()

Signed-off-by: John Spray <john.spray@inktank.com>
Fix JournalStream::read length assertion

This was checking for new-format length even
when reading from an old-format journal.

Signed-off-by: John Spray <john.spray@inktank.com>
tools/cephfs: Update for JournalPointer

Signed-off-by: John Spray <john.spray@inktank.com>
osdc/Journaler: use pointers for out params

Fixes a style violation in the new JournalStream class.

Signed-off-by: John Spray <john.spray@inktank.com>
doc: Update ceph-mds manpage

Add missing --hot-standby and --journal-check
arguments.

Fixes: #8258