From: Sage Weil Date: Tue, 24 Sep 2013 19:48:07 +0000 (-0700) Subject: librados: add OPERATION_ORDER_READS_WRITES flag X-Git-Tag: v0.71~75^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3faf08f5f96ced6eecb3c2bc3a6b7bf4fc5a1b73;p=ceph.git librados: add OPERATION_ORDER_READS_WRITES flag This maps to the internal RWORDERED option, which indicates that a read should be ordered the same way a write is. Signed-off-by: Sage Weil --- diff --git a/src/include/rados/librados.hpp b/src/include/rados/librados.hpp index 94d3d23a8244..358142c8cb4c 100644 --- a/src/include/rados/librados.hpp +++ b/src/include/rados/librados.hpp @@ -133,11 +133,16 @@ namespace librados * BALANCE_READS and LOCALIZE_READS should only be used * when reading from data you're certain won't change, * like a snapshot, or where eventual consistency is ok. + * + * ORDER_READS_WRITES will order reads the same way writes are + * ordered (e.g., waiting for degraded objects). In particular, it + * will make a write followed by a read sequence be preserved. */ enum ObjectOperationGlobalFlags { OPERATION_NOFLAG = 0, OPERATION_BALANCE_READS = 1, OPERATION_LOCALIZE_READS = 2, + OPERATION_ORDER_READS_WRITES = 4, }; /* diff --git a/src/librados/librados.cc b/src/librados/librados.cc index 852228ed3834..63092d1093d9 100644 --- a/src/librados/librados.cc +++ b/src/librados/librados.cc @@ -958,6 +958,8 @@ int librados::IoCtx::aio_operate(const std::string& oid, AioCompletion *c, op_flags |= CEPH_OSD_FLAG_BALANCE_READS; if (flags & OPERATION_LOCALIZE_READS) op_flags |= CEPH_OSD_FLAG_LOCALIZE_READS; + if (flags & OPERATION_ORDER_READS_WRITES) + op_flags |= CEPH_OSD_FLAG_RWORDERED; return io_ctx_impl->aio_operate_read(obj, (::ObjectOperation*)o->impl, c->pc, op_flags, pbl);