erasure-code: ErasureCode base class

Add the ErasureCode base class for ErasureCodeJerasure and
ErasureCodeIsa, for methods that can be shared among all plugins.

http://tracker.ceph.com/issues/8496 Fixes: #8496

Signed-off-by: Loic Dachary <loic@dachary.org>
erasure-code: move to ErasureCode::{encode,decode}{,chunk}

The bulk of ErasureCode{Jerasure,Isa}::encode and
ErasureCode{Jerasure,Isa}::decode is dealing with alignment and buffer
allocation. This is moved to ErasureCode::encode and ErasureCode::decode
respectively.

The jerasure/isa specific code is isolated in the new
ErasureCode{Jerasure,Isa}::encode_chunks and
ErasureCode{Jerasure,Isa}::decode_chunks virtual functions.

http://tracker.ceph.com/issues/8496 Refs: #8496

Signed-off-by: Loic Dachary <loic@dachary.org>
erasure-code: move to ErasureCode::minimum_to_decode*

The ErasureCode{Jerasure,Isa}::minimum_to_decode and
ErasureCode{Jerasure,Isa}::minimum_to_decode_with_cost methods are moved
verbatim to the ErasureCode base class.

http://tracker.ceph.com/issues/8496 Refs: #8496

Signed-off-by: Loic Dachary <loic@dachary.org>
erasure-code: move to ErasureCode::to_{int,bool}

The parameter parser helpers to_int and to_bool are moved from
ErasureCode{Jerasure,Isa} to ErasureCode.

The prototype is modified to return a status instead of the value. An
error ostream is provided as the last argument because ErasureCode
cannot use dout() or derr().

http://tracker.ceph.com/issues/8496 Refs: #8496

Signed-off-by: Loic Dachary <loic@dachary.org>
erasure-code: move to ErasureCode::decode_concat

It does not belong to ErasureCodeInterface which is supposed to not have
any implementation.

Signed-off-by: Loic Dachary <loic@dachary.org>
erasure-code: rework ErasureCode*::parse methods

The ErasureCode::parse virtual function is derived in
ErasureCode{Jerasure,Isa}. It is reworked to share parsing arguments the
various techniques have in common. The logic is otherwise unmodified.

http://tracker.ceph.com/issues/8496 Refs: #8496

Signed-off-by: Loic Dachary <loic@dachary.org>
os/FileStore: dump open fds before asserting

Backport: firefly, dumpling
Signed-off-by: Sage Weil <sage@redhat.com>
Merge pull request #2201 from dachary/wip-8496-erasure-code-base-class

erasure code base class

Reviewed-by: Andreas-Joachim Peters <Andreas.Joachim.Peters@cern.ch>
common/RWLock: track read/write locks via atomics for assertion checks

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
common/RWLock: check return values

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
common/RWLock: add get()

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
common/RWLock: add explicit unlock() to *Lockers

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
common/RWLock: add lock context

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
time: create RWTimer

a timer implementation that uses RWLock

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
client: adapt to new objecter interface

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
mds: adapt to new objecter interface

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
librados: don't hold lock in dispatch()

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
librados: don't hold client lock in certain operations

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
librados: adapt to new objecter interface

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
librados: call objecter->handle_osd_map() under lock

The lock is not shared with the objecter anymore so we need to call
it under this lock, otherwise we're going to race with
wait_for_osdmap().

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>