diff options
Diffstat (limited to 'net/ceph')
-rw-r--r-- | net/ceph/osd_client.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index f782aca54daa..0eb417b44195 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -64,8 +64,7 @@ static int op_has_extent(int op) | |||
64 | * fill osd op in request message. | 64 | * fill osd op in request message. |
65 | */ | 65 | */ |
66 | static int calc_layout(struct ceph_file_layout *layout, u64 off, u64 *plen, | 66 | static int calc_layout(struct ceph_file_layout *layout, u64 off, u64 *plen, |
67 | struct ceph_osd_req_op *op, u64 *objnum, | 67 | u64 *objnum, u64 *objoff, u64 *objlen) |
68 | u64 *objoff, u64 *objlen) | ||
69 | { | 68 | { |
70 | u64 orig_len = *plen; | 69 | u64 orig_len = *plen; |
71 | int r; | 70 | int r; |
@@ -81,21 +80,6 @@ static int calc_layout(struct ceph_file_layout *layout, u64 off, u64 *plen, | |||
81 | orig_len - *plen, off, *plen); | 80 | orig_len - *plen, off, *plen); |
82 | } | 81 | } |
83 | 82 | ||
84 | if (op_has_extent(op->op)) { | ||
85 | u32 osize = le32_to_cpu(layout->fl_object_size); | ||
86 | op->extent.offset = *objoff; | ||
87 | op->extent.length = *objlen; | ||
88 | if (op->extent.truncate_size <= off - *objoff) { | ||
89 | op->extent.truncate_size = 0; | ||
90 | } else { | ||
91 | op->extent.truncate_size -= off - *objoff; | ||
92 | if (op->extent.truncate_size > osize) | ||
93 | op->extent.truncate_size = osize; | ||
94 | } | ||
95 | } | ||
96 | if (op->op == CEPH_OSD_OP_WRITE) | ||
97 | op->payload_len = *plen; | ||
98 | |||
99 | dout("calc_layout objnum=%llx %llu~%llu\n", *objnum, *objoff, *objlen); | 83 | dout("calc_layout objnum=%llx %llu~%llu\n", *objnum, *objoff, *objlen); |
100 | 84 | ||
101 | return 0; | 85 | return 0; |
@@ -594,11 +578,27 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, | |||
594 | req->r_flags = flags; | 578 | req->r_flags = flags; |
595 | 579 | ||
596 | /* calculate max write size */ | 580 | /* calculate max write size */ |
597 | r = calc_layout(layout, off, plen, ops, &objnum, &objoff, &objlen); | 581 | r = calc_layout(layout, off, plen, &objnum, &objoff, &objlen); |
598 | if (r < 0) { | 582 | if (r < 0) { |
599 | ceph_osdc_put_request(req); | 583 | ceph_osdc_put_request(req); |
600 | return ERR_PTR(r); | 584 | return ERR_PTR(r); |
601 | } | 585 | } |
586 | |||
587 | if (op_has_extent(ops[0].op)) { | ||
588 | u32 osize = le32_to_cpu(layout->fl_object_size); | ||
589 | ops[0].extent.offset = objoff; | ||
590 | ops[0].extent.length = objlen; | ||
591 | if (ops[0].extent.truncate_size <= off - objoff) { | ||
592 | ops[0].extent.truncate_size = 0; | ||
593 | } else { | ||
594 | ops[0].extent.truncate_size -= off - objoff; | ||
595 | if (ops[0].extent.truncate_size > osize) | ||
596 | ops[0].extent.truncate_size = osize; | ||
597 | } | ||
598 | } | ||
599 | if (ops[0].op == CEPH_OSD_OP_WRITE) | ||
600 | ops[0].payload_len = *plen; | ||
601 | |||
602 | req->r_file_layout = *layout; /* keep a copy */ | 602 | req->r_file_layout = *layout; /* keep a copy */ |
603 | 603 | ||
604 | snprintf(req->r_oid, sizeof(req->r_oid), "%llx.%08llx", | 604 | snprintf(req->r_oid, sizeof(req->r_oid), "%llx.%08llx", |