]>
git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDPGBackfill.h
7f637b9ef83d241e238045785bbcd345d3429419
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 #ifndef CEPH_MOSDPGBACKFILL_H
16 #define CEPH_MOSDPGBACKFILL_H
18 #include "MOSDFastDispatchOp.h"
20 class MOSDPGBackfill
: public MOSDFastDispatchOp
{
21 static const int HEAD_VERSION
= 3;
22 static const int COMPAT_VERSION
= 3;
25 OP_BACKFILL_PROGRESS
= 2,
26 OP_BACKFILL_FINISH
= 3,
27 OP_BACKFILL_FINISH_ACK
= 4,
29 const char *get_op_name(int o
) const {
31 case OP_BACKFILL_PROGRESS
: return "progress";
32 case OP_BACKFILL_FINISH
: return "finish";
33 case OP_BACKFILL_FINISH_ACK
: return "finish_ack";
34 default: return "???";
39 epoch_t map_epoch
, query_epoch
;
41 hobject_t last_backfill
;
44 epoch_t
get_map_epoch() const override
{
47 epoch_t
get_min_epoch() const override
{
50 spg_t
get_spg() const override
{
54 void decode_payload() override
{
55 bufferlist::iterator p
= payload
.begin();
57 ::decode(map_epoch
, p
);
58 ::decode(query_epoch
, p
);
59 ::decode(pgid
.pgid
, p
);
60 ::decode(last_backfill
, p
);
62 // For compatibility with version 1
63 ::decode(stats
.stats
, p
);
67 // Handle hobject_t format change
68 if (!last_backfill
.is_max() &&
69 last_backfill
.pool
== -1)
70 last_backfill
.pool
= pgid
.pool();
71 ::decode(pgid
.shard
, p
);
74 void encode_payload(uint64_t features
) override
{
75 ::encode(op
, payload
);
76 ::encode(map_epoch
, payload
);
77 ::encode(query_epoch
, payload
);
78 ::encode(pgid
.pgid
, payload
);
79 ::encode(last_backfill
, payload
);
81 // For compatibility with version 1
82 ::encode(stats
.stats
, payload
);
84 ::encode(stats
, payload
);
86 ::encode(pgid
.shard
, payload
);
90 : MOSDFastDispatchOp(MSG_OSD_PG_BACKFILL
, HEAD_VERSION
, COMPAT_VERSION
) {}
91 MOSDPGBackfill(__u32 o
, epoch_t e
, epoch_t qe
, spg_t p
)
92 : MOSDFastDispatchOp(MSG_OSD_PG_BACKFILL
, HEAD_VERSION
, COMPAT_VERSION
),
94 map_epoch(e
), query_epoch(e
),
97 ~MOSDPGBackfill() override
{}
100 const char *get_type_name() const override
{ return "pg_backfill"; }
101 void print(ostream
& out
) const override
{
102 out
<< "pg_backfill(" << get_op_name(op
)
104 << " e " << map_epoch
<< "/" << query_epoch
105 << " lb " << last_backfill