};
/** @} */
+/**
+ * @name Alloc hint flags
+ * Flags for rados_write_op_alloc_hint2() and rados_set_alloc_hint2()
+ * indicating future IO patterns.
+ * @{
+ */
+enum {
+ LIBRADOS_ALLOC_HINT_SEQUENTIAL_WRITE = 1,
+ LIBRADOS_ALLOC_HINT_RANDOM_WRITE = 2,
+ LIBRADOS_ALLOC_HINT_FLAG_SEQUENTIAL_READ = 4,
+ LIBRADOS_ALLOC_HINT_FLAG_RANDOM_READ = 8,
+ LIBRADOS_ALLOC_HINT_FLAG_APPEND_ONLY = 16,
+ LIBRADOS_ALLOC_HINT_FLAG_IMMUTABLE = 32,
+ LIBRADOS_ALLOC_HINT_FLAG_SHORTLIVED = 64,
+ LIBRADOS_ALLOC_HINT_FLAG_LONGLIVED = 128,
+};
+/** @} */
+
/*
* snap id contants
*/
uint64_t expected_object_size,
uint64_t expected_write_size);
+/**
+ * Set allocation hint for an object
+ *
+ * This is an advisory operation, it will always succeed (as if it was
+ * submitted with a LIBRADOS_OP_FLAG_FAILOK flag set) and is not
+ * guaranteed to do anything on the backend.
+ *
+ * @param io the pool the object is in
+ * @param o the name of the object
+ * @param expected_object_size expected size of the object, in bytes
+ * @param expected_write_size expected size of writes to the object, in bytes
+ * @param flags hints about future IO patterns
+ * @returns 0 on success, negative error code on failure
+ */
+CEPH_RADOS_API int rados_set_alloc_hint2(rados_ioctx_t io, const char *o,
+ uint64_t expected_object_size,
+ uint64_t expected_write_size,
+ uint32_t flags);
+
/** @} Hints */
/**
uint64_t expected_object_size,
uint64_t expected_write_size);
+/**
+ * Set allocation hint for an object
+ *
+ * @param write_op operation to add this action to
+ * @param expected_object_size expected size of the object, in bytes
+ * @param expected_write_size expected size of writes to the object, in bytes
+ * @param flags hints about future IO patterns
+ */
+CEPH_RADOS_API void rados_write_op_set_alloc_hint2(rados_write_op_t write_op,
+ uint64_t expected_object_size,
+ uint64_t expected_write_size,
+ uint32_t flags);
+
/**
* Perform a write operation synchronously
* @param write_op operation to perform
OPERATION_FULL_TRY = LIBRADOS_OPERATION_FULL_TRY,
};
+ /*
+ * Alloc hint flags for the alloc_hint operation.
+ */
+ enum AllocHintFlags {
+ ALLOC_HINT_SEQUENTIAL_WRITE = 1,
+ ALLOC_HINT_RANDOM_WRITE = 2,
+ ALLOC_HINT_FLAG_SEQUENTIAL_READ = 4,
+ ALLOC_HINT_FLAG_RANDOM_READ = 8,
+ ALLOC_HINT_FLAG_APPEND_ONLY = 16,
+ ALLOC_HINT_FLAG_IMMUTABLE = 32,
+ ALLOC_HINT_FLAG_SHORTLIVED = 64,
+ ALLOC_HINT_FLAG_LONGLIVED = 128,
+ };
+
/*
* ObjectOperation : compound object operation
* Batch multiple object operations into a single request, to be applied
*
* @param expected_object_size expected size of the object, in bytes
* @param expected_write_size expected size of writes to the object, in bytes
+ * @param flags flags ()
*/
void set_alloc_hint(uint64_t expected_object_size,
uint64_t expected_write_size);
+ void set_alloc_hint2(uint64_t expected_object_size,
+ uint64_t expected_write_size,
+ uint32_t flags);
/**
* Pin/unpin an object in cache tier
int set_alloc_hint(const std::string& o,
uint64_t expected_object_size,
uint64_t expected_write_size);
+ int set_alloc_hint2(const std::string& o,
+ uint64_t expected_object_size,
+ uint64_t expected_write_size,
+ uint32_t flags);
// assert version for next sync operations
void set_assert_version(uint64_t ver);
int librados::IoCtxImpl::set_alloc_hint(const object_t& oid,
uint64_t expected_object_size,
- uint64_t expected_write_size)
+ uint64_t expected_write_size,
+ uint32_t flags)
{
::ObjectOperation wr;
prepare_assert_ops(&wr);
- wr.set_alloc_hint(expected_object_size, expected_write_size);
+ wr.set_alloc_hint(expected_object_size, expected_write_size, flags);
return operate(oid, &wr, NULL);
}
int set_alloc_hint(const object_t& oid,
uint64_t expected_object_size,
- uint64_t expected_write_size);
+ uint64_t expected_write_size,
+ uint32_t flags);
version_t last_version();
void set_assert_version(uint64_t ver);
uint64_t expected_write_size)
{
::ObjectOperation *o = &impl->o;
- o->set_alloc_hint(expected_object_size, expected_write_size);
+ o->set_alloc_hint(expected_object_size, expected_write_size, 0);
+}
+void librados::ObjectWriteOperation::set_alloc_hint2(
+ uint64_t expected_object_size,
+ uint64_t expected_write_size,
+ uint32_t flags)
+{
+ ::ObjectOperation *o = &impl->o;
+ o->set_alloc_hint(expected_object_size, expected_write_size, flags);
}
void librados::ObjectWriteOperation::cache_pin()
{
object_t oid(o);
return io_ctx_impl->set_alloc_hint(oid, expected_object_size,
- expected_write_size);
+ expected_write_size, 0);
+}
+
+int librados::IoCtx::set_alloc_hint2(const std::string& o,
+ uint64_t expected_object_size,
+ uint64_t expected_write_size,
+ uint32_t flags)
+{
+ object_t oid(o);
+ return io_ctx_impl->set_alloc_hint(oid, expected_object_size,
+ expected_write_size, flags);
}
void librados::IoCtx::set_assert_version(uint64_t ver)
tracepoint(librados, rados_set_alloc_hint_enter, io, o, expected_object_size, expected_write_size);
librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
object_t oid(o);
- int retval = ctx->set_alloc_hint(oid, expected_object_size, expected_write_size);
+ int retval = ctx->set_alloc_hint(oid, expected_object_size,
+ expected_write_size, 0);
tracepoint(librados, rados_set_alloc_hint_exit, retval);
return retval;
}
+extern "C" int rados_set_alloc_hint2(rados_ioctx_t io, const char *o,
+ uint64_t expected_object_size,
+ uint64_t expected_write_size,
+ uint32_t flags)
+{
+ tracepoint(librados, rados_set_alloc_hint2_enter, io, o, expected_object_size, expected_write_size, flags);
+ librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
+ object_t oid(o);
+ int retval = ctx->set_alloc_hint(oid, expected_object_size,
+ expected_write_size, flags);
+ tracepoint(librados, rados_set_alloc_hint2_exit, retval);
+ return retval;
+}
+
extern "C" int rados_lock_exclusive(rados_ioctx_t io, const char * o,
const char * name, const char * cookie,
const char * desc, struct timeval * duration,
{
tracepoint(librados, rados_write_op_set_alloc_hint_enter, write_op, expected_object_size, expected_write_size);
((::ObjectOperation *)write_op)->set_alloc_hint(expected_object_size,
- expected_write_size);
+ expected_write_size, 0);
tracepoint(librados, rados_write_op_set_alloc_hint_exit);
}
+extern "C" void rados_write_op_set_alloc_hint2(rados_write_op_t write_op,
+ uint64_t expected_object_size,
+ uint64_t expected_write_size,
+ uint32_t flags)
+{
+ tracepoint(librados, rados_write_op_set_alloc_hint2_enter, write_op, expected_object_size, expected_write_size, flags);
+ ((::ObjectOperation *)write_op)->set_alloc_hint(expected_object_size,
+ expected_write_size,
+ flags);
+ tracepoint(librados, rados_write_op_set_alloc_hint2_exit);
+}
+
extern "C" int rados_write_op_operate(rados_write_op_t write_op,
rados_ioctx_t io,
const char *oid,
::encode(cookie, osd_op.indata);
}
void add_alloc_hint(int op, uint64_t expected_object_size,
- uint64_t expected_write_size) {
+ uint64_t expected_write_size,
+ uint32_t flags) {
OSDOp& osd_op = add_op(op);
osd_op.op.alloc_hint.expected_object_size = expected_object_size;
osd_op.op.alloc_hint.expected_write_size = expected_write_size;
+ osd_op.op.alloc_hint.flags = flags;
}
// ------
}
void set_alloc_hint(uint64_t expected_object_size,
- uint64_t expected_write_size ) {
+ uint64_t expected_write_size,
+ uint32_t flags) {
add_alloc_hint(CEPH_OSD_OP_SETALLOCHINT, expected_object_size,
- expected_write_size);
+ expected_write_size, flags);
// CEPH_OSD_OP_SETALLOCHINT op is advisory and therefore deemed
// not worth a feature bit. Set FAILOK per-op flag to make
)
)
+TRACEPOINT_EVENT(librados, rados_set_alloc_hint2_enter,
+ TP_ARGS(
+ rados_ioctx_t, ioctx,
+ const char*, oid,
+ uint64_t, expected_object_size,
+ uint64_t, expected_write_size,
+ uint32_t, flags),
+ TP_FIELDS(
+ ctf_integer_hex(rados_ioctx_t, ioctx, ioctx)
+ ctf_string(oid, oid)
+ ctf_integer(uint64_t, expected_object_size, expected_object_size)
+ ctf_integer(uint64_t, expected_write_size, expected_write_size)
+ ctf_integer(uint32_t, flags, flags)
+ )
+)
+
+TRACEPOINT_EVENT(librados, rados_set_alloc_hint2_exit,
+ TP_ARGS(
+ int, retval),
+ TP_FIELDS(
+ ctf_integer(int, retval, retval)
+ )
+)
+
TRACEPOINT_EVENT(librados, rados_lock_exclusive_enter,
TP_ARGS(
rados_ioctx_t, ioctx,
TP_FIELDS()
)
+TRACEPOINT_EVENT(librados, rados_write_op_set_alloc_hint2_enter,
+ TP_ARGS(
+ rados_write_op_t, op,
+ uint64_t, expected_object_size,
+ uint64_t, expected_write_size,
+ uint32_t, flags),
+ TP_FIELDS(
+ ctf_integer_hex(rados_write_op_t, op, op)
+ ctf_integer(uint64_t, expected_object_size, expected_object_size)
+ ctf_integer(uint64_t, expected_write_size, expected_write_size)
+ ctf_integer(uint32_t, flags, flags)
+ )
+)
+
+TRACEPOINT_EVENT(librados, rados_write_op_set_alloc_hint2_exit,
+ TP_ARGS(),
+ TP_FIELDS()
+)
+
TRACEPOINT_EVENT(librados, rados_write_op_operate_enter,
TP_ARGS(
rados_write_op_t, op,