Lines Matching defs:offset

49 					       u64 offset)
62 key.offset = offset;
137 u64 ino, u64 offset)
170 btrfs_set_inode_block_group(leaf, inode_item, offset);
175 key.offset = offset;
467 unsigned offset = 0;
475 offset = sizeof(u32) * io_ctl->num_pages;
477 crc = btrfs_crc32c(crc, io_ctl->orig + offset, PAGE_SIZE - offset);
489 unsigned offset = 0;
497 offset = sizeof(u32) * io_ctl->num_pages;
504 crc = btrfs_crc32c(crc, io_ctl->orig + offset, PAGE_SIZE - offset);
516 static int io_ctl_add_entry(struct btrfs_io_ctl *io_ctl, u64 offset, u64 bytes,
525 put_unaligned_le64(offset, &entry->offset);
599 entry->offset = get_unaligned_le64(&e->offset);
650 if (prev->offset + prev->bytes == e->offset) {
668 struct btrfs_path *path, u64 offset)
688 key.offset = offset;
712 offset);
975 ret = io_ctl_add_entry(io_ctl, e->offset, e->bytes,
1022 struct btrfs_path *path, u64 offset,
1031 key.offset = offset;
1047 found_key.offset != offset) {
1174 struct btrfs_path *path, u64 offset)
1188 ret = update_cache_item(trans, root, inode, path, offset,
1438 u64 offset)
1440 ASSERT(offset >= bitmap_start);
1441 offset -= bitmap_start;
1442 return (unsigned long)(div_u64(offset, unit));
1451 u64 offset)
1457 bitmap_start = offset - ctl->start;
1465 static int tree_insert_offset(struct rb_root *root, u64 offset,
1476 if (offset < info->offset) {
1478 } else if (offset > info->offset) {
1483 * share the same offset. If this is the case, we want
1489 * this offset, we want to go right, or after this entry
1517 * searches the tree for the given offset.
1521 * offset.
1525 u64 offset, int bitmap_only, int fuzzy)
1530 /* find entry that is closest to the 'offset' */
1540 if (offset < entry->offset)
1542 else if (offset > entry->offset)
1555 * bitmap entry and extent entry may share same offset,
1562 if (entry->offset != offset)
1570 * if previous extent entry covers the offset,
1578 prev->offset + prev->bytes > offset)
1588 /* find last entry before the 'offset' */
1590 if (entry->offset > offset) {
1595 ASSERT(entry->offset <= offset);
1610 prev->offset + prev->bytes > offset)
1613 if (entry->offset + BITS_PER_BITMAP * ctl->unit > offset)
1615 } else if (entry->offset + entry->bytes > offset)
1623 if (entry->offset + BITS_PER_BITMAP *
1624 ctl->unit > offset)
1627 if (entry->offset + entry->bytes > offset)
1665 ret = tree_insert_offset(&ctl->free_space_offset, info->offset,
1720 u64 offset, u64 bytes)
1725 start = offset_to_bit(info->offset, ctl->unit, offset);
1750 struct btrfs_free_space *info, u64 offset,
1753 __bitmap_clear_bits(ctl, info, offset, bytes);
1758 struct btrfs_free_space *info, u64 offset,
1764 start = offset_to_bit(info->offset, ctl->unit, offset);
1792 struct btrfs_free_space *bitmap_info, u64 *offset,
1812 i = offset_to_bit(bitmap_info->offset, ctl->unit,
1813 max_t(u64, *offset, bitmap_info->offset));
1834 *offset = (u64)(i * ctl->unit) + bitmap_info->offset;
1853 find_free_space(struct btrfs_free_space_ctl *ctl, u64 *offset, u64 *bytes,
1865 entry = tree_search_offset(ctl, offset_to_bitmap(ctl, *offset), 0, 1);
1881 tmp = entry->offset - ctl->start + align - 1;
1884 align_off = tmp - entry->offset;
1887 tmp = entry->offset;
1901 *offset = tmp;
1912 *offset = tmp;
1944 struct btrfs_free_space *info, u64 offset)
1946 info->offset = offset_to_bitmap(ctl, offset);
1980 u64 *offset, u64 *bytes)
1987 end = bitmap_info->offset + (u64)(BITS_PER_BITMAP * ctl->unit) - 1;
1995 search_start = *offset;
2000 if (ret < 0 || search_start != *offset)
2010 *offset += search_bytes;
2041 search_start = *offset;
2045 if (ret < 0 || search_start != *offset)
2056 struct btrfs_free_space *info, u64 offset,
2075 end = info->offset + (u64)(BITS_PER_BITMAP * ctl->unit);
2077 bytes_to_set = min(end - offset, bytes);
2079 bitmap_set_bits(ctl, info, offset, bytes_to_set);
2152 u64 bytes, offset, bytes_added;
2157 offset = info->offset;
2192 if (entry->offset == offset_to_bitmap(ctl, offset)) {
2193 bytes_added = add_bytes_to_bitmap(ctl, entry, offset,
2196 offset += bytes_added;
2206 bitmap_info = tree_search_offset(ctl, offset_to_bitmap(ctl, offset),
2213 bytes_added = add_bytes_to_bitmap(ctl, bitmap_info, offset, bytes,
2216 offset += bytes_added;
2227 add_new_bitmap(ctl, info, offset);
2290 u64 offset = info->offset;
2299 right_info = tree_search_offset(ctl, offset + bytes, 0, 0);
2304 left_info = tree_search_offset(ctl, offset - 1, 0, 0);
2320 left_info->offset + left_info->bytes == offset &&
2326 info->offset = left_info->offset;
2342 const u64 end = info->offset + info->bytes;
2350 i = offset_to_bit(bitmap->offset, ctl->unit, end);
2383 bitmap_offset = offset_to_bitmap(ctl, info->offset);
2385 if (bitmap_offset == info->offset) {
2386 if (info->offset == 0)
2388 bitmap_offset = offset_to_bitmap(ctl, info->offset - 1);
2395 i = offset_to_bit(bitmap->offset, ctl->unit, info->offset) - 1;
2411 info->offset -= bytes;
2419 bitmap_clear_bits(ctl, bitmap, info->offset, bytes);
2421 __bitmap_clear_bits(ctl, bitmap, info->offset, bytes);
2445 * Only work with disconnected entries, as we can change their offset,
2467 u64 offset, u64 bytes,
2479 info->offset = offset;
2565 u64 offset, u64 bytes)
2579 info = tree_search_offset(ctl, offset, 0, 0);
2585 info = tree_search_offset(ctl, offset_to_bitmap(ctl, offset),
2601 if (offset == info->offset) {
2605 info->offset += to_free;
2613 offset += to_free;
2617 u64 old_end = info->bytes + info->offset;
2619 info->bytes = offset - info->offset;
2626 if (old_end < offset + bytes) {
2627 bytes -= old_end - offset;
2628 offset = old_end;
2630 } else if (old_end == offset + bytes) {
2637 offset + bytes,
2638 old_end - (offset + bytes),
2645 ret = remove_from_bitmap(ctl, info, &offset, &bytes);
2671 btrfs_crit(fs_info, "entry offset %llu, bytes %llu, bitmap %s",
2672 info->offset, info->bytes,
2756 entry->offset, &entry->offset_index, bitmap);
2846 u64 offset, u64 bytes, u64 empty_size,
2860 entry = find_free_space(ctl, &offset, &bytes_search,
2865 ret = offset;
2867 bitmap_clear_bits(ctl, entry, offset, bytes);
2876 align_gap_len = offset - entry->offset;
2877 align_gap = entry->offset;
2883 entry->offset = offset + bytes;
2976 * if it couldn't find anything suitably large, or a logical disk offset
3008 (!entry->bitmap && entry->offset < min_start)) {
3032 ret = entry->offset;
3034 entry->offset += bytes;
3079 u64 offset, u64 bytes,
3093 i = offset_to_bit(entry->offset, ctl->unit,
3094 max_t(u64, offset, entry->offset));
3141 cluster->window_start = start * ctl->unit + entry->offset;
3143 ret = tree_insert_offset(&cluster->root, entry->offset,
3160 struct list_head *bitmaps, u64 offset, u64 bytes,
3172 entry = tree_search_offset(ctl, offset, 0, 1);
3216 cluster->window_start = first->offset;
3233 ret = tree_insert_offset(&cluster->root, entry->offset,
3251 struct list_head *bitmaps, u64 offset, u64 bytes,
3257 u64 bitmap_offset = offset_to_bitmap(ctl, offset);
3263 * The bitmap that covers offset won't be in the list unless offset
3264 * is just its start offset.
3269 if (!entry || entry->offset != bitmap_offset) {
3278 ret = btrfs_bitmap_cluster(block_group, entry, cluster, offset,
3286 * starting after offset, so no more search is required.
3301 u64 offset, u64 bytes, u64 empty_size)
3346 trace_btrfs_find_cluster(block_group, offset, bytes, empty_size,
3349 ret = setup_cluster_no_bitmap(block_group, cluster, &bitmaps, offset,
3354 offset, bytes + empty_size,
3490 if (entry->offset >= end)
3493 extent_start = entry->offset;
3497 start = entry->offset;
3515 entry->offset += max_discard_size;
3585 static void reset_trimming_bitmap(struct btrfs_free_space_ctl *ctl, u64 offset)
3590 entry = tree_search_offset(ctl, offset, 1, 0);
3628 u64 offset = offset_to_bitmap(ctl, start);
3631 while (offset < end) {
3646 entry = tree_search_offset(ctl, offset, 1, 0);
3655 if (!entry || (async && minlen && start == offset &&
3669 if (start == offset)
3730 reset_trimming_bitmap(ctl, offset);
3737 offset += BITS_PER_BITMAP * ctl->unit;
3738 start = offset;
3745 if (start != offset)
3746 reset_trimming_bitmap(ctl, offset);
3754 if (offset >= end)
3860 ino = entry->offset;
3863 entry->offset++;
3870 u64 offset = 0;
3874 ret = search_bitmap(ctl, entry, &offset, &count, true);
3878 ino = offset;
3879 bitmap_clear_bits(ctl, entry, offset, 1);
4010 u64 offset, u64 bytes, bool bitmap)
4028 info->offset = offset;
4047 bitmap_info = tree_search_offset(ctl, offset_to_bitmap(ctl, offset),
4052 add_new_bitmap(ctl, info, offset);
4057 bytes_added = add_bytes_to_bitmap(ctl, bitmap_info, offset, bytes,
4061 offset += bytes_added;
4080 u64 offset, u64 bytes)
4087 info = tree_search_offset(ctl, offset, 0, 0);
4089 info = tree_search_offset(ctl, offset_to_bitmap(ctl, offset),
4101 bit_off = offset;
4105 if (bit_off == offset) {
4108 } else if (bit_off > offset &&
4109 offset + bytes > bit_off) {
4119 if (tmp->offset + tmp->bytes < offset)
4121 if (offset + bytes < tmp->offset) {
4133 if (offset + bytes < tmp->offset)
4135 if (tmp->offset + tmp->bytes < offset) {
4147 if (info->offset == offset) {
4152 if (offset > info->offset && offset < info->offset + info->bytes)