~mathiaz/+junk/ceph-new-pkg-review

« back to all changes in this revision

Viewing changes to src/mds/events/EFragment.h

  • Committer: Mathias Gug
  • Date: 2010-07-29 03:10:42 UTC
  • Revision ID: mathias.gug@canonical.com-20100729031042-n9n8kky962qb4onb
Import ceph_0.21-0ubuntu1 from https://launchpad.net/~clint-fewbar/+archive/ceph/+packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
 
2
// vim: ts=8 sw=2 smarttab
 
3
/*
 
4
 * Ceph - scalable distributed file system
 
5
 *
 
6
 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
 
7
 *
 
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.
 
12
 * 
 
13
 */
 
14
 
 
15
#ifndef CEPH_MDS_EFRAGMENT_H
 
16
#define CEPH_MDS_EFRAGMENT_H
 
17
 
 
18
#include "../LogEvent.h"
 
19
#include "EMetaBlob.h"
 
20
 
 
21
class EFragment : public LogEvent {
 
22
public:
 
23
  EMetaBlob metablob;
 
24
  inodeno_t ino;
 
25
  frag_t basefrag;
 
26
  __s32 bits;         // positive for split (from basefrag), negative for merge (to basefrag)
 
27
 
 
28
  EFragment() : LogEvent(EVENT_FRAGMENT) { }
 
29
  EFragment(MDLog *mdlog, inodeno_t i, frag_t bf, int b) : 
 
30
    LogEvent(EVENT_FRAGMENT), metablob(mdlog), 
 
31
    ino(i), basefrag(bf), bits(b) { }
 
32
  void print(ostream& out) {
 
33
    out << "EFragment " << ino << " " << basefrag << " by " << bits << " " << metablob;
 
34
  }
 
35
 
 
36
  void encode(bufferlist &bl) const {
 
37
    __u8 struct_v = 1;
 
38
    ::encode(struct_v, bl);
 
39
    ::encode(ino, bl);
 
40
    ::encode(basefrag, bl);
 
41
    ::encode(bits, bl);
 
42
    ::encode(metablob, bl);
 
43
  } 
 
44
  void decode(bufferlist::iterator &bl) {
 
45
    __u8 struct_v;
 
46
    ::decode(struct_v, bl);
 
47
    ::decode(ino, bl);
 
48
    ::decode(basefrag, bl);
 
49
    ::decode(bits, bl);
 
50
    ::decode(metablob, bl);
 
51
  }
 
52
 
 
53
  void replay(MDS *mds);
 
54
};
 
55
 
 
56
#endif