/* * Return the last extent with given objno (@object_extents is sorted * by objno). If not found, return NULL and set @add_pos so that the * new extent can be added with list_add(add_pos, new_ex).
*/ staticstruct ceph_object_extent *
lookup_last(struct list_head *object_extents, u64 objno, struct list_head **add_pos)
{ struct list_head *pos;
/* * Map a file extent to a sorted list of object extents. * * We want only one (or as few as possible) object extents per object. * Adjacent object extents will be merged together, each returned object * extent may reverse map to multiple different file extents. * * Call @alloc_fn for each new object extent and @action_fn for each * mapped stripe unit, whether it was merged into an already allocated * object extent or started a new object extent. * * Newly allocated object extents are added to @object_extents. * To keep @object_extents sorted, successive calls to this function * must map successive file extents (i.e. the list of file extents that * are mapped using the same @object_extents must be sorted). * * The caller is responsible for @object_extents.
*/ int ceph_file_to_extents(struct ceph_file_layout *l, u64 off, u64 len, struct list_head *object_extents, struct ceph_object_extent *alloc_fn(void *arg), void *alloc_arg,
ceph_object_extent_fn_t action_fn, void *action_arg)
{ struct ceph_object_extent *last_ex, *ex;
ex = lookup_containing(object_extents, objno, objoff, xlen); if (!ex) {
WARN(1, "%s: objno %llu %llu~%u not found!\n",
__func__, objno, objoff, xlen); return -EINVAL;
}
action_fn(ex, xlen, action_arg);
off += xlen;
len -= xlen;
}
return 0;
}
EXPORT_SYMBOL(ceph_iterate_extents);
/* * Reverse map an object extent to a sorted list of file extents. * * On success, the caller is responsible for: * * kfree(file_extents)
*/ int ceph_extent_to_file(struct ceph_file_layout *l,
u64 objno, u64 objoff, u64 objlen, struct ceph_file_extent **file_extents,
u32 *num_file_extents)
{
u32 stripes_per_object = l->object_size / l->stripe_unit;
u64 blockno; /* which su */
u32 blockoff; /* offset into su */
u64 stripeno; /* which stripe */
u32 stripepos; /* which su in the stripe,
which object in the object set */
u64 objsetno; /* which object set */
u32 i = 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.