mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
librbd: add new notify payload for rebuild object map
The request will be sent to the client which owns the exclusive lock to rebuild the object map for the current image HEAD. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
parent
d77de49eb1
commit
a8f828b8b8
@ -241,6 +241,22 @@ void SnapCreatePayload::dump(Formatter *f) const {
|
||||
f->dump_string("snap_name", snap_name);
|
||||
}
|
||||
|
||||
void RebuildObjectMapPayload::encode(bufferlist &bl) const {
|
||||
::encode(static_cast<uint32_t>(NOTIFY_OP_REBUILD_OBJECT_MAP), bl);
|
||||
::encode(async_request_id, bl);
|
||||
}
|
||||
|
||||
void RebuildObjectMapPayload::decode(__u8 version, bufferlist::iterator &iter) {
|
||||
::decode(async_request_id, iter);
|
||||
}
|
||||
|
||||
void RebuildObjectMapPayload::dump(Formatter *f) const {
|
||||
f->dump_string("notify_op", stringify(NOTIFY_OP_REBUILD_OBJECT_MAP));
|
||||
f->open_object_section("async_request_id");
|
||||
async_request_id.dump(f);
|
||||
f->close_section();
|
||||
}
|
||||
|
||||
void UnknownPayload::encode(bufferlist &bl) const {
|
||||
assert(false);
|
||||
}
|
||||
@ -292,6 +308,9 @@ void NotifyMessage::decode(bufferlist::iterator& iter) {
|
||||
case NOTIFY_OP_SNAP_CREATE:
|
||||
payload = SnapCreatePayload();
|
||||
break;
|
||||
case NOTIFY_OP_REBUILD_OBJECT_MAP:
|
||||
payload = RebuildObjectMapPayload();
|
||||
break;
|
||||
default:
|
||||
payload = UnknownPayload();
|
||||
break;
|
||||
@ -315,6 +334,7 @@ void NotifyMessage::generate_test_instances(std::list<NotifyMessage *> &o) {
|
||||
o.push_back(new NotifyMessage(FlattenPayload(AsyncRequestId(ClientId(0, 1), 2))));
|
||||
o.push_back(new NotifyMessage(ResizePayload(123, AsyncRequestId(ClientId(0, 1), 2))));
|
||||
o.push_back(new NotifyMessage(SnapCreatePayload("foo")));
|
||||
o.push_back(new NotifyMessage(RebuildObjectMapPayload(AsyncRequestId(ClientId(0, 1), 2))));
|
||||
}
|
||||
|
||||
void ResponseMessage::encode(bufferlist& bl) const {
|
||||
@ -372,6 +392,9 @@ std::ostream &operator<<(std::ostream &out,
|
||||
case NOTIFY_OP_SNAP_CREATE:
|
||||
out << "SnapCreate";
|
||||
break;
|
||||
case NOTIFY_OP_REBUILD_OBJECT_MAP:
|
||||
out << "RebuildObjectMap";
|
||||
break;
|
||||
default:
|
||||
out << "Unknown (" << static_cast<uint32_t>(op) << ")";
|
||||
break;
|
||||
|
@ -73,15 +73,16 @@ struct AsyncRequestId {
|
||||
};
|
||||
|
||||
enum NotifyOp {
|
||||
NOTIFY_OP_ACQUIRED_LOCK = 0,
|
||||
NOTIFY_OP_RELEASED_LOCK = 1,
|
||||
NOTIFY_OP_REQUEST_LOCK = 2,
|
||||
NOTIFY_OP_HEADER_UPDATE = 3,
|
||||
NOTIFY_OP_ASYNC_PROGRESS = 4,
|
||||
NOTIFY_OP_ASYNC_COMPLETE = 5,
|
||||
NOTIFY_OP_FLATTEN = 6,
|
||||
NOTIFY_OP_RESIZE = 7,
|
||||
NOTIFY_OP_SNAP_CREATE = 8
|
||||
NOTIFY_OP_ACQUIRED_LOCK = 0,
|
||||
NOTIFY_OP_RELEASED_LOCK = 1,
|
||||
NOTIFY_OP_REQUEST_LOCK = 2,
|
||||
NOTIFY_OP_HEADER_UPDATE = 3,
|
||||
NOTIFY_OP_ASYNC_PROGRESS = 4,
|
||||
NOTIFY_OP_ASYNC_COMPLETE = 5,
|
||||
NOTIFY_OP_FLATTEN = 6,
|
||||
NOTIFY_OP_RESIZE = 7,
|
||||
NOTIFY_OP_SNAP_CREATE = 8,
|
||||
NOTIFY_OP_REBUILD_OBJECT_MAP = 9
|
||||
};
|
||||
|
||||
struct AcquiredLockPayload {
|
||||
@ -179,7 +180,18 @@ struct SnapCreatePayload {
|
||||
SnapCreatePayload(const std::string &name) : snap_name(name) {}
|
||||
|
||||
std::string snap_name;
|
||||
|
||||
|
||||
void encode(bufferlist &bl) const;
|
||||
void decode(__u8 version, bufferlist::iterator &iter);
|
||||
void dump(Formatter *f) const;
|
||||
};
|
||||
|
||||
struct RebuildObjectMapPayload {
|
||||
RebuildObjectMapPayload() {}
|
||||
RebuildObjectMapPayload(const AsyncRequestId &id) : async_request_id(id) {}
|
||||
|
||||
AsyncRequestId async_request_id;
|
||||
|
||||
void encode(bufferlist &bl) const;
|
||||
void decode(__u8 version, bufferlist::iterator &iter);
|
||||
void dump(Formatter *f) const;
|
||||
@ -200,6 +212,7 @@ typedef boost::variant<AcquiredLockPayload,
|
||||
FlattenPayload,
|
||||
ResizePayload,
|
||||
SnapCreatePayload,
|
||||
RebuildObjectMapPayload,
|
||||
UnknownPayload> Payload;
|
||||
|
||||
struct NotifyMessage {
|
||||
|
Loading…
Reference in New Issue
Block a user