]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/ObjectStore: add collection_set_bits op
authorSage Weil <sage@redhat.com>
Tue, 28 Mar 2017 21:40:07 +0000 (17:40 -0400)
committerSage Weil <sage@redhat.com>
Wed, 29 Mar 2017 02:23:43 +0000 (22:23 -0400)
This is only for FileStore, the only one that doesn't
already store it.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/ObjectStore.h
src/os/Transaction.cc

index 5a168d005f6cb2c0bbbd147db0056bbe5cc84d17..e2cc6e9f9101dd79880cc8b00175fc6ae9901d3d 100644 (file)
@@ -403,6 +403,8 @@ public:
       OP_COLL_HINT = 40, // cid, type, bl
 
       OP_TRY_RENAME = 41,   // oldcid, oldoid, newoid
+
+      OP_COLL_SET_BITS = 42, // cid, bits
     };
 
     // Transaction hint type
@@ -429,7 +431,8 @@ public:
       };
       __le64 expected_object_size;      //OP_SETALLOCHINT
       __le64 expected_write_size;       //OP_SETALLOCHINT
-      __le32 split_bits;                //OP_SPLIT_COLLECTION2
+      __le32 split_bits;                //OP_SPLIT_COLLECTION2,OP_COLL_SET_BITS,
+                                        //OP_MKCOLL
       __le32 split_rem;                 //OP_SPLIT_COLLECTION2
     } __attribute__ ((packed)) ;
 
@@ -677,6 +680,7 @@ public:
       case OP_COLL_RMATTR:
       case OP_COLL_SETATTRS:
       case OP_COLL_HINT:
+      case OP_COLL_SET_BITS:
         assert(op->cid < cm.size());
         op->cid = cm[op->cid];
         break;
@@ -1392,6 +1396,16 @@ public:
       data.ops++;
     }
 
+    void collection_set_bits(
+      coll_t cid,
+      int bits) {
+      Op* _op = _get_next_op();
+      _op->op = OP_COLL_SET_BITS;
+      _op->cid = _get_coll_id(cid);
+      _op->split_bits = bits;
+      data.ops++;
+    }
+
     /// Set allocation hint for an object
     /// make 0 values(expected_object_size, expected_write_size) noops for all implementations
     void set_alloc_hint(
index b07183c61d2ebe09c296f05853bc99386e30cb2d..8840d7cb25ad4e31931f6203a701bdb9153f4043 100644 (file)
@@ -219,6 +219,15 @@ void ObjectStore::Transaction::dump(ceph::Formatter *f)
       }
       break;
 
+    case Transaction::OP_COLL_SET_BITS:
+      {
+       coll_t cid = i.get_cid(op->cid);
+       f->dump_string("op_name", "coll_set_bits");
+       f->dump_stream("collection") << cid;
+       f->dump_unsigned("bits", op->split_bits);
+      }
+      break;
+
     case Transaction::OP_RMCOLL:
       {
         coll_t cid = i.get_cid(op->cid);