erasure-code: preload the isa plugin by default

But only do so when it has been compiled because a recent enough yasm
has been found.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
erasure-code: add directory to plugin init functions

The prototype of the init functions of erasure coded plugins is changed
from

   int __erasure_code_init(char *plugin_name)

to

   int __erasure_code_init(char *plugin_name, char *directory)

The jerasure plugin will find optimized variants in this directory and
load them. The load() and preload() functions of
ErasureCodePluginRegistry only use a directory instead of a more generic
parameters map. The parameters map was only used for the directory entry
anyway.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
erasure-code: remove unused errno.h include

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
erasure-code: add Red Hat to copyright notices

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
erasure-code: jerasure preloads the plugin variant

The variant selection depending on the available CPU features is
encapsulated in a helper. The helper is used in the factory() method and
in the load() method.

The factory() method may load a variant that is not the default, for
benchmark purposes. Such a variant is not preloaded by the load() method
and upgrading while running may be problematic. However, running with a
non standard variant is used for benchmarking and upgrades in this
context are not a concern.

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

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
erasure-code: wrap lines for emacs compile command

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
erasure-code: implement ErasureCodePluginRegistry::remove

Which is symmetric to the add method and used for test.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
erasure-code: add Ceph version check to plugins

Add the __erasure_code_version function to all plugins, to return the
Ceph version against which they have been compiled. When a plugin is
loaded, an error is thrown if the version of the plugin does not match
the version of the daemon loading it.

If the symbol does not exist, which will be true of older plugins, set
the version to "an older version" so it never matches.

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

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
erasure-code: assert the PluginRegistry lock is held when it must

Add lock to the preload method and assert that it is held by methods
requiring it. Although preload is called at bootstrap and does not
require the lock, adding it does not hurt and makes the lock policy
clearer to understand.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
Merge pull request #2299 from dachary/wip-jerasure-upgrade

erasure-code: jerasure upgrade

Reviewed-by: Sage Weil <sage@redhat.com>