--- /dev/null
+
+* The librados::clone_info_t::HEAD constant has been replaced with librados::SNAP_HEAD, with
+ a different value that matches the internal constants. This only affects the brand-new
+ list_snaps() interface that was introduced in v0.59.
\ No newline at end of file
/** @endcond */
/** @} */
+/*
+ * snap id contants
+ */
+#define LIBRADOS_SNAP_HEAD ((uint64_t)(-2))
+#define LIBRADOS_SNAP_DIR ((uint64_t)(-1))
+
/**
* @typedef rados_t
*
* snapshot.
*
* @param io the io context to change
- * @param snap the id of the snapshot to set, or CEPH_NOSNAP for no
+ * @param snap the id of the snapshot to set, or LIBRADOS_SNAP_HEAD for no
* snapshot (i.e. normal operation)
*/
void rados_ioctx_snap_set_read(rados_ioctx_t io, rados_snap_t snap);
* @param len length of the data, in bytes
* @param off byte offset in the object to begin writing at
* @returns 0 on success, -EROFS if the io context specifies a snap_seq
- * other than CEPH_NOSNAP
+ * other than LIBRADOS_SNAP_HEAD
*/
int rados_aio_write(rados_ioctx_t io, const char *oid,
rados_completion_t completion,
* @param buf the data to append
* @param len length of buf (in bytes)
* @returns 0 on success, -EROFS if the io context specifies a snap_seq
- * other than CEPH_NOSNAP
+ * other than LIBRADOS_SNAP_HEAD
*/
int rados_aio_append(rados_ioctx_t io, const char *oid,
rados_completion_t completion,
* @param buf data to write
* @param len length of the data, in bytes
* @returns 0 on success, -EROFS if the io context specifies a snap_seq
- * other than CEPH_NOSNAP
+ * other than LIBRADOS_SNAP_HEAD
*/
int rados_aio_write_full(rados_ioctx_t io, const char *oid,
rados_completion_t completion,
* @param oid the name of the object
* @param completion what to do when the remove is safe and complete
* @returns 0 on success, -EROFS if the io context specifies a snap_seq
- * other than CEPH_NOSNAP
+ * other than LIBRADOS_SNAP_HEAD
*/
int rados_aio_remove(rados_ioctx_t io, const char *oid,
rados_completion_t completion);
* list snapshot clones associated with a logical object
*
* This will include a record for each version of the object,
- * include the "HEAD" (which will have a cloneid of
- * librados::clone_info_t::HEAD). Each clone includes a vector
- * of snap ids for which it is defined to exist.
+ * include the "HEAD" (which will have a cloneid of SNAP_HEAD).
+ * Each clone includes a vector of snap ids for which it is
+ * defined to exist.
*
* NOTE: this operation must be submitted from an IoCtx with a
- * read snapid of CEPH_SNAPDIR for reliable results.
+ * read snapid of SNAP_DIR for reliable results.
*
* @param out_snaps [out] pointer to resulting snap_set_t
* @param prval [out] place error code in prval upon completion
* @param oid the name of the object
* @param completion what to do when the remove is safe and complete
* @returns 0 on success, -EROFS if the io context specifies a snap_seq
- * other than CEPH_NOSNAP
+ * other than SNAP_HEAD
*/
int aio_remove(const std::string& oid, AioCompletion *c);
typedef uint64_t snap_t;
+enum {
+ SNAP_HEAD = (uint64_t)(-2),
+ SNAP_DIR = (uint64_t)(-1)
+};
+
struct clone_info_t {
- static const snap_t HEAD = ((snap_t)-1);
snap_t cloneid;
std::vector<snap_t> snaps; // ascending
std::vector< std::pair<uint64_t,uint64_t> > overlap; // with next newest
bool end_exists;
calc_snap_set_diff(ictx->cct, snap_set,
from_snap_id,
- end_snap_id == CEPH_NOSNAP ? librados::clone_info_t::HEAD : end_snap_id,
+ end_snap_id,
&diff, &end_exists);
ldout(ictx->cct, 20) << " diff " << diff << " end_exists=" << end_exists << dendl;
if (diff.empty())
if (ssc->snapset.head_exists) {
assert(obs.exists);
clone_info ci;
- ci.cloneid = clone_info::HEAD;
+ ci.cloneid = CEPH_NOSNAP;
//Size for HEAD is oi.size
ci.size = oi.size;
#include "PG.h"
#include "OSDMap.h"
-const snapid_t clone_info::HEAD((uint64_t)-1);
-
// -- osd_reqid_t --
void osd_reqid_t::encode(bufferlist &bl) const
{
WRITE_CLASS_ENCODER(obj_list_watch_response_t)
struct clone_info {
- static const snapid_t HEAD;
-
snapid_t cloneid;
vector<snapid_t> snaps; // ascending
vector< pair<uint64_t,uint64_t> > overlap;
DECODE_FINISH(bl);
}
void dump(Formatter *f) const {
- if (cloneid == HEAD)
+ if (cloneid == CEPH_NOSNAP)
f->dump_string("cloneid", "HEAD");
else
f->dump_unsigned("cloneid", cloneid.val);
o.back()->overlap.push_back(pair<uint64_t,uint64_t>(8192,4096));
o.back()->size = 16384;
o.push_back(new clone_info);
- o.back()->cloneid = HEAD;
+ o.back()->cloneid = CEPH_NOSNAP;
o.back()->size = 32768;
}
};
cl.overlap.push_back(pair<uint64_t,uint64_t>(8192,4096));
cl.size = 16384;
o.back()->clones.push_back(cl);
- cl.cloneid = clone_info::HEAD;
+ cl.cloneid = CEPH_NOSNAP;
cl.snaps.clear();
cl.overlap.clear();
cl.size = 32768;
// include itself in the snaps list
librados::snap_t a, b;
b = r->cloneid;
- if (b == librados::clone_info_t::HEAD) {
+ if (b == librados::SNAP_HEAD) {
// head is valid starting from right after the last seen seq
a = snap_set.seq + 1;
} else {
if (formatter) formatter->open_object_section("clone");
- if (ci->cloneid == clone_info_t::HEAD) {
+ if (ci->cloneid == librados::SNAP_HEAD) {
if (formatter)
formatter->dump_string("id", "head");
else
cout << "\t" << ci->size;
}
- if (ci->cloneid != clone_info_t::HEAD) {
+ if (ci->cloneid != librados::SNAP_HEAD) {
if (formatter)
formatter->open_array_section("overlaps");
else
snap_set_t ss;
- snap_t head = clone_info_t::HEAD;
+ snap_t head = SNAP_HEAD;
ASSERT_EQ(0, ioctx.list_snaps("foo", &ss));
ASSERT_EQ(1u, ss.clones.size());
ASSERT_EQ(head, ss.clones[0].cloneid);
ASSERT_EQ((int)sizeof(buf), ioctx.write("foo", bl1, sizeof(buf), bufsize*8));
snap_set_t ss;
- snap_t head = clone_info_t::HEAD;
+ snap_t head = SNAP_HEAD;
ASSERT_EQ(0, ioctx.list_snaps("foo", &ss));
ASSERT_EQ(1u, ss.clones.size());
ASSERT_EQ(head, ss.clones[0].cloneid);