Lines Matching +full:xlen +full:- +full:1
1 /* SPDX-License-Identifier: GPL-2.0 */
14 * number of bytes mapped, less than or equal to @l->stripe_unit).
18 * blockno | 0 3 6 9 | 1 4 7 10 | 2 5 8 11 | 12 15 18 21 | 13 16 19
19 * stripeno | 0 1 2 3 | 0 1 2 3 | 0 1 2 3 | 4 5 6 7 | 4 5 6
20 * stripepos | 0 | 1 | 2 | 0 | 1
21 * objno | 0 | 1 | 2 | 3 | 4
22 * objsetno | 0 | 1
26 u64 *objno, u64 *objoff, u32 *xlen) in ceph_calc_file_object_mapping() argument
28 u32 stripes_per_object = l->object_size / l->stripe_unit; in ceph_calc_file_object_mapping()
37 blockno = div_u64_rem(off, l->stripe_unit, &blockoff); in ceph_calc_file_object_mapping()
38 stripeno = div_u64_rem(blockno, l->stripe_count, &stripepos); in ceph_calc_file_object_mapping()
41 *objno = objsetno * l->stripe_count + stripepos; in ceph_calc_file_object_mapping()
42 *objoff = objsetpos * l->stripe_unit + blockoff; in ceph_calc_file_object_mapping()
43 *xlen = min_t(u64, len, l->stripe_unit - blockoff); in ceph_calc_file_object_mapping()
62 if (ex->oe_objno == objno) in lookup_last()
65 if (ex->oe_objno < objno) in lookup_last()
75 u64 objoff, u32 xlen) in lookup_containing() argument
80 if (ex->oe_objno == objno && in lookup_containing()
81 ex->oe_off <= objoff && in lookup_containing()
82 ex->oe_off + ex->oe_len >= objoff + xlen) /* paranoia */ in lookup_containing()
85 if (ex->oe_objno > objno) in lookup_containing()
122 u32 xlen; in ceph_file_to_extents() local
125 &xlen); in ceph_file_to_extents()
128 if (!last_ex || last_ex->oe_off + last_ex->oe_len != objoff) { in ceph_file_to_extents()
131 return -ENOMEM; in ceph_file_to_extents()
133 ex->oe_objno = objno; in ceph_file_to_extents()
134 ex->oe_off = objoff; in ceph_file_to_extents()
135 ex->oe_len = xlen; in ceph_file_to_extents()
137 action_fn(ex, xlen, action_arg); in ceph_file_to_extents()
140 list_add(&ex->oe_item, add_pos); in ceph_file_to_extents()
142 list_add(&ex->oe_item, &last_ex->oe_item); in ceph_file_to_extents()
144 last_ex->oe_len += xlen; in ceph_file_to_extents()
146 action_fn(last_ex, xlen, action_arg); in ceph_file_to_extents()
149 off += xlen; in ceph_file_to_extents()
150 len -= xlen; in ceph_file_to_extents()
155 &ex->oe_item != object_extents; in ceph_file_to_extents()
157 if (last_ex->oe_objno > ex->oe_objno || in ceph_file_to_extents()
158 (last_ex->oe_objno == ex->oe_objno && in ceph_file_to_extents()
159 last_ex->oe_off + last_ex->oe_len >= ex->oe_off)) { in ceph_file_to_extents()
160 WARN(1, "%s: object_extents list not sorted!\n", in ceph_file_to_extents()
162 return -EINVAL; in ceph_file_to_extents()
171 * A stripped down, non-allocating version of ceph_file_to_extents(),
182 u32 xlen; in ceph_iterate_extents() local
185 &xlen); in ceph_iterate_extents()
187 ex = lookup_containing(object_extents, objno, objoff, xlen); in ceph_iterate_extents()
189 WARN(1, "%s: objno %llu %llu~%u not found!\n", in ceph_iterate_extents()
190 __func__, objno, objoff, xlen); in ceph_iterate_extents()
191 return -EINVAL; in ceph_iterate_extents()
194 action_fn(ex, xlen, action_arg); in ceph_iterate_extents()
196 off += xlen; in ceph_iterate_extents()
197 len -= xlen; in ceph_iterate_extents()
216 u32 stripes_per_object = l->object_size / l->stripe_unit; in ceph_extent_to_file()
231 *num_file_extents = DIV_ROUND_UP_ULL(objoff + objlen, l->stripe_unit) - in ceph_extent_to_file()
232 DIV_ROUND_DOWN_ULL(objoff, l->stripe_unit); in ceph_extent_to_file()
236 return -ENOMEM; in ceph_extent_to_file()
238 div_u64_rem(objoff, l->stripe_unit, &blockoff); in ceph_extent_to_file()
242 objsetno = div_u64_rem(objno, l->stripe_count, &stripepos); in ceph_extent_to_file()
243 stripeno = div_u64(objoff, l->stripe_unit) + in ceph_extent_to_file()
245 blockno = stripeno * l->stripe_count + stripepos; in ceph_extent_to_file()
246 off = blockno * l->stripe_unit + blockoff; in ceph_extent_to_file()
247 len = min_t(u64, objlen, l->stripe_unit - blockoff); in ceph_extent_to_file()
254 objlen -= len; in ceph_extent_to_file()
265 u64 period = (u64)l->stripe_count * l->object_size; in ceph_get_num_objects()
272 remainder_bytes < (u64)l->stripe_count * l->stripe_unit) in ceph_get_num_objects()
273 remainder_objs = l->stripe_count - in ceph_get_num_objects()
274 DIV_ROUND_UP_ULL(remainder_bytes, l->stripe_unit); in ceph_get_num_objects()
276 return num_periods * l->stripe_count - remainder_objs; in ceph_get_num_objects()