Skip to content

Commit 69dd3b3

Browse files
jtlaytonidryomov
authored andcommitted
libceph: add CEPH_OSD_OP_ASSERT_VER support
...and record the user_version in the reply in a new field in ceph_osd_request, so we can populate the assert_ver appropriately. Shuffle the fields a bit too so that the new field fits in an existing hole on x86_64. Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Xiubo Li <xiubli@redhat.com> Reviewed-and-tested-by: Luís Henriques <lhenriques@suse.de> Reviewed-by: Milind Changire <mchangir@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent 77cdb7e commit 69dd3b3

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

include/linux/ceph/osd_client.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ struct ceph_osd_req_op {
198198
u32 src_fadvise_flags;
199199
struct ceph_osd_data osd_data;
200200
} copy_from;
201+
struct {
202+
u64 ver;
203+
} assert_ver;
201204
};
202205
};
203206

@@ -252,6 +255,7 @@ struct ceph_osd_request {
252255
struct ceph_osd_client *r_osdc;
253256
struct kref r_kref;
254257
bool r_mempool;
258+
bool r_linger; /* don't resend on failure */
255259
struct completion r_completion; /* private to osd_client.c */
256260
ceph_osdc_callback_t r_callback;
257261

@@ -264,9 +268,9 @@ struct ceph_osd_request {
264268
struct ceph_snap_context *r_snapc; /* for writes */
265269
struct timespec64 r_mtime; /* ditto */
266270
u64 r_data_offset; /* ditto */
267-
bool r_linger; /* don't resend on failure */
268271

269272
/* internal */
273+
u64 r_version; /* data version sent in reply */
270274
unsigned long r_stamp; /* jiffies, send or check time */
271275
unsigned long r_start_stamp; /* jiffies */
272276
ktime_t r_start_latency; /* ktime_t */

include/linux/ceph/rados.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,10 @@ struct ceph_osd_op {
523523
struct {
524524
__le64 cookie;
525525
} __attribute__ ((packed)) notify;
526+
struct {
527+
__le64 unused;
528+
__le64 ver;
529+
} __attribute__ ((packed)) assert_ver;
526530
struct {
527531
__le64 offset, length;
528532
__le64 src_offset;

net/ceph/osd_client.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,10 @@ static u32 osd_req_encode_op(struct ceph_osd_op *dst,
10481048
dst->copy_from.src_fadvise_flags =
10491049
cpu_to_le32(src->copy_from.src_fadvise_flags);
10501050
break;
1051+
case CEPH_OSD_OP_ASSERT_VER:
1052+
dst->assert_ver.unused = cpu_to_le64(0);
1053+
dst->assert_ver.ver = cpu_to_le64(src->assert_ver.ver);
1054+
break;
10511055
default:
10521056
pr_err("unsupported osd opcode %s\n",
10531057
ceph_osd_op_name(src->op));
@@ -3859,6 +3863,7 @@ static void handle_reply(struct ceph_osd *osd, struct ceph_msg *msg)
38593863
* one (type of) reply back.
38603864
*/
38613865
WARN_ON(!(m.flags & CEPH_OSD_FLAG_ONDISK));
3866+
req->r_version = m.user_version;
38623867
req->r_result = m.result ?: data_len;
38633868
finish_request(req);
38643869
mutex_unlock(&osd->lock);

0 commit comments

Comments
 (0)