/* * The stripe extent starts before the range we want to delete, * but the range spans more than one stripe extent: * * |--- RAID Stripe Extent ---||--- RAID Stripe Extent ---| * |--- keep ---|--- drop ---| * * This means we have to get the previous item, truncate its * length and then restart the search.
*/ if (found_start > start) { if (slot == 0) {
ret = btrfs_previous_item(stripe_root, path, start,
BTRFS_RAID_STRIPE_KEY); if (ret) { if (ret > 0)
ret = -ENOENT; break;
}
} else {
path->slots[0]--;
}
/* * The stripe extent starts before the range we want to delete * and ends after the range we want to delete, i.e. we're * punching a hole in the stripe extent: * * |--- RAID Stripe Extent ---| * | keep |--- drop ---| keep | * * This means we need to a) truncate the existing item and b) * create a second item for the remaining range.
*/ if (found_start < start && found_end > end) {
size_t item_size;
u64 diff_start = start - found_start;
u64 diff_end = found_end - end; struct btrfs_stripe_extent *extent; struct btrfs_key newkey = {
.objectid = end,
.type = BTRFS_RAID_STRIPE_KEY,
.offset = diff_end,
};
/* The "right" item. */
ret = btrfs_duplicate_item(trans, stripe_root, path, &newkey); if (ret) break;
/* * The stripe extent starts before the range we want to delete: * * |--- RAID Stripe Extent ---| * |--- keep ---|--- drop ---| * * This means we have to duplicate the tree item, truncate the * length to the new size and then re-insert the item.
*/ if (found_start < start) {
u64 diff_start = start - found_start;
/* * The stripe extent ends after the range we want to delete: * * |--- RAID Stripe Extent ---| * |--- drop ---|--- keep ---| * * This means we have to duplicate the tree item, truncate the * length to the new size and then re-insert the item.
*/ if (found_end > end) {
u64 diff_end = found_end - end;
if (found_logical > end) {
ret = -ENODATA; goto out;
}
if (in_range(logical, found_logical, found_length)) break;
ret = btrfs_next_item(stripe_root, path); if (ret) goto out;
}
offset = logical - found_logical;
/* * If we have a logically contiguous, but physically non-continuous * range, we need to split the bio. Record the length after which we * must split the bio.
*/ if (end > found_end)
*length -= end - found_end;
/* If we're here, we haven't found the requested devid in the stripe. */
ret = -ENODATA;
out: if (ret > 0)
ret = -ENODATA; if (ret && ret != -EIO && !stripe->rst_search_commit_root) {
btrfs_debug(fs_info, "cannot find raid-stripe for logical [%llu, %llu] devid %llu, profile %s",
logical, logical + *length, stripe->dev->devid,
btrfs_bg_type_to_raid_name(map_type));
}
free_path:
btrfs_free_path(path);
return ret;
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
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.