* An op may be READ, WRITE, or READ|WRITE.
*/
enum {
- CEPH_OSD_FLAG_ACK = 1, /* want (or is) "ack" ack */
- CEPH_OSD_FLAG_ONNVRAM = 2, /* want (or is) "onnvram" ack */
- CEPH_OSD_FLAG_ONDISK = 4, /* want (or is) "ondisk" ack */
- CEPH_OSD_FLAG_RETRY = 8, /* resend attempt */
- CEPH_OSD_FLAG_READ = 16, /* op may read */
- CEPH_OSD_FLAG_WRITE = 32, /* op may write */
- CEPH_OSD_FLAG_ORDERSNAP = 64, /* EOLDSNAP if snapc is out of order */
- CEPH_OSD_FLAG_PEERSTAT = 128, /* msg includes osd_peer_stat */
- CEPH_OSD_FLAG_BALANCE_READS = 256,
- CEPH_OSD_FLAG_PARALLELEXEC = 512, /* execute op in parallel */
- CEPH_OSD_FLAG_PGOP = 1024, /* pg op, no object */
- CEPH_OSD_FLAG_EXEC = 2048, /* op may exec */
- CEPH_OSD_FLAG_EXEC_PUBLIC = 4096, /* op may exec (public) */
- CEPH_OSD_FLAG_LOCALIZE_READS = 8192, /* read from nearby replica, if any */
+ CEPH_OSD_FLAG_ACK = 0x0001, /* want (or is) "ack" ack */
+ CEPH_OSD_FLAG_ONNVRAM = 0x0002, /* want (or is) "onnvram" ack */
+ CEPH_OSD_FLAG_ONDISK = 0x0004, /* want (or is) "ondisk" ack */
+ CEPH_OSD_FLAG_RETRY = 0x0008, /* resend attempt */
+ CEPH_OSD_FLAG_READ = 0x0010, /* op may read */
+ CEPH_OSD_FLAG_WRITE = 0x0020, /* op may write */
+ CEPH_OSD_FLAG_ORDERSNAP = 0x0040, /* EOLDSNAP if snapc is out of order */
+ CEPH_OSD_FLAG_PEERSTAT = 0x0080, /* msg includes osd_peer_stat */
+ CEPH_OSD_FLAG_BALANCE_READS = 0x0100,
+ CEPH_OSD_FLAG_PARALLELEXEC = 0x0200, /* execute op in parallel */
+ CEPH_OSD_FLAG_PGOP = 0x0400, /* pg op, no object */
+ CEPH_OSD_FLAG_EXEC = 0x0800, /* op may exec */
+ CEPH_OSD_FLAG_EXEC_PUBLIC = 0x1000, /* op may exec (public) */
+ CEPH_OSD_FLAG_LOCALIZE_READS = 0x2000, /* read from nearby replica, if any */
+ CEPH_OSD_FLAG_OBJ_LOCATOR = 0x4000, /* read from nearby replica, if any */
};
enum {
vector<snapid_t> snaps;
osd_peer_stat_t peer_stat;
int rmw_flags;
+ object_locator_t oloc;
friend class MOSDOpReply;
pg_t get_pg() const { return pg_t(head.layout.ol_pgid); }
//ceph_object_layout get_layout() { return head.layout; }
object_locator_t get_object_locator() const {
- pg_t pgid = get_pg();
- return object_locator_t(pgid.pool(), pgid.preferred());
+ if ((int32_t)oloc.pool != -1)
+ return oloc;
+ else {
+ pg_t pgid = get_pg();
+ return object_locator_t(pgid.pool(), pgid.preferred());
+ }
}
epoch_t get_map_epoch() { return head.osdmap_epoch; }
memset(&head, 0, sizeof(head));
set_tid(tid);
head.client_inc = inc;
- head.layout = ol;
+ set_layout(ol);
head.osdmap_epoch = mapepoch;
head.flags = flags;
}
~MOSDOp() {}
public:
- void set_layout(const ceph_object_layout& l) { head.layout = l; }
+ void set_layout(const ceph_object_layout& l) {
+ head.layout = l;
+ pg_t pgid = get_pg();
+ }
+ void set_locator(const object_locator_t& ol) {
+ oloc = ol;
+ head.flags = head.flags | CEPH_OSD_FLAG_OBJ_LOCATOR;
+ }
void set_version(eversion_t v) { head.reassert_version = v; }
void set_mtime(utime_t mt) { head.mtime = mt; }
::encode_nohead(snaps, payload);
if (head.flags & CEPH_OSD_FLAG_PEERSTAT)
::encode(peer_stat, payload);
+ if (head.flags & CEPH_OSD_FLAG_OBJ_LOCATOR)
+ ::encode(oloc, payload);
}
virtual void decode_payload() {
decode_nohead(head.num_snaps, snaps, p);
if (head.flags & CEPH_OSD_FLAG_PEERSTAT)
::decode(peer_stat, p);
+ if (head.flags & CEPH_OSD_FLAG_OBJ_LOCATOR)
+ ::decode(oloc, p);
}
if (head.snapid != CEPH_NOSNAP)
out << "@" << snapid_t((uint64_t)head.snapid);
+ if (oloc.key.size())
+ out << " " << oloc;
+
out << " " << ops;
out << " " << pg_t(head.layout.ol_pgid);
if (is_retry_attempt()) out << " RETRY";