atomic_t: add atomic64_t

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
common/perf_counters: use atomics instead of a mutex

The mutex is way too expensive.

Signed-off-by: Sage Weil <sage@inktank.com>
mon: remember osd weight when auto-marking osds out

If we automatically mark an OSD out, remember its OSD weight.

Signed-off-by: Sage Weil <sage@inktank.com>
mon: restore previous weight when auto-marked out osd boots

When an OSD that was marked out boots, restore the weight it had before.

Signed-off-by: Sage Weil <sage@inktank.com>
common/perf_counters: use second atomic to make counters safe to read

Add a second counter so that we can detect a race with an add/inc during
read, and retry.

Signed-off-by: Sage Weil <sage@inktank.com>
Add header cache to DBObjectMap

OMap is used by PG to store PGLog, so it's called by each write operations.
Because leveldb don't play well in random read and "header_lock" limit the
concurrence. Add a LRU cache to avoid too much overload on seeking header.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
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>