os/FileStore: using FIEMAP_FLAGS_SYNC instead of fsync() before call
fiemap.

When call fiemap, it need sync the file. Now it used fsync() to achieve
this. But for fiemap, there is a flag FIEMAP_FLAGS_SYNC which do the
same thing like fsync().

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
Fix read performance regression in ObjectCacher

The regression was introduced in commit
4fc9fffc494abedac0a9b1ce44706343f18466f1.  The problem is that the cache
thinks it's full (when it's not), so it defers the read.  This change
frees up cache space if necessary and only defers the read if enough
space cannot be freed.

Fixes: 9513
Signed-off-by: Adam Crume <adamcrume@gmail.com>
test,tools: capture boost::program_options in a try

When something fails boost::program_options throws an exception that
needs to be caught.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
test: catch boost::program_options errors

And display it before returning on error.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
tools: display boost::program_options errors

Instead of silently discarding them. Do not display the usage on error
as it will probably hide the error message that shows before it.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
tools: move po::collect_unrecognized in the try block

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
tools: allow_unregistered() options

So that --debug-mon etc. can be parsed afterwards.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
test,tools: indentation, whitespace only

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
perfglue: profiler stats need more than 1024 bytes

With a 1024 bytes buffer to display the stats, the end is truncated.
Use an array on the stack instead of leaking the buffer.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
mon,mds: call ceph_heap_profiler_init() at boot time

So that the CEPH_HEAP_PROFILER_INIT environment variable can be used to
start profiling.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
doc: update memory-profiling with examples

* Update the ceph tell from ceph daemon tell id to the new
  ceph tell deamon.id form

* Add usages examples for easier copy / paste

* Add MON to the list of daemons that can be profiled

* Document CEPH_HEAP_PROFILER_INIT=true

* Remove trailing empty lines

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
Makefile.am: make sure everything was build before make check

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
mount.ceph.c: ensure '\0' terminated string

Reserve last char in array for '\0' to ensure termination
of the string.

Fix for:

CID 1128383 (#1 of 1): Buffer not null terminated (BUFFER_SIZE_WARNING)
 buffer_size_warning: Calling strncpy with a maximum size argument
 of 1000 bytes on destination array secret of size 1000 bytes might
 leave the destination string unterminated.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
osd/OSDMap.cc: prefer ++operator for non-primitive iterators

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
osd/ReplicatedBackend.cc: prefer ++operator for non-primitive iterators

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
mds/flock.cc: reduce scope of some variables

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
SyntheticClient.cc: reduce scope of variables

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
ErasureCodeIsa.cc: reduce scope of variables

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
test/librbd/fsx.c: fix potential unterminated string handling

In case of strncpy() make sure string is '\0' terminated. Before
usage of strcat() check if the destination has enough free space
to concat the char and to terminate the string to prevent illegal
memory access.

Fix for:

CID 1219459 (2 of 2): Buffer not null terminated (BUFFER_SIZE_WARNING)
 buffer_size_warning: Calling strncpy with a maximum size argument of
 1024 bytes on destination array goodfile of size 1024 bytes might
 leave the destination string unterminated.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
rados_list_parallel.cc: cleanup before return from run()

Fix for another case of:

CID 717112 (#1 of 1): Resource leak (RESOURCE_LEAK)
 leaked_storage: Variable io_ctx going out of scope leaks
 the storage it points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>