Lines Matching refs:key
283 struct btrfs_key key; in btrfs_lookup_csums_range() local
306 key.objectid = BTRFS_EXTENT_CSUM_OBJECTID; in btrfs_lookup_csums_range()
307 key.offset = start; in btrfs_lookup_csums_range()
308 key.type = BTRFS_EXTENT_CSUM_KEY; in btrfs_lookup_csums_range()
310 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_lookup_csums_range()
315 btrfs_item_key_to_cpu(leaf, &key, path->slots[0] - 1); in btrfs_lookup_csums_range()
316 if (key.objectid == BTRFS_EXTENT_CSUM_OBJECTID && in btrfs_lookup_csums_range()
317 key.type == BTRFS_EXTENT_CSUM_KEY) { in btrfs_lookup_csums_range()
318 offset = (start - key.offset) >> in btrfs_lookup_csums_range()
337 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_lookup_csums_range()
338 if (key.objectid != BTRFS_EXTENT_CSUM_OBJECTID || in btrfs_lookup_csums_range()
339 key.type != BTRFS_EXTENT_CSUM_KEY) in btrfs_lookup_csums_range()
342 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_lookup_csums_range()
343 if (key.offset > end) in btrfs_lookup_csums_range()
346 if (key.offset > start) in btrfs_lookup_csums_range()
347 start = key.offset; in btrfs_lookup_csums_range()
350 csum_end = key.offset + (size / csum_size) * root->sectorsize; in btrfs_lookup_csums_range()
373 offset = (start - key.offset) >> in btrfs_lookup_csums_range()
502 struct btrfs_key *key, in truncate_one_csum() argument
514 csum_end += key->offset; in truncate_one_csum()
516 if (key->offset < bytenr && csum_end <= end_byte) { in truncate_one_csum()
523 u32 new_size = (bytenr - key->offset) >> blocksize_bits; in truncate_one_csum()
526 } else if (key->offset >= bytenr && csum_end > end_byte && in truncate_one_csum()
527 end_byte > key->offset) { in truncate_one_csum()
539 key->offset = end_byte; in truncate_one_csum()
540 btrfs_set_item_key_safe(trans, root, path, key); in truncate_one_csum()
554 struct btrfs_key key; in btrfs_del_csums() local
569 key.objectid = BTRFS_EXTENT_CSUM_OBJECTID; in btrfs_del_csums()
570 key.offset = end_byte - 1; in btrfs_del_csums()
571 key.type = BTRFS_EXTENT_CSUM_KEY; in btrfs_del_csums()
574 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); in btrfs_del_csums()
584 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_del_csums()
586 if (key.objectid != BTRFS_EXTENT_CSUM_OBJECTID || in btrfs_del_csums()
587 key.type != BTRFS_EXTENT_CSUM_KEY) { in btrfs_del_csums()
591 if (key.offset >= end_byte) in btrfs_del_csums()
596 csum_end += key.offset; in btrfs_del_csums()
603 if (key.offset >= bytenr && csum_end <= end_byte) { in btrfs_del_csums()
607 if (key.offset == bytenr) in btrfs_del_csums()
609 } else if (key.offset < bytenr && csum_end > end_byte) { in btrfs_del_csums()
631 offset = (bytenr - key.offset) >> blocksize_bits; in btrfs_del_csums()
641 key.offset = bytenr; in btrfs_del_csums()
647 ret = btrfs_split_item(trans, root, path, &key, offset); in btrfs_del_csums()
653 key.offset = end_byte - 1; in btrfs_del_csums()
655 truncate_one_csum(trans, root, path, &key, bytenr, len); in btrfs_del_csums()
656 if (key.offset < bytenr) in btrfs_del_csums()