mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-02-11 14:26:34 +00:00
ceph: always send truncation info with read and write osd ops
This fixes a bug where the read/write ops arrive the osd after a following truncation request. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
parent
0f26c4b21b
commit
0c948992a0
@ -38,7 +38,7 @@
|
|||||||
#define CEPH_OSD_PROTOCOL 8 /* cluster internal */
|
#define CEPH_OSD_PROTOCOL 8 /* cluster internal */
|
||||||
#define CEPH_MDS_PROTOCOL 9 /* cluster internal */
|
#define CEPH_MDS_PROTOCOL 9 /* cluster internal */
|
||||||
#define CEPH_MON_PROTOCOL 5 /* cluster internal */
|
#define CEPH_MON_PROTOCOL 5 /* cluster internal */
|
||||||
#define CEPH_OSDC_PROTOCOL 23 /* server/client */
|
#define CEPH_OSDC_PROTOCOL 24 /* server/client */
|
||||||
#define CEPH_MDSC_PROTOCOL 32 /* server/client */
|
#define CEPH_MDSC_PROTOCOL 32 /* server/client */
|
||||||
#define CEPH_MONC_PROTOCOL 15 /* server/client */
|
#define CEPH_MONC_PROTOCOL 15 /* server/client */
|
||||||
|
|
||||||
|
@ -199,11 +199,9 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
|
|||||||
struct ceph_osd_request_head *head;
|
struct ceph_osd_request_head *head;
|
||||||
struct ceph_osd_op *op;
|
struct ceph_osd_op *op;
|
||||||
void *p;
|
void *p;
|
||||||
int do_trunc = truncate_seq && (off + *plen > truncate_size);
|
int num_op = 1 + do_sync;
|
||||||
int num_op = 1 + do_sync + do_trunc;
|
|
||||||
size_t msg_size = sizeof(*head) + num_op*sizeof(*op);
|
size_t msg_size = sizeof(*head) + num_op*sizeof(*op);
|
||||||
int err, i;
|
int err, i;
|
||||||
u64 prevofs;
|
|
||||||
|
|
||||||
if (use_mempool) {
|
if (use_mempool) {
|
||||||
req = mempool_alloc(osdc->req_mempool, GFP_NOFS);
|
req = mempool_alloc(osdc->req_mempool, GFP_NOFS);
|
||||||
@ -268,22 +266,14 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
|
|||||||
req->r_request->hdr.data_len = cpu_to_le32(*plen);
|
req->r_request->hdr.data_len = cpu_to_le32(*plen);
|
||||||
op->payload_len = cpu_to_le32(*plen);
|
op->payload_len = cpu_to_le32(*plen);
|
||||||
}
|
}
|
||||||
|
op->extent.truncate_size = cpu_to_le64(truncate_size);
|
||||||
|
op->extent.truncate_seq = cpu_to_le32(truncate_seq);
|
||||||
|
|
||||||
/* fill in oid */
|
/* fill in oid */
|
||||||
head->object_len = cpu_to_le32(req->r_oid_len);
|
head->object_len = cpu_to_le32(req->r_oid_len);
|
||||||
memcpy(p, req->r_oid, req->r_oid_len);
|
memcpy(p, req->r_oid, req->r_oid_len);
|
||||||
p += req->r_oid_len;
|
p += req->r_oid_len;
|
||||||
|
|
||||||
/* additional ops */
|
|
||||||
if (do_trunc) {
|
|
||||||
op++;
|
|
||||||
op->op = cpu_to_le16(opcode == CEPH_OSD_OP_READ ?
|
|
||||||
CEPH_OSD_OP_MASKTRUNC : CEPH_OSD_OP_SETTRUNC);
|
|
||||||
op->trunc.truncate_seq = cpu_to_le32(truncate_seq);
|
|
||||||
prevofs = le64_to_cpu((op-1)->extent.offset);
|
|
||||||
op->trunc.truncate_size = cpu_to_le64(truncate_size -
|
|
||||||
(off-prevofs));
|
|
||||||
}
|
|
||||||
if (do_sync) {
|
if (do_sync) {
|
||||||
op++;
|
op++;
|
||||||
op->op = cpu_to_le16(CEPH_OSD_OP_STARTSYNC);
|
op->op = cpu_to_le16(CEPH_OSD_OP_STARTSYNC);
|
||||||
|
@ -304,15 +304,13 @@ struct ceph_osd_op {
|
|||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
__le64 offset, length;
|
__le64 offset, length;
|
||||||
|
__le64 truncate_size;
|
||||||
|
__le32 truncate_seq;
|
||||||
} __attribute__ ((packed)) extent;
|
} __attribute__ ((packed)) extent;
|
||||||
struct {
|
struct {
|
||||||
__le32 name_len;
|
__le32 name_len;
|
||||||
__le32 value_len;
|
__le32 value_len;
|
||||||
} __attribute__ ((packed)) xattr;
|
} __attribute__ ((packed)) xattr;
|
||||||
struct {
|
|
||||||
__le64 truncate_size;
|
|
||||||
__le32 truncate_seq;
|
|
||||||
} __attribute__ ((packed)) trunc;
|
|
||||||
struct {
|
struct {
|
||||||
__u8 class_len;
|
__u8 class_len;
|
||||||
__u8 method_len;
|
__u8 method_len;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user