]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: add OPERATION_ORDER_READS_WRITES flag
authorSage Weil <sage@inktank.com>
Tue, 24 Sep 2013 19:48:07 +0000 (12:48 -0700)
committerSage Weil <sage@inktank.com>
Tue, 24 Sep 2013 19:48:07 +0000 (12:48 -0700)
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 <sage@inktank.com>
src/include/rados/librados.hpp
src/librados/librados.cc

index 94d3d23a82442e609fe432d908e321b241646fb1..358142c8cb4c2654bda0a84fd81f86cfd6aa1373 100644 (file)
@@ -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,
   };
 
   /*
index 852228ed3834f718feb81dd27c52a28e3036c162..63092d1093d99f60e2e1e5ea6768c9b2455be139 100644 (file)
@@ -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);