Danny Al-Gaaf [Tue, 12 Feb 2013 17:51:51 +0000 (18:51 +0100)]
cls/lock/cls_lock.cc: use !lockers.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().
warning from cppchecker was:
[src/cls/lock/cls_lock.cc:209]: (performance) Possible inefficient
checking for 'lockers' emptiness.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Tue, 12 Feb 2013 17:48:50 +0000 (18:48 +0100)]
src/client/SyntheticClient.cc: use !subdirs.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().
warning from cppchecker was:
[src/client/SyntheticClient.cc:2706]: (performance) Possible
inefficient checking for 'subdirs' emptiness
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Tue, 12 Feb 2013 17:44:04 +0000 (18:44 +0100)]
client/Client.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().
warning from cppchecker was:
[src/client/Client.cc:3649]: (performance) Possible inefficient
checking for 'mds_sessions' emptiness.
[src/client/Client.cc:7489]: (performance) Possible inefficient
checking for 'osds' emptiness.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Tue, 12 Feb 2013 16:41:04 +0000 (17:41 +0100)]
mds/MDSMap.h: use up.empty() instead of up.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().
warning from cppchecker was:
[src/mds/MDSMap.h:448]: (performance) Possible inefficient
checking for 'up' emptiness.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Tue, 12 Feb 2013 16:25:00 +0000 (17:25 +0100)]
mds/CDentry.h: use projected.empty() instead of projected.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().
warning from cppchecker was:
[src/mds/CDentry.h:234]: (performance) Possible inefficient
checking for 'projected' emptiness.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Tue, 12 Feb 2013 16:20:19 +0000 (17:20 +0100)]
ceph_authtool.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().
warning from cppchecker was:
[src/ceph_authtool.cc:124]: (performance) Possible inefficient
checking for 'caps' emptiness.
[src/ceph_authtool.cc:237]: (performance) Possible inefficient
checking for 'caps' emptiness.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Sage Weil [Thu, 14 Feb 2013 23:39:43 +0000 (15:39 -0800)]
osd/OSDCap: tweak unquoted_word parsing in osd caps
Newer versions of spirit (1.49.0-3.1ubuntu1.1 in quantal, in particular)
dislike the construct with alnum and replace the - and _ with '\0' in the
resulting string.
Samuel Just [Thu, 14 Feb 2013 22:03:56 +0000 (14:03 -0800)]
OSD: always activate_map in advance_pgs, only send messages if up
We should always handle_activate_map() after handle_advance_map() in
order to kick the pg into a valid peering state for processing requests
prior to dropping the lock.
Additionally, we would prefer to avoid sending irrelevant messages
during boot, so only send if we are up according to the current service
osdmap.
Fixes: #4064
Backport: bobtail Signed-off-by: Samuel Just <sam.just@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
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.