Implement CAS writes
From now on, reads will return the server-side object version numbers and writes and deletes will have an additional "version" parameter which, if set to a non-zero value, will be atomically compared with the current version of the object plus 1 and the modification will fail if it doesn't match. This feature opens the road to correct online flattening of snapshot layers and other interesting things.
This commit is contained in:
@@ -191,6 +191,9 @@ struct __attribute__((__packed__)) osd_op_rw_t
|
||||
uint32_t flags;
|
||||
// inode metadata revision
|
||||
uint64_t meta_revision;
|
||||
// object version for atomic "CAS" (compare-and-set) writes
|
||||
// writes and deletes fail with -EINTR if object version differs from (version-1)
|
||||
uint64_t version;
|
||||
};
|
||||
|
||||
struct __attribute__((__packed__)) osd_reply_rw_t
|
||||
@@ -199,6 +202,8 @@ struct __attribute__((__packed__)) osd_reply_rw_t
|
||||
// for reads: bitmap length
|
||||
uint32_t bitmap_len;
|
||||
uint32_t pad0;
|
||||
// for reads: object version
|
||||
uint64_t version;
|
||||
};
|
||||
|
||||
// sync to the primary OSD
|
||||
|
||||
Reference in New Issue
Block a user