crushtool: Miscellaneous cleanup.

Clean up the output messages; add some function documentation and some
unit tests.

Signed-off-by: caleb miles <caleb.miles@inktank.com>
PG: do not update stats in ReplicaActive from info

Bug #2954

Consider the following case:

1) Primary calls share_pg_info()
2) Primary processes client op and sends off sub_op to replica
3) Replica process sub_op
4) Replica process info reverting stat to before 2)

Similarly:

1) Primary processes client op
2) Primary calls share_pg_info()
3) Replica processes info
[4) Replica processes sub_op]

If 4) is interrupted by a map change, we can end up in a case there
the replica's info has a stat which reflects a log entry which
is not there.  If that logs ends up authoratative, the most recent
op will be replayed and end up double counted in the log.

There should actually be no cases where the stats change after the
replica goes active except for as part of a sub_op_modify.  Thus,
ReplicaActive::MInfoRec should not update the stats.

Signed-off-by: Samuel Just <sam.just@inktank.com>
osdmap: add NOBACKFILL flag

This will tell the OSDs to please not initiate any backfill operations.

Signed-off-by: Sage Weil <sage@inktank.com>
osdmap: add NORECOVER flag

This will stop recovery via log catch-up and via backfill both.

Signed-off-by: Sage Weil <sage@inktank.com>
osd: pause/unpause recovery based on NORECOVER osdmap flag

Signed-off-by: Sage Weil <sage@inktank.com>
Fix rados put from '-' (stdin)

Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Mike Ryan <mike.ryan@inktank.com>
Reviewed-by: Greg Farnum <gregory.farnum@inktank.com>
Fixes: #3068
Clarify CodingStyle with respect to tab compression of space runs
Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Greg Farnum <gregory.farnum@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
osd: defer backfill with NOBACKFILL osdmap flag is set

If we encounter nobackfill, let ourselves to fall out of the recovery
queue.  If we encounter a map that has does not have the flag set and we
are not clean, requeue ourselves.  This is a big hammer, but simple.

Signed-off-by: Sage Weil <sage@inktank.com>
Merge branch 'wip-osd-flags'

Reviewed-by: Samuel Just <sam.just@inktank.com>
java: add Java and C++ source files

This adds all of the Java and C++ source files that make up the
libcephfs Java wrappers package.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
automake: setup autotools to build cephfs-java

Adds --enable-cephfs-java and --with-jdk to build
the libcephfs Java bindings and specify the default
JDK directory, respectively.

Also adds default JDK paths to avoid --with-jdk in
the common case. Currently setup for the default
provided by Debian's default-jdk package, but other
default search paths can easily be added.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
debian: add libcephfs-java package

Creates libceph1-java package that contains
the libcephfs Java wrappers .jar file and the
JNI library.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
do_autogen.sh: add -j flag to enable java stuff

Signed-off-by: Sage Weil <sage@newdream.net>
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Makefile: add src/include to #include path for libcephfs_jni_la

Signed-off-by: Sage Weil <sage@newdream.net>
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
java: remove redundant dir ops
java: note set_default_file_replication is noop
java: remove CephDirectory in favor of listdir()

This replaces the CephDirectory interface to listing directory contents
with a simple listdir(path) interface. Using CephDirectory, while it
respected the 1-to-1-ness goal for libcephfs API, was overly complicated
for the vast majority of use cases where a user only wants the directory
contents.
libcephfs: return error when not mounted

Return an error rather than a segfault if a client uses the interface
when unmounted.
java: remove CephProxy, check errors at low-level

This removes the overly complicated CephProxy utility which managed the
state machine to avoid segfaults. The segfaults that did occur are
better handled at the library level.
java: remove CephStruct

CephStruct was originally added because there was common tasks done by
any class managing a low-level C object (state machine, ptr, etc...).
Turns out there aren't that many instances of these objects, and
CephStruct just make it more complicated than it needed to be.