1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
15 #include "include/types.h"
16 #include "include/buffer.h"
17 #include "osd/osd_types.h"
20 #include "HashIndex.h"
22 #include "common/errno.h"
23 #include "common/debug.h"
24 #define dout_context cct
25 #define dout_subsys ceph_subsys_filestore
27 const string
HashIndex::SUBDIR_ATTR
= "contents";
28 const string
HashIndex::IN_PROGRESS_OP_TAG
= "in_progress_op";
30 /// hex digit to integer value
31 int hex_to_int(char c
)
33 if (c
>= '0' && c
<= '9')
35 if (c
>= 'A' && c
<= 'F')
40 /// int value to hex digit
41 char int_to_hex(int v
)
49 /// reverse bits in a nibble (0..15)
50 int reverse_nibble_bits(int in
)
60 /// reverse nibble bits in a hex digit
61 char reverse_hexdigit_bits(char c
)
63 return int_to_hex(reverse_nibble_bits(hex_to_int(c
)));
66 /// reverse nibble bits in a hex string
67 string
reverse_hexdigit_bits_string(string s
)
69 for (unsigned i
=0; i
<s
.size(); ++i
)
70 s
[i
] = reverse_hexdigit_bits(s
[i
]);
74 /// compare hex digit (as length 1 string) bitwise
75 bool cmp_hexdigit_bitwise(const string
& l
, const string
& r
)
77 assert(l
.length() == 1 && r
.length() == 1);
78 int lv
= hex_to_int(l
[0]);
79 int rv
= hex_to_int(r
[0]);
82 return reverse_nibble_bits(lv
) < reverse_nibble_bits(rv
);
85 /// compare hex digit string bitwise
86 bool cmp_hexdigit_string_bitwise(const string
& l
, const string
& r
)
88 string ll
= reverse_hexdigit_bits_string(l
);
89 string rr
= reverse_hexdigit_bits_string(r
);
93 int HashIndex::cleanup() {
95 int r
= get_attr_path(vector
<string
>(), IN_PROGRESS_OP_TAG
, bl
);
97 // No in progress operations!
100 bufferlist::iterator i
= bl
.begin();
101 InProgressOp
in_progress(i
);
103 r
= get_info(in_progress
.path
, &info
);
105 return end_split_or_merge(in_progress
.path
);
110 if (in_progress
.is_split())
111 return complete_split(in_progress
.path
, info
);
112 else if (in_progress
.is_merge())
113 return complete_merge(in_progress
.path
, info
);
114 else if (in_progress
.is_col_split()) {
115 for (vector
<string
>::iterator i
= in_progress
.path
.begin();
116 i
!= in_progress
.path
.end();
118 vector
<string
> path(in_progress
.path
.begin(), i
);
119 int r
= reset_attr(path
);
129 int HashIndex::reset_attr(
130 const vector
<string
> &path
)
133 int r
= path_exists(path
, &exists
);
138 map
<string
, ghobject_t
> objects
;
139 vector
<string
> subdirs
;
140 r
= list_objects(path
, 0, 0, &objects
);
143 r
= list_subdirs(path
, &subdirs
);
148 info
.hash_level
= path
.size();
149 info
.objs
= objects
.size();
150 info
.subdirs
= subdirs
.size();
151 return set_info(path
, info
);
154 int HashIndex::col_split_level(
157 const vector
<string
> &path
,
162 /* For each subdir, move, recurse, or ignore based on comparing the low order
163 * bits of the hash represented by the subdir path with inbits, match passed
166 vector
<string
> subdirs
;
167 int r
= from
.list_subdirs(path
, &subdirs
);
170 map
<string
, ghobject_t
> objects
;
171 r
= from
.list_objects(path
, 0, 0, &objects
);
176 for (vector
<string
>::iterator i
= subdirs
.begin();
181 vector
<string
> sub_path(path
.begin(), path
.end());
182 sub_path
.push_back(*i
);
183 path_to_hobject_hash_prefix(sub_path
, &bits
, &hash
);
185 if (hobject_t::match_hash(hash
, bits
, match
)) {
195 if (*mkdirred
> path
.size())
196 *mkdirred
= path
.size();
197 } // else, skip, doesn't need to be moved or recursed into
199 if (hobject_t::match_hash(hash
, inbits
, match
)) {
202 } // else, skip, doesn't need to be moved or recursed into
205 /* Then, do the same for each object */
206 map
<string
, ghobject_t
> objs_to_move
;
207 for (map
<string
, ghobject_t
>::iterator i
= objects
.begin();
210 if (i
->second
.match(inbits
, match
)) {
211 objs_to_move
.insert(*i
);
215 if (objs_to_move
.empty() && to_move
.empty())
218 // Make parent directories as needed
219 while (*mkdirred
< path
.size()) {
222 vector
<string
> creating_path(path
.begin(), path
.begin()+*mkdirred
);
223 r
= to
.path_exists(creating_path
, &exists
);
231 info
.hash_level
= creating_path
.size();
232 if (*mkdirred
< path
.size() - 1)
234 r
= to
.start_col_split(creating_path
);
237 r
= to
.create_path(creating_path
);
240 r
= to
.set_info(creating_path
, info
);
243 r
= to
.end_split_or_merge(creating_path
);
248 subdir_info_s from_info
;
249 subdir_info_s to_info
;
250 r
= from
.get_info(path
, &from_info
);
253 r
= to
.get_info(path
, &to_info
);
257 from
.start_col_split(path
);
258 to
.start_col_split(path
);
261 for (set
<string
>::iterator i
= to_move
.begin();
266 r
= move_subdir(from
, to
, path
, *i
);
271 for (map
<string
, ghobject_t
>::iterator i
= objs_to_move
.begin();
272 i
!= objs_to_move
.end();
276 r
= move_object(from
, to
, path
, *i
);
282 r
= to
.set_info(path
, to_info
);
285 r
= from
.set_info(path
, from_info
);
288 from
.end_split_or_merge(path
);
289 to
.end_split_or_merge(path
);
293 int HashIndex::_split(
296 CollectionIndex
* dest
) {
297 assert(collection_version() == dest
->collection_version());
298 unsigned mkdirred
= 0;
299 return col_split_level(
301 *static_cast<HashIndex
*>(dest
),
308 int HashIndex::split_dirs(const vector
<string
> &path
) {
309 dout(20) << __func__
<< " " << path
<< dendl
;
311 int r
= get_info(path
, &info
);
313 dout(10) << "error looking up info for " << path
<< ": "
314 << cpp_strerror(r
) << dendl
;
318 if (must_split(info
)) {
319 dout(1) << __func__
<< " " << path
<< " has " << info
.objs
320 << " objects, starting split." << dendl
;
321 r
= initiate_split(path
, info
);
323 dout(10) << "error initiating split on " << path
<< ": "
324 << cpp_strerror(r
) << dendl
;
328 r
= complete_split(path
, info
);
329 dout(1) << __func__
<< " " << path
<< " split completed."
332 dout(10) << "error completing split on " << path
<< ": "
333 << cpp_strerror(r
) << dendl
;
338 vector
<string
> subdirs
;
339 r
= list_subdirs(path
, &subdirs
);
341 dout(10) << "error listing subdirs of " << path
<< ": "
342 << cpp_strerror(r
) << dendl
;
345 for (vector
<string
>::const_iterator it
= subdirs
.begin();
346 it
!= subdirs
.end(); ++it
) {
347 vector
<string
> subdir_path(path
);
348 subdir_path
.push_back(*it
);
349 r
= split_dirs(subdir_path
);
358 int HashIndex::apply_layout_settings() {
360 dout(10) << __func__
<< " split multiple = " << split_multiplier
361 << " merge threshold = " << merge_threshold
<< dendl
;
362 return split_dirs(path
);
365 int HashIndex::_init() {
368 return set_info(path
, info
);
371 /* LFNIndex virtual method implementations */
372 int HashIndex::_created(const vector
<string
> &path
,
373 const ghobject_t
&oid
,
374 const string
&mangled_name
) {
377 r
= get_info(path
, &info
);
381 r
= set_info(path
, info
);
385 if (must_split(info
)) {
386 dout(1) << __func__
<< " " << path
<< " has " << info
.objs
387 << " objects, starting split." << dendl
;
388 int r
= initiate_split(path
, info
);
391 r
= complete_split(path
, info
);
392 dout(1) << __func__
<< " " << path
<< " split completed."
400 int HashIndex::_remove(const vector
<string
> &path
,
401 const ghobject_t
&oid
,
402 const string
&mangled_name
) {
404 r
= remove_object(path
, oid
);
408 r
= get_info(path
, &info
);
412 r
= set_info(path
, info
);
415 if (must_merge(info
)) {
416 r
= initiate_merge(path
, info
);
419 return complete_merge(path
, info
);
425 int HashIndex::_lookup(const ghobject_t
&oid
,
426 vector
<string
> *path
,
427 string
*mangled_name
,
429 vector
<string
> path_comp
;
430 get_path_components(oid
, &path_comp
);
431 vector
<string
>::iterator next
= path_comp
.begin();
434 int r
= path_exists(*path
, &exists
);
443 if (next
== path_comp
.end())
445 path
->push_back(*(next
++));
447 return get_mangled_name(*path
, oid
, mangled_name
, hardlink
);
450 int HashIndex::_collection_list_partial(const ghobject_t
&start
,
451 const ghobject_t
&end
,
453 vector
<ghobject_t
> *ls
,
460 dout(20) << __func__
<< " start:" << start
<< " end:" << end
<< "-" << max_count
<< " ls.size " << ls
->size() << dendl
;
461 return list_by_hash(path
, end
, max_count
, next
, ls
);
464 int HashIndex::prep_delete() {
465 return recursive_remove(vector
<string
>());
468 int HashIndex::_pre_hash_collection(uint32_t pg_num
, uint64_t expected_num_objs
) {
471 subdir_info_s root_info
;
472 // Make sure there is neither objects nor sub-folders
473 // in this collection
474 ret
= get_info(path
, &root_info
);
478 // Do the folder splitting first
479 ret
= pre_split_folder(pg_num
, expected_num_objs
);
482 // Initialize the folder info starting from root
483 return init_split_folder(path
, 0);
486 int HashIndex::pre_split_folder(uint32_t pg_num
, uint64_t expected_num_objs
)
488 // If folder merging is enabled (by setting the threshold positive),
490 if (merge_threshold
> 0)
492 const coll_t c
= coll();
493 // Do not split if the expected number of objects in this collection is zero (by default)
494 if (expected_num_objs
== 0)
497 // Calculate the number of leaf folders (which actually store files)
498 // need to be created
499 const uint64_t objs_per_folder
= (uint64_t)(abs(merge_threshold
)) * (uint64_t)split_multiplier
* 16;
500 uint64_t leavies
= expected_num_objs
/ objs_per_folder
;
502 if (leavies
== 0 || expected_num_objs
== objs_per_folder
)
506 if (!c
.is_pg_prefix(&spgid
))
508 const ps_t ps
= spgid
.pgid
.ps();
510 // the most significant bits of pg_num
511 const int pg_num_bits
= calc_num_bits(pg_num
- 1);
513 // calculate the number of levels we only create one sub folder
514 int num
= pg_num_bits
/ 4;
515 // pg num's hex value is like 1xxx,xxxx,xxxx but not 1111,1111,1111,
516 // so that splitting starts at level 3
517 if (pg_num_bits
% 4 == 0 && pg_num
< ((uint32_t)1 << pg_num_bits
)) {
522 // Start with creation that only has one subfolder
523 vector
<string
> paths
;
526 ps_t v
= tmp_id
& 0x0000000f;
527 paths
.push_back(to_hex(v
));
528 ret
= create_path(paths
);
529 if (ret
< 0 && ret
!= -EEXIST
)
531 tmp_id
= tmp_id
>> 4;
534 // Starting from here, we can split by creating multiple subfolders
535 const int left_bits
= pg_num_bits
- dump_num
* 4;
536 // this variable denotes how many bits (for this level) that can be
537 // used for sub folder splitting
538 int split_bits
= 4 - left_bits
;
539 // the below logic is inspired by rados.h#ceph_stable_mod,
540 // it basically determines how many sub-folders should we
541 // create for splitting
542 assert(pg_num_bits
> 0); // otherwise BAD_SHIFT
543 if (((1 << (pg_num_bits
- 1)) | ps
) >= pg_num
) {
546 const uint32_t subs
= (1 << split_bits
);
547 // Calculate how many levels we create starting from here
550 while (leavies
> 1) {
552 leavies
= leavies
>> 4;
554 for (uint32_t i
= 0; i
< subs
; ++i
) {
555 assert(split_bits
<= 4); // otherwise BAD_SHIFT
556 int v
= tmp_id
| (i
<< ((4 - split_bits
) % 4));
557 paths
.push_back(to_hex(v
));
558 ret
= create_path(paths
);
559 if (ret
< 0 && ret
!= -EEXIST
)
561 ret
= recursive_create_path(paths
, level
);
569 int HashIndex::init_split_folder(vector
<string
> &path
, uint32_t hash_level
)
571 // Get the number of sub directories for the current path
572 vector
<string
> subdirs
;
573 int ret
= list_subdirs(path
, &subdirs
);
577 info
.subdirs
= subdirs
.size();
578 info
.hash_level
= hash_level
;
579 ret
= set_info(path
, info
);
582 ret
= fsync_dir(path
);
586 // Do the same for subdirs
587 vector
<string
>::const_iterator iter
;
588 for (iter
= subdirs
.begin(); iter
!= subdirs
.end(); ++iter
) {
589 path
.push_back(*iter
);
590 ret
= init_split_folder(path
, hash_level
+ 1);
598 int HashIndex::recursive_create_path(vector
<string
>& path
, int level
)
602 for (int i
= 0; i
< 16; ++i
) {
603 path
.push_back(to_hex(i
));
604 int ret
= create_path(path
);
605 if (ret
< 0 && ret
!= -EEXIST
)
607 ret
= recursive_create_path(path
, level
- 1);
615 int HashIndex::recursive_remove(const vector
<string
> &path
) {
616 return _recursive_remove(path
, true);
619 int HashIndex::_recursive_remove(const vector
<string
> &path
, bool top
) {
620 vector
<string
> subdirs
;
621 dout(20) << __func__
<< " path=" << path
<< dendl
;
622 int r
= list_subdirs(path
, &subdirs
);
625 map
<string
, ghobject_t
> objects
;
626 r
= list_objects(path
, 0, 0, &objects
);
629 if (!objects
.empty())
631 vector
<string
> subdir(path
);
632 for (vector
<string
>::iterator i
= subdirs
.begin();
635 subdir
.push_back(*i
);
636 r
= _recursive_remove(subdir
, false);
644 return remove_path(path
);
647 int HashIndex::start_col_split(const vector
<string
> &path
) {
649 InProgressOp
op_tag(InProgressOp::COL_SPLIT
, path
);
651 int r
= add_attr_path(vector
<string
>(), IN_PROGRESS_OP_TAG
, bl
);
654 return fsync_dir(vector
<string
>());
657 int HashIndex::start_split(const vector
<string
> &path
) {
659 InProgressOp
op_tag(InProgressOp::SPLIT
, path
);
661 int r
= add_attr_path(vector
<string
>(), IN_PROGRESS_OP_TAG
, bl
);
664 return fsync_dir(vector
<string
>());
667 int HashIndex::start_merge(const vector
<string
> &path
) {
669 InProgressOp
op_tag(InProgressOp::MERGE
, path
);
671 int r
= add_attr_path(vector
<string
>(), IN_PROGRESS_OP_TAG
, bl
);
674 return fsync_dir(vector
<string
>());
677 int HashIndex::end_split_or_merge(const vector
<string
> &path
) {
678 return remove_attr_path(vector
<string
>(), IN_PROGRESS_OP_TAG
);
681 int HashIndex::get_info(const vector
<string
> &path
, subdir_info_s
*info
) {
683 int r
= get_attr_path(path
, SUBDIR_ATTR
, buf
);
686 bufferlist::iterator bufiter
= buf
.begin();
687 info
->decode(bufiter
);
688 assert(path
.size() == (unsigned)info
->hash_level
);
692 int HashIndex::set_info(const vector
<string
> &path
, const subdir_info_s
&info
) {
694 assert(path
.size() == (unsigned)info
.hash_level
);
696 return add_attr_path(path
, SUBDIR_ATTR
, buf
);
699 bool HashIndex::must_merge(const subdir_info_s
&info
) {
700 return (info
.hash_level
> 0 &&
701 merge_threshold
> 0 &&
702 info
.objs
< (unsigned)merge_threshold
&&
706 bool HashIndex::must_split(const subdir_info_s
&info
) {
707 return (info
.hash_level
< (unsigned)MAX_HASH_LEVEL
&&
708 info
.objs
> ((unsigned)(abs(merge_threshold
)) * 16 * split_multiplier
));
712 int HashIndex::initiate_merge(const vector
<string
> &path
, subdir_info_s info
) {
713 return start_merge(path
);
716 int HashIndex::complete_merge(const vector
<string
> &path
, subdir_info_s info
) {
717 vector
<string
> dst
= path
;
719 subdir_info_s dstinfo
;
721 r
= path_exists(path
, &exists
);
724 r
= get_info(dst
, &dstinfo
);
728 r
= move_objects(path
, dst
);
734 r
= remove_path(path
);
738 if (must_merge(dstinfo
)) {
739 r
= initiate_merge(dst
, dstinfo
);
745 return complete_merge(dst
, dstinfo
);
750 return end_split_or_merge(path
);
753 int HashIndex::initiate_split(const vector
<string
> &path
, subdir_info_s info
) {
754 return start_split(path
);
757 int HashIndex::complete_split(const vector
<string
> &path
, subdir_info_s info
) {
758 int level
= info
.hash_level
;
759 map
<string
, ghobject_t
> objects
;
760 vector
<string
> dst
= path
;
763 r
= list_objects(path
, 0, 0, &objects
);
766 vector
<string
> subdirs_vec
;
767 r
= list_subdirs(path
, &subdirs_vec
);
771 subdirs
.insert(subdirs_vec
.begin(), subdirs_vec
.end());
772 map
<string
, map
<string
, ghobject_t
> > mapped
;
773 map
<string
, ghobject_t
> moved
;
775 for (map
<string
, ghobject_t
>::iterator i
= objects
.begin();
778 vector
<string
> new_path
;
779 get_path_components(i
->second
, &new_path
);
780 mapped
[new_path
[level
]][i
->first
] = i
->second
;
782 for (map
<string
, map
<string
, ghobject_t
> >::iterator i
= mapped
.begin();
785 dst
[level
] = i
->first
;
786 /* If the info already exists, it must be correct,
787 * we may be picking up a partially finished split */
789 // subdir has already been fully copied
790 if (subdirs
.count(i
->first
) && !get_info(dst
, &temp
)) {
791 for (map
<string
, ghobject_t
>::iterator j
= i
->second
.begin();
792 j
!= i
->second
.end();
794 moved
[j
->first
] = j
->second
;
796 objects
.erase(j
->first
);
802 subdir_info_s info_new
;
803 info_new
.objs
= i
->second
.size();
804 info_new
.subdirs
= 0;
805 info_new
.hash_level
= level
+ 1;
806 if (must_merge(info_new
) && !subdirs
.count(i
->first
)) {
811 // Subdir doesn't yet exist
812 if (!subdirs
.count(i
->first
)) {
814 r
= create_path(dst
);
817 } // else subdir has been created but only partially copied
819 for (map
<string
, ghobject_t
>::iterator j
= i
->second
.begin();
820 j
!= i
->second
.end();
822 moved
[j
->first
] = j
->second
;
824 objects
.erase(j
->first
);
825 r
= link_object(path
, dst
, j
->second
, j
->first
);
826 // May be a partially finished split
827 if (r
< 0 && r
!= -EEXIST
) {
836 // Presence of info must imply that all objects have been copied
837 r
= set_info(dst
, info_new
);
847 r
= remove_objects(path
, moved
, &objects
);
850 info
.objs
= objects
.size();
851 r
= reset_attr(path
);
857 return end_split_or_merge(path
);
860 void HashIndex::get_path_components(const ghobject_t
&oid
,
861 vector
<string
> *path
) {
862 char buf
[MAX_HASH_LEVEL
+ 1];
863 snprintf(buf
, sizeof(buf
), "%.*X", MAX_HASH_LEVEL
, (uint32_t)oid
.hobj
.get_nibblewise_key());
865 // Path components are the hex characters of oid.hobj.hash, least
867 for (int i
= 0; i
< MAX_HASH_LEVEL
; ++i
) {
868 path
->push_back(string(&buf
[i
], 1));
872 string
HashIndex::get_hash_str(uint32_t hash
) {
873 char buf
[MAX_HASH_LEVEL
+ 1];
874 snprintf(buf
, sizeof(buf
), "%.*X", MAX_HASH_LEVEL
, hash
);
876 for (int i
= 0; i
< MAX_HASH_LEVEL
; ++i
) {
877 retval
.push_back(buf
[MAX_HASH_LEVEL
- 1 - i
]);
882 string
HashIndex::get_path_str(const ghobject_t
&oid
) {
883 assert(!oid
.is_max());
884 return get_hash_str(oid
.hobj
.get_hash());
887 uint32_t HashIndex::hash_prefix_to_hash(string prefix
) {
888 while (prefix
.size() < sizeof(uint32_t) * 2) {
889 prefix
.push_back('0');
892 sscanf(prefix
.c_str(), "%x", &hash
);
894 hash
= ((hash
& 0x0f0f0f0f) << 4) | ((hash
& 0xf0f0f0f0) >> 4);
895 hash
= ((hash
& 0x00ff00ff) << 8) | ((hash
& 0xff00ff00) >> 8);
896 hash
= ((hash
& 0x0000ffff) << 16) | ((hash
& 0xffff0000) >> 16);
900 int HashIndex::get_path_contents_by_hash_bitwise(
901 const vector
<string
> &path
,
902 const ghobject_t
*next_object
,
903 set
<string
, CmpHexdigitStringBitwise
> *hash_prefixes
,
904 set
<pair
<string
, ghobject_t
>, CmpPairBitwise
> *objects
)
906 map
<string
, ghobject_t
> rev_objects
;
908 r
= list_objects(path
, 0, 0, &rev_objects
);
912 for (map
<string
, ghobject_t
>::iterator i
= rev_objects
.begin();
913 i
!= rev_objects
.end();
915 if (next_object
&& i
->second
< *next_object
)
917 string hash_prefix
= get_path_str(i
->second
);
918 hash_prefixes
->insert(hash_prefix
);
919 objects
->insert(pair
<string
, ghobject_t
>(hash_prefix
, i
->second
));
921 vector
<string
> subdirs
;
922 r
= list_subdirs(path
, &subdirs
);
926 // sort subdirs bitwise (by reversing hex digit nibbles)
927 std::sort(subdirs
.begin(), subdirs
.end(), cmp_hexdigit_bitwise
);
929 // Local to this function, we will convert the prefix strings
930 // (previously simply the reversed hex digits) to also have each
931 // digit's nibbles reversed. This will make the strings sort
934 for (vector
<string
>::const_iterator i
= path
.begin();
937 cur_prefix
.append(reverse_hexdigit_bits_string(*i
));
939 string next_object_string
;
941 next_object_string
= reverse_hexdigit_bits_string(get_path_str(*next_object
));
942 for (vector
<string
>::iterator i
= subdirs
.begin();
945 string candidate
= cur_prefix
+ reverse_hexdigit_bits_string(*i
);
947 if (next_object
->is_max())
949 if (candidate
< next_object_string
.substr(0, candidate
.size()))
952 // re-reverse the hex digit nibbles for the caller
953 hash_prefixes
->insert(reverse_hexdigit_bits_string(candidate
));
958 int HashIndex::list_by_hash(const vector
<string
> &path
,
959 const ghobject_t
&end
,
962 vector
<ghobject_t
> *out
)
965 return list_by_hash_bitwise(path
, end
, max_count
, next
, out
);
968 int HashIndex::list_by_hash_bitwise(
969 const vector
<string
> &path
,
970 const ghobject_t
& end
,
973 vector
<ghobject_t
> *out
)
975 vector
<string
> next_path
= path
;
976 next_path
.push_back("");
977 set
<string
, CmpHexdigitStringBitwise
> hash_prefixes
;
978 set
<pair
<string
, ghobject_t
>, CmpPairBitwise
> objects
;
979 int r
= get_path_contents_by_hash_bitwise(path
,
985 for (set
<string
, CmpHexdigitStringBitwise
>::iterator i
= hash_prefixes
.begin();
986 i
!= hash_prefixes
.end();
988 dout(20) << __func__
<< " prefix " << *i
<< dendl
;
989 set
<pair
<string
, ghobject_t
>, CmpPairBitwise
>::iterator j
= objects
.lower_bound(
990 make_pair(*i
, ghobject_t()));
991 if (j
== objects
.end() || j
->first
!= *i
) {
992 *(next_path
.rbegin()) = *(i
->rbegin());
993 ghobject_t next_recurse
;
995 next_recurse
= *next
;
996 r
= list_by_hash_bitwise(next_path
,
1004 if (!next_recurse
.is_max()) {
1006 *next
= next_recurse
;
1010 while (j
!= objects
.end() && j
->first
== *i
) {
1011 if (max_count
> 0 && out
->size() == (unsigned)max_count
) {
1016 if (j
->second
>= end
) {
1021 if (!next
|| j
->second
>= *next
) {
1022 dout(20) << __func__
<< " prefix " << *i
<< " ob " << j
->second
<< dendl
;
1023 out
->push_back(j
->second
);
1030 *next
= ghobject_t::get_max();