From 17d6a993fc17d533460c5f40f3908c708e057c18 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 23 May 2024 18:45:17 +0200 Subject: Merging upstream version 18.2.3. Signed-off-by: Daniel Baumann --- src/osd/osd_op_util.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/osd/osd_op_util.cc') diff --git a/src/osd/osd_op_util.cc b/src/osd/osd_op_util.cc index a33e2f110..d400a94db 100644 --- a/src/osd/osd_op_util.cc +++ b/src/osd/osd_op_util.cc @@ -16,6 +16,7 @@ bool OpInfo::check_rmw(int flag) const { ceph_assert(rmw_flags != 0); return rmw_flags & flag; } +// Returns true if op performs a read (including of the object_info). bool OpInfo::may_read() const { return need_read_cap() || check_rmw(CEPH_OSD_RMW_FLAG_CLASS_READ); } @@ -51,6 +52,16 @@ bool OpInfo::need_skip_promote() const { bool OpInfo::allows_returnvec() const { return check_rmw(CEPH_OSD_RMW_FLAG_RETURNVEC); } +/** + * may_read_data() + * + * Returns true if op reads information other than the object_info. Requires that the + * osd flush any prior writes prior to servicing this op. Includes any information not + * cached by the osd in the object_info or snapset. + */ +bool OpInfo::may_read_data() const { + return check_rmw(CEPH_OSD_RMW_FLAG_READ_DATA); +} void OpInfo::set_rmw_flags(int flags) { rmw_flags |= flags; @@ -67,6 +78,7 @@ void OpInfo::set_skip_handle_cache() { set_rmw_flags(CEPH_OSD_RMW_FLAG_SKIP_HAND void OpInfo::set_skip_promote() { set_rmw_flags(CEPH_OSD_RMW_FLAG_SKIP_PROMOTE); } 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); } int OpInfo::set_from_op( @@ -108,8 +120,12 @@ int OpInfo::set_from_op( if (ceph_osd_op_mode_modify(iter->op.op)) set_write(); } - if (ceph_osd_op_mode_read(iter->op.op)) + if (ceph_osd_op_mode_read(iter->op.op)) { set_read(); + if (iter->op.op != CEPH_OSD_OP_STAT) { + set_read_data(); + } + } // set READ flag if there are src_oids if (iter->soid.oid.name.length()) @@ -202,6 +218,7 @@ int OpInfo::set_from_op( // watch state (and may return early if the watch exists) or, in // the case of ping, is simply a read op. set_read(); + set_read_data(); // fall through case CEPH_OSD_OP_NOTIFY: case CEPH_OSD_OP_NOTIFY_ACK: -- cgit v1.2.3