libceph: fix truncate size calculation
check the "not truncated yet" case Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com> Reviewed-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Родитель
eb845ff13a
Коммит
ccca4e37b1
|
@ -733,6 +733,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
|
|||
|
||||
object_size = le32_to_cpu(layout->fl_object_size);
|
||||
object_base = off - objoff;
|
||||
if (!(truncate_seq == 1 && truncate_size == -1ULL)) {
|
||||
if (truncate_size <= object_base) {
|
||||
truncate_size = 0;
|
||||
} else {
|
||||
|
@ -740,6 +741,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
|
|||
if (truncate_size > object_size)
|
||||
truncate_size = object_size;
|
||||
}
|
||||
}
|
||||
|
||||
osd_req_op_extent_init(req, 0, opcode, objoff, objlen,
|
||||
truncate_size, truncate_seq);
|
||||
|
|
Загрузка…
Ссылка в новой задаче