This is in preperation for supporting sparse and sync reads in EC.
Such ops will only be supported for "balance reads".
Signed-off-by: Alex Ainscow <aainscow@uk.ibm.com>
return true;
}
- if ((m.get_flags() & (CEPH_OSD_FLAG_BALANCE_READS |
- CEPH_OSD_FLAG_LOCALIZE_READS))
+ if ((m.get_flags() & CEPH_OSD_FLAG_DIRECT_READ)
&& !is_primary()
&& (m.get_map_epoch() <
peering_state.get_info().history.same_interval_since))
CEPH_OSD_FLAG_IGNORE_REDIRECT = 0x2000000, /* ignore redirection */
CEPH_OSD_FLAG_RETURNVEC = 0x4000000, /* allow overall result >= 0, and return >= 0 and buffer for each op in opvec */
CEPH_OSD_FLAG_SUPPORTSPOOLEIO = 0x8000000, /* client understands pool EIO flag */
+ CEPH_OSD_FLAG_EC_DIRECT_READ = 0x10000000, /* Erasure code doing a partial read direct to OSD. */
};
+// Indicates an IO which is direct-to-OSD and may not be on the primary.
+#define CEPH_OSD_FLAG_DIRECT_READ (CEPH_OSD_FLAG_BALANCE_READS | CEPH_OSD_FLAG_LOCALIZE_READS | CEPH_OSD_FLAG_EC_DIRECT_READ)
+
enum {
CEPH_OSD_OP_FLAG_EXCL = 0x1, /* EXCL object create */
CEPH_OSD_OP_FLAG_FAILOK = 0x2, /* continue despite failure */
bool need_skip_handle_cache() const { return op_info.need_skip_handle_cache(); }
bool need_skip_promote() const { return op_info.need_skip_promote(); }
bool allows_returnvec() const { return op_info.allows_returnvec(); }
+ bool ec_direct_read() const { return op_info.ec_direct_read(); }
+ void set_ec_direct_read() { return op_info.set_ec_direct_read(); }
std::vector<OpInfo::ClassInfo> classes() const {
return op_info.get_classes();
return true;
}
- if ((m->get_flags() & (CEPH_OSD_FLAG_BALANCE_READS |
- CEPH_OSD_FLAG_LOCALIZE_READS)) &&
+ if ((m->get_flags() & (CEPH_OSD_FLAG_DIRECT_READ)) &&
!is_primary() &&
m->get_map_epoch() < info.history.same_interval_since) {
// Note: the Objecter will resend on interval change without the primary
}
// check for op with rwordered and rebalance or localize reads
- if ((m->has_flag(CEPH_OSD_FLAG_BALANCE_READS) || m->has_flag(CEPH_OSD_FLAG_LOCALIZE_READS)) &&
- op->rwordered()) {
+ if (m->has_flag(CEPH_OSD_FLAG_DIRECT_READ) && op->rwordered()) {
dout(4) << __func__ << ": rebelance or localized reads with rwordered not allowed "
<< *m << dendl;
osd->reply_op_error(op, -EINVAL);
return;
}
- if ((m->get_flags() & (CEPH_OSD_FLAG_BALANCE_READS |
- CEPH_OSD_FLAG_LOCALIZE_READS)) &&
+ if (m->get_flags() & CEPH_OSD_FLAG_EC_DIRECT_READ) {
+ if (is_primary() || is_nonprimary()) {
+ op->set_ec_direct_read();
+ } else {
+ osd->handle_misdirected_op(this, op);
+ return;
+ }
+ } else if ((m->get_flags() & (CEPH_OSD_FLAG_BALANCE_READS |
+ CEPH_OSD_FLAG_LOCALIZE_READS)) &&
op->may_read() &&
!(op->may_write() || op->may_cache())) {
// balanced reads; any replica will do
bool OpInfo::allows_returnvec() const {
return check_rmw(CEPH_OSD_RMW_FLAG_RETURNVEC);
}
+bool OpInfo::ec_direct_read() const {
+ return check_rmw(CEPH_OSD_RMW_FLAG_EC_DIRECT_READ);
+}
/**
* may_read_data()
*
void OpInfo::set_force_rwordered() { set_rmw_flags(CEPH_OSD_RMW_FLAG_RWORDERED); }
void OpInfo::set_returnvec() { set_rmw_flags(CEPH_OSD_RMW_FLAG_RETURNVEC); }
void OpInfo::set_read_data() { set_rmw_flags(CEPH_OSD_RMW_FLAG_READ_DATA); }
+void OpInfo::set_ec_direct_read() { set_rmw_flags(CEPH_OSD_RMW_FLAG_EC_DIRECT_READ); }
int OpInfo::set_from_op(
bool need_skip_handle_cache() const;
bool need_skip_promote() const;
bool allows_returnvec() const;
+ bool ec_direct_read() const;
void set_read();
void set_write();
void set_force_rwordered();
void set_returnvec();
void set_read_data();
+ void set_ec_direct_read();
int set_from_op(
const MOSDOp *m,
case CEPH_OSD_FLAG_IGNORE_REDIRECT: return "ignore_redirect";
case CEPH_OSD_FLAG_RETURNVEC: return "returnvec";
case CEPH_OSD_FLAG_SUPPORTSPOOLEIO: return "supports_pool_eio";
+ case CEPH_OSD_FLAG_EC_DIRECT_READ: return "ec_direct_read";
default: return "???";
}
}
CEPH_OSD_RMW_FLAG_RWORDERED = (1 << 10),
CEPH_OSD_RMW_FLAG_RETURNVEC = (1 << 11),
CEPH_OSD_RMW_FLAG_READ_DATA = (1 << 12),
+ CEPH_OSD_RMW_FLAG_EC_DIRECT_READ = (1 << 13),
};