| .. | .. | 
|---|
| 259 | 259 |  	return 0; | 
|---|
| 260 | 260 |  } | 
|---|
| 261 | 261 |  EXPORT_SYMBOL(ceph_extent_to_file); | 
|---|
 | 262 | +  | 
|---|
 | 263 | +u64 ceph_get_num_objects(struct ceph_file_layout *l, u64 size)  | 
|---|
 | 264 | +{  | 
|---|
 | 265 | +	u64 period = (u64)l->stripe_count * l->object_size;  | 
|---|
 | 266 | +	u64 num_periods = DIV64_U64_ROUND_UP(size, period);  | 
|---|
 | 267 | +	u64 remainder_bytes;  | 
|---|
 | 268 | +	u64 remainder_objs = 0;  | 
|---|
 | 269 | +  | 
|---|
 | 270 | +	div64_u64_rem(size, period, &remainder_bytes);  | 
|---|
 | 271 | +	if (remainder_bytes > 0 &&  | 
|---|
 | 272 | +	    remainder_bytes < (u64)l->stripe_count * l->stripe_unit)  | 
|---|
 | 273 | +		remainder_objs = l->stripe_count -  | 
|---|
 | 274 | +			    DIV_ROUND_UP_ULL(remainder_bytes, l->stripe_unit);  | 
|---|
 | 275 | +  | 
|---|
 | 276 | +	return num_periods * l->stripe_count - remainder_objs;  | 
|---|
 | 277 | +}  | 
|---|
 | 278 | +EXPORT_SYMBOL(ceph_get_num_objects);  | 
|---|