Re: [PATCH 1/6] ceph: re-calculate truncate_size for strip object

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reviewed-by: Sage Weil <sage@xxxxxxxxxxx>

On Fri, 4 Jan 2013, Yan, Zheng wrote:

> From: "Yan, Zheng" <zheng.z.yan@xxxxxxxxx>
> 
> Otherwise osd may truncate the object to larger size.
> 
> Signed-off-by: Yan, Zheng <zheng.z.yan@xxxxxxxxx>
> ---
>  net/ceph/osd_client.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> index eb9a444..267f183 100644
> --- a/net/ceph/osd_client.c
> +++ b/net/ceph/osd_client.c
> @@ -76,8 +76,16 @@ int ceph_calc_raw_layout(struct ceph_osd_client *osdc,
>  		     orig_len - *plen, off, *plen);
>  
>  	if (op_has_extent(op->op)) {
> +		u32 osize = le32_to_cpu(layout->fl_object_size);
>  		op->extent.offset = objoff;
>  		op->extent.length = objlen;
> +		if (op->extent.truncate_size <= off - objoff) {
> +			op->extent.truncate_size = 0;
> +		} else {
> +			op->extent.truncate_size -= off - objoff;
> +			if (op->extent.truncate_size > osize)
> +				op->extent.truncate_size = osize;
> +		}
>  	}
>  	req->r_num_pages = calc_pages_for(off, *plen);
>  	req->r_page_alignment = off & ~PAGE_MASK;
> -- 
> 1.7.11.7
> 
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux