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
osdc/JournalStream: DRY envelope size calc

Replace repetitive sizeof() calculation for the
envelope overhead per log event with #defines.

Signed-off-by: John Spray <john.spray@inktank.com>
osdc: make JournalStream::readable const

Signed-off-by: John Spray <john.spray@inktank.com>
osdc: Simplify JournalStream::read

It was doing an unnecessary series of splices() after
reading header, replace with a single pass through
the data and one splice at the end.

Signed-off-by: John Spray <john.spray@inktank.com>
osdc: new style encoding for Journal::Header

Switch to the ENCODE_START, DECODE_START macros
for Journal::Header.  As well as being nice generally,
this has the important side effect of making
journal headers written since JOURNAL_FORMAT_RESILIENT
unreadable to older MDSs, as they will fail their check
on Header.magic.

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