Lines Matching refs:offset
31 u64 offset)
33 BUG_ON(offset < bitmap_start);
34 offset -= bitmap_start;
35 return (unsigned long)(div64_u64(offset, sectorsize));
44 u64 offset)
50 bitmap_start = offset - block_group->key.objectid;
58 static int tree_insert_offset(struct rb_root *root, u64 offset,
69 if (offset < info->offset) {
71 } else if (offset > info->offset) {
76 * share the same offset. If this is the case, we want
82 * this offset, we want to go right, or after this entry
104 * searches the tree for the given offset.
108 * offset.
112 u64 offset, int bitmap_only, int fuzzy)
117 /* find entry that is closest to the 'offset' */
127 if (offset < entry->offset)
129 else if (offset > entry->offset)
142 * bitmap entry and extent entry may share same offset,
149 if (entry->offset != offset)
157 * if previous extent entry covers the offset,
168 if (prev->offset + prev->bytes > offset)
180 /* find last entry before the 'offset' */
182 if (entry->offset > offset) {
187 BUG_ON(entry->offset > offset);
205 if (prev->offset + prev->bytes > offset)
210 if (entry->offset + BITS_PER_BITMAP *
211 block_group->sectorsize > offset)
213 } else if (entry->offset + entry->bytes > offset)
221 if (entry->offset + BITS_PER_BITMAP *
222 block_group->sectorsize > offset)
225 if (entry->offset + entry->bytes > offset)
251 ret = tree_insert_offset(&block_group->free_space_offset, info->offset,
273 (div64_u64(block_group->key.offset, 1024 * 1024 * 1024));
299 struct btrfs_free_space *info, u64 offset,
305 start = offset_to_bit(info->offset, block_group->sectorsize, offset);
317 struct btrfs_free_space *info, u64 offset,
323 start = offset_to_bit(info->offset, block_group->sectorsize, offset);
335 struct btrfs_free_space *bitmap_info, u64 *offset,
342 i = offset_to_bit(bitmap_info->offset, block_group->sectorsize,
343 max_t(u64, *offset, bitmap_info->offset));
359 *offset = (u64)(i * block_group->sectorsize) +
360 bitmap_info->offset;
369 *block_group, u64 *offset,
380 offset_to_bitmap(block_group, *offset),
391 ret = search_bitmap(block_group, entry, offset, bytes);
397 *offset = entry->offset;
406 struct btrfs_free_space *info, u64 offset)
409 int max_bitmaps = (int)div64_u64(block_group->key.offset +
413 info->offset = offset_to_bitmap(block_group, offset);
423 u64 *offset, u64 *bytes)
430 end = bitmap_info->offset +
433 search_start = *offset;
437 BUG_ON(ret < 0 || search_start != *offset);
439 if (*offset > bitmap_info->offset && *offset + *bytes > end) {
440 bitmap_clear_bits(block_group, bitmap_info, *offset,
441 end - *offset + 1);
442 *bytes -= end - *offset + 1;
443 *offset = end + 1;
444 } else if (*offset >= bitmap_info->offset && *offset + *bytes <= end) {
445 bitmap_clear_bits(block_group, bitmap_info, *offset, *bytes);
482 search_start = *offset;
486 if (ret < 0 || search_start != *offset)
506 u64 bytes, offset, end;
522 block_group->key.offset)
526 offset = info->offset;
530 offset_to_bitmap(block_group, offset),
537 end = bitmap_info->offset +
540 if (offset >= bitmap_info->offset && offset + bytes > end) {
541 bitmap_set_bits(block_group, bitmap_info, offset,
542 end - offset);
543 bytes -= end - offset;
544 offset = end;
546 } else if (offset >= bitmap_info->offset && offset + bytes <= end) {
547 bitmap_set_bits(block_group, bitmap_info, offset, bytes);
561 add_new_bitmap(block_group, info, offset);
600 u64 offset, u64 bytes)
611 info->offset = offset;
621 right_info = tree_search_offset(block_group, offset + bytes, 0, 0);
626 left_info = tree_search_offset(block_group, offset - 1, 0, 0);
652 left_info->offset + left_info->bytes == offset) {
654 info->offset = left_info->offset;
674 u64 offset, u64 bytes)
683 info = tree_search_offset(block_group, offset, 0, 0);
690 offset_to_bitmap(block_group, offset),
705 end = next_info->offset + BITS_PER_BITMAP *
708 end = next_info->offset + next_info->bytes;
711 next_info->offset > offset || offset > end) {
714 (unsigned long long)info->offset,
735 if (!info->bitmap && info->offset == offset) {
737 info->offset += bytes;
743 if (!info->bitmap && info->offset <= offset &&
744 info->offset + info->bytes >= offset + bytes) {
745 u64 old_start = info->offset;
754 if (offset + bytes < info->offset + info->bytes) {
755 u64 old_end = info->offset + info->bytes;
757 info->offset = offset + bytes;
758 info->bytes = old_end - info->offset;
775 offset - old_start);
780 ret = remove_from_bitmap(block_group, info, &offset, &bytes);
801 printk(KERN_CRIT "entry offset %llu, bytes %llu, bitmap %s\n",
802 (unsigned long long)info->offset,
862 entry->offset, &entry->offset_index, 0);
911 u64 offset, u64 bytes, u64 empty_size)
918 entry = find_free_space(block_group, &offset, &bytes_search, 0);
922 ret = offset;
924 bitmap_clear_bits(block_group, entry, offset, bytes);
934 entry->offset += bytes;
1038 * if it couldn't find anything suitably large, or a logical disk offset
1067 if (entry->bytes < bytes || entry->offset < min_start) {
1077 ret = entry->offset;
1079 entry->offset += bytes;
1097 u64 offset, u64 bytes, u64 min_bytes)
1108 i = offset_to_bit(entry->offset, block_group->sectorsize,
1109 max_t(u64, offset, entry->offset));
1151 entry->offset;
1169 u64 offset, u64 bytes, u64 empty_size)
1207 entry = tree_search_offset(block_group, offset, found_bitmap, 1);
1224 offset, bytes + empty_size,
1238 * We already searched all the extent entries from the passed in offset
1248 window_start = entry->offset;
1274 offset = next->offset;
1284 if (next->offset - (last->offset + last->bytes) > 128 * 1024 ||
1285 next->offset - window_start > (bytes + empty_size) * 2) {
1287 window_start = entry->offset;
1299 cluster->window_start = entry->offset;
1305 * The cluster includes an rbtree, but only uses the offset index
1319 ret = tree_insert_offset(&cluster->root, entry->offset,