]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/osd_types: add ceph_osd_alloc_hint_flag_string helper
authorSage Weil <sage@redhat.com>
Mon, 6 Jun 2016 14:27:16 +0000 (10:27 -0400)
committerSage Weil <sage@redhat.com>
Wed, 15 Jun 2016 19:25:28 +0000 (15:25 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/osd_types.cc
src/osd/osd_types.h

index 173fe56dd03311509b06ded5445740d58750289e..662d78ab412f97ed640ed243f7ac86f7f0b47fc3 100644 (file)
@@ -109,7 +109,7 @@ const char * ceph_osd_op_flag_name(unsigned flag)
 string ceph_osd_op_flag_string(unsigned flags)
 {
   string s;
-  for (unsigned i=0; i<31; ++i) {
+  for (unsigned i=0; i<32; ++i) {
     if (flags & (1u<<i)) {
       if (s.length())
        s += "+";
@@ -121,6 +121,21 @@ string ceph_osd_op_flag_string(unsigned flags)
   return string("-");
 }
 
+string ceph_osd_alloc_hint_flag_string(unsigned flags)
+{
+  string s;
+  for (unsigned i=0; i<32; ++i) {
+    if (flags & (1u<<i)) {
+      if (s.length())
+       s += "+";
+      s += ceph_osd_alloc_hint_flag_name(1u << i);
+    }
+  }
+  if (s.length())
+    return s;
+  return string("-");
+}
+
 void pg_shard_t::encode(bufferlist &bl) const
 {
   ENCODE_START(1, 1, bl);
index 553ee0600c0a9042d469558f2face0d1fb850fcf..e112909a529ba4200492ac34c023a11a078dd88a 100644 (file)
@@ -84,6 +84,8 @@ const char *ceph_osd_op_flag_name(unsigned flag);
 string ceph_osd_flag_string(unsigned flags);
 /// conver CEPH_OSD_OP_FLAG_* op flags to a string
 string ceph_osd_op_flag_string(unsigned flags);
+/// conver CEPH_OSD_ALLOC_HINT_FLAG_* op flags to a string
+string ceph_osd_alloc_hint_flag_string(unsigned flags);
 
 struct pg_shard_t {
   int32_t osd;