diff options
author | Sage Weil <sage@redhat.com> | 2014-12-23 01:39:38 +0100 |
---|---|---|
committer | Sage Weil <sage@redhat.com> | 2015-06-19 02:02:47 +0200 |
commit | f8436f1dc5fe39a9167c86015de279e832c2e67a (patch) | |
tree | c511b719451bd99f385556f04e113174ab91ced7 /src/osd/PGBackend.cc | |
parent | ghobject_t: is_min() (diff) | |
download | ceph-f8436f1dc5fe39a9167c86015de279e832c2e67a.tar.xz ceph-f8436f1dc5fe39a9167c86015de279e832c2e67a.zip |
shard_id_t: change NO_SHARD to sort before 0 (min instead of max)
The min ghobject has shard NO_SHARD, and is the default constructed value.
That initial value is assumed in uncounted ways across the code base when
users do
ghobject_t foo;
foo.this = that;
such that changing it is dangerous. It is safer to change the shard_id_t
sort order such that NO_SHARD is signed instead of unsigned. The value
doesn't actually change (still 0xff), but the sorting does. Note that
only a single comparison triggers a signed/unsigned warning from this
change, and it assumes that the shard is not NO_SHARD (ec pool) and we
case it to preserve the old behavior anyway.
In PGBackend we change the minimum value for the objects_list_partial()
method to start with NO_SHARD.
Signed-off-by: Sage Weil <sage@redhat.com>
Diffstat (limited to 'src/osd/PGBackend.cc')
-rw-r--r-- | src/osd/PGBackend.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/osd/PGBackend.cc b/src/osd/PGBackend.cc index 319110cd0dd..64423dee1f3 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -109,7 +109,7 @@ int PGBackend::objects_list_partial( // make sure the result list has the marker object ( // it might have multiple generations though, which would // be filtered). - ghobject_t _next(begin, 0, shard_id_t(0)); + ghobject_t _next(begin, 0, shard_id_t::NO_SHARD); ls->reserve(max); int r = 0; while (!_next.is_max() && ls->size() < (unsigned)min) { |