Lines Matching +full:rcu +full:- +full:endian +full:- +full:offset
1 /* SPDX-License-Identifier: GPL-2.0 */
16 #include <linux/backing-dev.h>
31 #include "extent-io-tree.h"
34 #include "async-thread.h"
35 #include "block-rsv.h"
56 * the target device of dev-replace as one. During an active device replace
119 return div_u64(size + BTRFS_MAX_EXTENT_SIZE - 1, BTRFS_MAX_EXTENT_SIZE); in count_max_extents()
126 sizeof(struct btrfs_stripe) * (num_stripes - 1); in btrfs_chunk_item_size()
130 * Runtime (in-memory) states of filesystem
147 /* The btrfs_fs_info created for self-tests */
153 #define BTRFS_BACKREF_REV_MASK (((u64)BTRFS_BACKREF_REV_MAX - 1) << \
312 * A leaf is full of items. offset and size tell us where to find
317 __le32 offset; member
334 * all non-leaf blocks are nodes, they hold only keys and pointers to
379 #define BTRFS_MAX_EXTENT_ITEM_SIZE(r) ((BTRFS_LEAF_DATA_SIZE(r->fs_info) >> 4) - \
383 time64_t time_started; /* seconds since 1-Jan-1970 */
384 time64_t time_stopped; /* seconds since 1-Jan-1970 */
422 /* first extent starting offset */
491 #define SEQ_LAST ((u64)-1)
616 /* logical->physical extent mapping */
656 * extent. The write side(mount/remount) is under ->s_umount lock,
703 * because another function happens to be doing non-waiting preflush
740 * this is used to protect the following list -- ordered_roots.
812 * all block groups are removed. RCU is used to protect it.
979 return sb->s_fs_info; in btrfs_sb()
987 * btrfs_record_root_in_trans is a multi-step process, and it can race
1001 * - How balance works
1006 * While for non-shareable trees, we just simply do a tree search
1009 * - How dirty roots are tracked
1011 * track them, while non-subvolume roots have TRACK_DIRTY bit, they
1105 /* The dirty list is only used by non-shareable roots */
1116 /* red-black tree that keeps track of in-memory inodes */
1170 * manipulation with the read-only status via SUBVOL_SETFLAGS
1246 return info->nodesize - sizeof(struct btrfs_header); in BTRFS_LEAF_DATA_SIZE()
1253 return BTRFS_LEAF_DATA_SIZE(info) - sizeof(struct btrfs_item); in BTRFS_MAX_ITEM_SIZE()
1265 return BTRFS_MAX_ITEM_SIZE(info) - in BTRFS_MAX_INLINE_DATA_SIZE()
1271 return BTRFS_MAX_ITEM_SIZE(info) - sizeof(struct btrfs_dir_item); in BTRFS_MAX_XATTR_SIZE()
1316 #define btrfs_test_opt(fs_info, opt) ((fs_info)->mount_opt & \
1323 btrfs_set_opt(fs_info->mount_opt, opt); \
1330 btrfs_clear_opt(fs_info->mount_opt, opt); \
1346 test_bit(BTRFS_PENDING_##opt, &(info)->pending_changes)
1348 set_bit(BTRFS_PENDING_##opt, &(info)->pending_changes)
1350 clear_bit(BTRFS_PENDING_##opt, &(info)->pending_changes)
1360 if (!btrfs_raw_test_opt((info)->mount_opt, opt)) { \
1369 if (btrfs_raw_test_opt((info)->mount_opt, opt)) { \
1412 unsigned long offset; member
1416 ((bytes) >> (fs_info)->sb->s_blocksize_bits)
1421 token->eb = eb; in btrfs_init_map_token()
1422 token->kaddr = page_address(eb->pages[0]); in btrfs_init_map_token()
1423 token->offset = 0; in btrfs_init_map_token()
1448 sizeof(((type *)0)->member)))
1454 sizeof(((type *)0)->member)))
1476 BUILD_BUG_ON(sizeof(u##bits) != sizeof(((type *)0))->member); \
1482 BUILD_BUG_ON(sizeof(u##bits) != sizeof(((type *)0))->member); \
1488 BUILD_BUG_ON(sizeof(u##bits) != sizeof(((type *)0))->member); \
1494 BUILD_BUG_ON(sizeof(u##bits) != sizeof(((type *)0))->member); \
1501 const type *p = page_address(eb->pages[0]); \
1502 return get_unaligned_le##bits(&p->member); \
1507 type *p = page_address(eb->pages[0]); \
1508 put_unaligned_le##bits(val, &p->member); \
1514 return get_unaligned_le##bits(&s->member); \
1518 put_unaligned_le##bits(val, &s->member); \
1525 sizeof(((struct btrfs_dev_item *)0))->total_bytes); in btrfs_device_total_bytes()
1534 sizeof(((struct btrfs_dev_item *)0))->total_bytes); in btrfs_set_device_total_bytes()
1535 WARN_ON(!IS_ALIGNED(val, eb->fs_info->sectorsize)); in btrfs_set_device_total_bytes()
1594 BTRFS_SETGET_FUNCS(stripe_offset, struct btrfs_stripe, offset, 64);
1617 BTRFS_SETGET_STACK_FUNCS(stack_stripe_offset, struct btrfs_stripe, offset, 64);
1622 unsigned long offset = (unsigned long)c; in btrfs_stripe_nr() local
1623 offset += offsetof(struct btrfs_chunk, stripe); in btrfs_stripe_nr()
1624 offset += nr * sizeof(struct btrfs_stripe); in btrfs_stripe_nr()
1625 return (struct btrfs_stripe *)offset; in btrfs_stripe_nr()
1745 offset, 64);
1755 offset, 64);
1767 offsetof(struct btrfs_extent_inline_ref, offset); in btrfs_extent_inline_ref_size()
1832 BTRFS_SETGET_FUNCS(item_offset, struct btrfs_item, offset, 32);
1834 BTRFS_SETGET_STACK_FUNCS(stack_item_offset, struct btrfs_item, offset, 32);
1943 BTRFS_SETGET_STACK_FUNCS(disk_key_offset, struct btrfs_disk_key, offset, 64);
1949 * Optimized helpers for little-endian architectures where CPU and on-disk
1995 cpu->offset = le64_to_cpu(disk->offset); in btrfs_disk_key_to_cpu()
1996 cpu->type = disk->type; in btrfs_disk_key_to_cpu()
1997 cpu->objectid = le64_to_cpu(disk->objectid); in btrfs_disk_key_to_cpu()
2003 disk->offset = cpu_to_le64(cpu->offset); in btrfs_cpu_key_to_disk()
2004 disk->type = cpu->type; in btrfs_cpu_key_to_disk()
2005 disk->objectid = cpu_to_le64(cpu->objectid); in btrfs_cpu_key_to_disk()
2118 return (root->root_item.flags & cpu_to_le64(BTRFS_ROOT_SUBVOL_RDONLY)) != 0; in btrfs_root_readonly()
2123 return (root->root_item.flags & cpu_to_le64(BTRFS_ROOT_SUBVOL_DEAD)) != 0; in btrfs_root_dead()
2226 cpu->profiles = le64_to_cpu(disk->profiles); in btrfs_disk_balance_args_to_cpu()
2227 cpu->usage = le64_to_cpu(disk->usage); in btrfs_disk_balance_args_to_cpu()
2228 cpu->devid = le64_to_cpu(disk->devid); in btrfs_disk_balance_args_to_cpu()
2229 cpu->pstart = le64_to_cpu(disk->pstart); in btrfs_disk_balance_args_to_cpu()
2230 cpu->pend = le64_to_cpu(disk->pend); in btrfs_disk_balance_args_to_cpu()
2231 cpu->vstart = le64_to_cpu(disk->vstart); in btrfs_disk_balance_args_to_cpu()
2232 cpu->vend = le64_to_cpu(disk->vend); in btrfs_disk_balance_args_to_cpu()
2233 cpu->target = le64_to_cpu(disk->target); in btrfs_disk_balance_args_to_cpu()
2234 cpu->flags = le64_to_cpu(disk->flags); in btrfs_disk_balance_args_to_cpu()
2235 cpu->limit = le64_to_cpu(disk->limit); in btrfs_disk_balance_args_to_cpu()
2236 cpu->stripes_min = le32_to_cpu(disk->stripes_min); in btrfs_disk_balance_args_to_cpu()
2237 cpu->stripes_max = le32_to_cpu(disk->stripes_max); in btrfs_disk_balance_args_to_cpu()
2246 disk->profiles = cpu_to_le64(cpu->profiles); in btrfs_cpu_balance_args_to_disk()
2247 disk->usage = cpu_to_le64(cpu->usage); in btrfs_cpu_balance_args_to_disk()
2248 disk->devid = cpu_to_le64(cpu->devid); in btrfs_cpu_balance_args_to_disk()
2249 disk->pstart = cpu_to_le64(cpu->pstart); in btrfs_cpu_balance_args_to_disk()
2250 disk->pend = cpu_to_le64(cpu->pend); in btrfs_cpu_balance_args_to_disk()
2251 disk->vstart = cpu_to_le64(cpu->vstart); in btrfs_cpu_balance_args_to_disk()
2252 disk->vend = cpu_to_le64(cpu->vend); in btrfs_cpu_balance_args_to_disk()
2253 disk->target = cpu_to_le64(cpu->target); in btrfs_cpu_balance_args_to_disk()
2254 disk->flags = cpu_to_le64(cpu->flags); in btrfs_cpu_balance_args_to_disk()
2255 disk->limit = cpu_to_le64(cpu->limit); in btrfs_cpu_balance_args_to_disk()
2256 disk->stripes_min = cpu_to_le32(cpu->stripes_min); in btrfs_cpu_balance_args_to_disk()
2257 disk->stripes_max = cpu_to_le32(cpu->stripes_max); in btrfs_cpu_balance_args_to_disk()
2317 * The leaf data grows from end-to-front in the node.
2326 return BTRFS_LEAF_DATA_SIZE(leaf->fs_info); in leaf_data_end()
2327 return btrfs_item_offset_nr(leaf, nr - 1); in leaf_data_end()
2336 struct btrfs_file_extent_item, offset, 64);
2367 offset, 64);
2388 return btrfs_item_size(eb, e) - BTRFS_FILE_EXTENT_INLINE_DATA_START; in btrfs_file_extent_inline_item_len()
2502 * Figure the key offset of an extended inode ref
2515 /* extent-tree.c */
2527 u64 hash_extent_data_ref(u64 root_objectid, u64 owner, u64 offset);
2538 return (u64)fs_info->nodesize * BTRFS_MAX_LEVEL * 2 * num_items; in btrfs_calc_insert_metadata_size()
2548 return (u64)fs_info->nodesize * BTRFS_MAX_LEVEL * num_items; in btrfs_calc_metadata_size()
2562 u64 offset, int metadata, u64 *refs, u64 *flags);
2569 u64 objectid, u64 offset, u64 bytenr, bool strict);
2583 u64 offset, u64 ram_bytes,
2586 u64 root_objectid, u64 owner, u64 offset,
2622 * - Running delayed inode items
2623 * - Allocating a new chunk
2629 * - Running delayed inode items
2630 * - Running delayed refs
2631 * - Running delalloc and waiting for ordered extents
2632 * - Allocating a new chunk
2638 * - Running delayed iputs
2639 * - Commiting transaction
2760 return btrfs_del_items(trans, root, path, path->slots[0], 1); in btrfs_del_item()
2790 ++p->slots[0]; in btrfs_next_old_item()
2791 if (p->slots[0] >= btrfs_header_nritems(p->nodes[0])) in btrfs_next_old_item()
2811 if (test_bit(BTRFS_FS_CLOSING_START, &fs_info->flags)) { in btrfs_fs_closing()
2812 if (test_bit(BTRFS_FS_CLOSING_DONE, &fs_info->flags)) in btrfs_fs_closing()
2826 return fs_info->sb->s_flags & SB_RDONLY || btrfs_fs_closing(fs_info); in btrfs_need_cleaner_sleep()
2836 /* root-item.c */
2862 /* uuid-tree.c */
2869 /* dir-item.c */
2911 struct btrfs_root *root, u64 offset);
2913 struct btrfs_root *root, u64 offset);
2914 int btrfs_find_orphan_item(struct btrfs_root *root, u64 offset);
2916 /* inode-item.c */
2946 /* file-item.c */
2951 u64 offset, u8 *dst);
2956 u64 num_bytes, u64 offset, u64 ram_bytes,
2988 noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
3129 /* tree-defrag.c */
3316 "Unsupported V0 extent filesystem detected. Aborting. Please re-create your filesystem with a newer… in btrfs_print_v0_err()
3339 &((trans)->fs_info->fs_state))) { \
3340 if ((errno) != -EIO && (errno) != -EROFS) { \
3345 btrfs_debug((trans)->fs_info, \
3387 disk_super = fs_info->super_copy; in __btrfs_set_fs_incompat()
3390 spin_lock(&fs_info->super_lock); in __btrfs_set_fs_incompat()
3399 spin_unlock(&fs_info->super_lock); in __btrfs_set_fs_incompat()
3413 disk_super = fs_info->super_copy; in __btrfs_clear_fs_incompat()
3416 spin_lock(&fs_info->super_lock); in __btrfs_clear_fs_incompat()
3425 spin_unlock(&fs_info->super_lock); in __btrfs_clear_fs_incompat()
3435 disk_super = fs_info->super_copy; in __btrfs_fs_incompat()
3449 disk_super = fs_info->super_copy; in __btrfs_set_fs_compat_ro()
3452 spin_lock(&fs_info->super_lock); in __btrfs_set_fs_compat_ro()
3458 "setting compat-ro feature flag for %s (0x%llx)", in __btrfs_set_fs_compat_ro()
3461 spin_unlock(&fs_info->super_lock); in __btrfs_set_fs_compat_ro()
3475 disk_super = fs_info->super_copy; in __btrfs_clear_fs_compat_ro()
3478 spin_lock(&fs_info->super_lock); in __btrfs_clear_fs_compat_ro()
3484 "clearing compat-ro feature flag for %s (0x%llx)", in __btrfs_clear_fs_compat_ro()
3487 spin_unlock(&fs_info->super_lock); in __btrfs_clear_fs_compat_ro()
3497 disk_super = fs_info->super_copy; in __btrfs_fs_compat_ro()
3550 locks_root->root = RB_ROOT; in btrfs_init_full_stripe_locks_tree()
3551 mutex_init(&locks_root->lock); in btrfs_init_full_stripe_locks_tree()
3554 /* dev-replace.c */
3602 return test_bit(BTRFS_FS_STATE_DUMMY_FS_INFO, &fs_info->fs_state); in btrfs_is_testing()