~ubuntu-branches/ubuntu/quantal/ceph/quantal

« back to all changes in this revision

Viewing changes to src/os/ObjectStore.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-07-16 09:56:24 UTC
  • mfrom: (0.3.11)
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: package-import@ubuntu.com-20120716095624-azr2w4hbhei1rxmx
Tags: upstream-0.48
ImportĀ upstreamĀ versionĀ 0.48

Show diffs side-by-side

added added

removed removed

Lines of Context:
158
158
    uint32_t largest_data_len, largest_data_off, largest_data_off_in_tbl;
159
159
    bufferlist tbl;
160
160
    bool sobject_encoding;
 
161
    int64_t pool_override;
 
162
    bool use_pool_override;
161
163
 
162
164
  public:
 
165
    void set_pool_override(int64_t pool) {
 
166
      pool_override = pool;
 
167
    }
163
168
 
164
169
    void swap(Transaction& other) {
165
170
      std::swap(ops, other.ops);
225
230
    class iterator {
226
231
      bufferlist::iterator p;
227
232
      bool sobject_encoding;
 
233
      int64_t pool_override;
 
234
      bool use_pool_override;
228
235
 
229
236
      iterator(Transaction *t)
230
237
        : p(t->tbl.begin()),
231
 
          sobject_encoding(t->sobject_encoding) {}
 
238
          sobject_encoding(t->sobject_encoding),
 
239
          pool_override(t->pool_override),
 
240
          use_pool_override(t->use_pool_override) {}
232
241
 
233
242
      friend class Transaction;
234
243
 
253
262
          hoid.oid = soid.oid;
254
263
        } else {
255
264
          ::decode(hoid, p);
 
265
          if (use_pool_override && pool_override != -1 &&
 
266
              hoid.pool == -1) {
 
267
            hoid.pool = pool_override;
 
268
          }
256
269
        }
257
270
        return hoid;
258
271
      }
531
544
    // etc.
532
545
    Transaction() :
533
546
      ops(0), pad_unused_bytes(0), largest_data_len(0), largest_data_off(0), largest_data_off_in_tbl(0),
534
 
      sobject_encoding(false) {}
 
547
      sobject_encoding(false), pool_override(-1), use_pool_override(false) {}
535
548
    Transaction(bufferlist::iterator &dp) :
536
549
      ops(0), pad_unused_bytes(0), largest_data_len(0), largest_data_off(0), largest_data_off_in_tbl(0),
537
 
      sobject_encoding(false) {
 
550
      sobject_encoding(false), pool_override(-1), use_pool_override(false) {
538
551
      decode(dp);
539
552
    }
540
553
    Transaction(bufferlist &nbl) :
541
554
      ops(0), pad_unused_bytes(0), largest_data_len(0), largest_data_off(0), largest_data_off_in_tbl(0),
542
 
      sobject_encoding(false) {
 
555
      sobject_encoding(false), pool_override(-1), use_pool_override(false) {
543
556
      bufferlist::iterator dp = nbl.begin();
544
557
      decode(dp); 
545
558
    }
546
559
 
547
560
    void encode(bufferlist& bl) const {
548
 
      ENCODE_START(5, 5, bl);
 
561
      ENCODE_START(6, 5, bl);
549
562
      ::encode(ops, bl);
550
563
      ::encode(pad_unused_bytes, bl);
551
564
      ::encode(largest_data_len, bl);
555
568
      ENCODE_FINISH(bl);
556
569
    }
557
570
    void decode(bufferlist::iterator &bl) {
558
 
      DECODE_START_LEGACY_COMPAT_LEN(5, 5, 5, bl);
 
571
      DECODE_START_LEGACY_COMPAT_LEN(6, 5, 5, bl);
559
572
      DECODE_OLDEST(2);
560
573
      if (struct_v < 4)
561
574
        sobject_encoding = true;
570
583
      }
571
584
      ::decode(tbl, bl);
572
585
      DECODE_FINISH(bl);
 
586
      if (struct_v < 6) {
 
587
        use_pool_override = true;
 
588
      }
573
589
    }
574
590
 
575
591
    void dump(ceph::Formatter *f);