Danny Al-Gaaf [Wed, 13 Feb 2013 17:53:20 +0000 (18:53 +0100)]
scratchtoolpp.cc: print some more results
Print some more results to fix issue found by cppcheck:
[src/scratchtoolpp.cc:111] -> [src/scratchtoolpp.cc:114]:
(performance) Variable 'r' is reassigned a value before
the old one has been used.
[src/scratchtoolpp.cc:207] -> [src/scratchtoolpp.cc:208]:
(performance) Variable 'r' is reassigned a value before
the old one has been used.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 17:42:47 +0000 (18:42 +0100)]
rgw/rgw_rest_swift.cc: don't pass c_str() result to std::string argument
Fix issue found by cppcheck:
[src/rgw/rgw_rest_swift.cc:770]: (performance) Passing the result of
c_str() to a function that takes std::string as argument no. 1 is
slow and redundant.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 17:06:41 +0000 (18:06 +0100)]
mds/MDSMap.cc: use !empty() instead of size() to check for emptiness
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 16:59:09 +0000 (17:59 +0100)]
mds/MDS.cc: use !empty() instead of size() to check for emptiness
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 16:57:54 +0000 (17:57 +0100)]
mds/MDCache.cc: use empty() instead of size() to check for emptiness
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 16:56:12 +0000 (17:56 +0100)]
mds/Locker.cc: use !empty() instead of size()
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 16:53:41 +0000 (17:53 +0100)]
mds/CInode.cc: use !empty() instead of size()
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 16:50:32 +0000 (17:50 +0100)]
mds/CDir.cc: use !empty() instead of size()
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 16:48:48 +0000 (17:48 +0100)]
librbd/internal.cc: use !empty() instead of size()
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 16:41:55 +0000 (17:41 +0100)]
kv_flat_btree_async.cc: use empty() instead of size() to check for emptiness
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 16:38:56 +0000 (17:38 +0100)]
cls_kvs.cc: use !empty() instead of 'size() > 0' to check for emptiness
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 16:33:12 +0000 (17:33 +0100)]
crushtool.cc: use !empty() instead of 'size() > 0' to check for emptiness
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 16:30:54 +0000 (17:30 +0100)]
crush/CrushWrapper.cc: don't pass c_str() result to std::string argument
Fix issue found by cppcheck:
[src/crush/CrushWrapper.cc:352]: (performance) Passing the result of
c_str() to a function that takes std::string as argument no. 4 is
slow and redundant.
[src/crush/CrushWrapper.cc:388]: (performance) Passing the result of
c_str() to a function that takes std::string as argument no. 4 is
slow and redundant.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 16:22:41 +0000 (17:22 +0100)]
obj_bencher.cc: use empty() instead of 'size() == 0' to check for emptiness
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 15:57:29 +0000 (16:57 +0100)]
common/WorkQueue.cc: use !empty() instead of size() to check for emptiness
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 15:53:59 +0000 (16:53 +0100)]
cls_refcount.cc: use empty() instead of !size() to check for emptiness
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 15:49:53 +0000 (16:49 +0100)]
cls/rbd/cls_rbd.cc: use !empty() instead of 'size() > 0'
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 14:57:45 +0000 (15:57 +0100)]
rgw/rgw_gc.cc: use !empty() instead of size() to check for emptiness
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 14:45:27 +0000 (15:45 +0100)]
rgw/rgw_admin.cc: use empty() instead of size() to check for emptiness
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 14:42:58 +0000 (15:42 +0100)]
rgw/rgw_admin.cc: prevent useless value assignment
Fix issue found by cppcheck:
[src/rgw/rgw_admin.cc:710] -> [src/rgw/rgw_admin.cc:714]:
(performance) Variable 'ret' is reassigned a value before
the old one has been used.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Deal with this by moving the declaration to where we define
the value for a couple variables.
Danny Al-Gaaf [Wed, 13 Feb 2013 14:38:58 +0000 (15:38 +0100)]
rbd.cc: use empty() instead of size() to check for emptiness
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 14:36:29 +0000 (15:36 +0100)]
rados.cc: use omap.empty() instead of size() to check for emptiness
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 14:34:05 +0000 (15:34 +0100)]
osdmaptool.cc: : use empty() instead of 'size() < 1'
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
This way the code is more logical.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 14:30:19 +0000 (15:30 +0100)]
Objecter.cc: prevent useless value assignment
Fix issue found by cppcheck:
[src/osdc/Objecter.cc:989] -> [src/osdc/Objecter.cc:992]: (performance)
Variable 'check_for_latest_map' is reassigned a value before the old
one has been used.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix it by declaring at the first real definition.
Danny Al-Gaaf [Thu, 14 Feb 2013 13:36:37 +0000 (14:36 +0100)]
init-ceph.in: replace "/var/run/" by already used $RUN_DIR
Fix handling of admin socket. The current script already use
$RUN_DIR to define a default, which is /var/run. Replace the
explicit path from get_conf call and replace it with $RUN_DIR.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Travis Rhoden [Thu, 14 Feb 2013 16:23:52 +0000 (11:23 -0500)]
doc: Update create example to use 'allow ' syntax
The ceph auth get-or-create example here is the only place on the
page that does not use 'allow <perms.' syntax. I found that
confusing. Update to use allow and single quotes.
Danny Al-Gaaf [Thu, 14 Feb 2013 14:11:18 +0000 (15:11 +0100)]
ceph.spec.in: cleanup requirements of fuse packages
Cleanup the Requires: list of the fuse packages. Remove fuse-libs,
libstdc++, libuuid. Don't add libraries to the list, the RPM build
system will find the dependencies by itself.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
James Page [Thu, 14 Feb 2013 13:10:39 +0000 (13:10 +0000)]
LDADD PTHREAD_LIBS to fix librados-config linking
librados-config depends on libglobal which in turn
reference symbols in pthread; this caused issues
when linking due to the indirect dependency via
libglobal.
Loic Dachary [Thu, 14 Feb 2013 11:05:54 +0000 (12:05 +0100)]
fix buffer::list::zero(unsigned o, unsigned l) to act on all buffer::ptr
When buffer::list::zero was called on a buffer::list with "ABC" and
"DEF" in two different buffer::ptr with buffer::list::zero(4, 1) it
did nothing. The expected result is that the "DEF" buffer::ptr is
modified to "D\0F"
The test to check if the pointer is past the end of range to be zeroed
was reversed. It was o+l >= p which would always be true if the range
spans over the first buffer::ptr . It must be "o+l <= p" meaning the
pointer is past the end of the range and there is no need to loop over
the remaining buffer::ptr in the buffer::list
The p+it->length() >= o+l part of the if (p >= o && p+it->length() >=
o+l) test was also reversed. When called on "ABC" with zero(0, 1) it
would match because the range to be zeroed is contained in the
buffer::ptr. The call to it->zero() would zero the entire buffer::ptr
instead of just the first character.
unit tests are added to demonstrate the two problems with the previous
code and show that the patch fixes them.
Sam Lang [Wed, 13 Feb 2013 18:37:32 +0000 (12:37 -0600)]
libcephfs: Fix shutdown segfault
client->shutdown() should only be called once, but with
new inited flag, we were calling it twice. This sets
the inited flag back to false after client->shutdown()
is called the first time.
Sage Weil [Sun, 27 Jan 2013 03:08:22 +0000 (19:08 -0800)]
ceph-disk-prepare: refactor to support DIR, DISK, or PARTITION for data or journal
Lots of code reorganization collapsed into a single commit here.
- detect whether the user gave us a directory, disk, or partition, and Do The
Right Thing
- allow them to force that the input was of type X, for the careful/paranoid.
- make --zap-disk an option -- no longer the default
Danny Al-Gaaf [Wed, 13 Feb 2013 14:29:03 +0000 (15:29 +0100)]
Objecter.cc: use !empty() instead of size() to check for emptiness
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 14:24:37 +0000 (15:24 +0100)]
ObjectCacher.cc: use empty() instead of !size() to check for emptiness
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 14:21:48 +0000 (15:21 +0100)]
ReplicatedPG.cc: use empty() instead of size() to check for emptiness
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
This replaces also some size() >=/== checks.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 14:18:55 +0000 (15:18 +0100)]
PG.cc: use empty() instead of size() to check for emptiness
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
This replaces also some size() >=/== checks.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 13 Feb 2013 14:03:31 +0000 (15:03 +0100)]
OSD.cc: use empty() instead of size() to check for emptiness
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
This replaces also some size() >=/== checks.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>