Lines Matching +full:32 +full:- +full:bits

1 /* SPDX-License-Identifier: GPL-2.0 */
48 #define DECLARE_BTRFS_SETGET_BITS(bits) \ argument
49 u##bits btrfs_get_token_##bits(struct btrfs_map_token *token, \
51 void btrfs_set_token_##bits(struct btrfs_map_token *token, \
53 u##bits val); \
54 u##bits btrfs_get_##bits(const struct extent_buffer *eb, \
56 void btrfs_set_##bits(const struct extent_buffer *eb, void *ptr, \
57 unsigned long off, u##bits val);
61 DECLARE_BTRFS_SETGET_BITS(32)
64 #define BTRFS_SETGET_FUNCS(name, type, member, bits) \ argument
65 static inline u##bits btrfs_##name(const struct extent_buffer *eb, \
68 static_assert(sizeof(u##bits) == sizeof_field(type, member)); \
69 return btrfs_get_##bits(eb, s, offsetof(type, member)); \
72 u##bits val) \
74 static_assert(sizeof(u##bits) == sizeof_field(type, member)); \
75 btrfs_set_##bits(eb, s, offsetof(type, member), val); \
77 static inline u##bits btrfs_token_##name(struct btrfs_map_token *token, \
80 static_assert(sizeof(u##bits) == sizeof_field(type, member)); \
81 return btrfs_get_token_##bits(token, s, offsetof(type, member));\
84 type *s, u##bits val) \
86 static_assert(sizeof(u##bits) == sizeof_field(type, member)); \
87 btrfs_set_token_##bits(token, s, offsetof(type, member), val); \
90 #define BTRFS_SETGET_HEADER_FUNCS(name, type, member, bits) \ argument
91 static inline u##bits btrfs_##name(const struct extent_buffer *eb) \
93 const type *p = folio_address(eb->folios[0]) + \
94 offset_in_page(eb->start); \
95 return get_unaligned_le##bits(&p->member); \
98 u##bits val) \
100 type *p = folio_address(eb->folios[0]) + offset_in_page(eb->start); \
101 put_unaligned_le##bits(val, &p->member); \
104 #define BTRFS_SETGET_STACK_FUNCS(name, type, member, bits) \ argument
105 static inline u##bits btrfs_##name(const type *s) \
107 return get_unaligned_le##bits(&s->member); \
109 static inline void btrfs_set_##name(type *s, u##bits val) \
111 put_unaligned_le##bits(val, &s->member); \
125 WARN_ON(!IS_ALIGNED(val, eb->fs_info->sectorsize)); in btrfs_set_device_total_bytes()
131 BTRFS_SETGET_FUNCS(device_io_align, struct btrfs_dev_item, io_align, 32);
132 BTRFS_SETGET_FUNCS(device_io_width, struct btrfs_dev_item, io_width, 32);
134 BTRFS_SETGET_FUNCS(device_sector_size, struct btrfs_dev_item, sector_size, 32);
136 BTRFS_SETGET_FUNCS(device_group, struct btrfs_dev_item, dev_group, 32);
147 io_align, 32);
149 io_width, 32);
151 sector_size, 32);
153 BTRFS_SETGET_STACK_FUNCS(stack_device_group, struct btrfs_dev_item, dev_group, 32);
174 BTRFS_SETGET_FUNCS(chunk_io_align, struct btrfs_chunk, io_align, 32);
175 BTRFS_SETGET_FUNCS(chunk_io_width, struct btrfs_chunk, io_width, 32);
176 BTRFS_SETGET_FUNCS(chunk_sector_size, struct btrfs_chunk, sector_size, 32);
192 BTRFS_SETGET_STACK_FUNCS(stack_chunk_io_align, struct btrfs_chunk, io_align, 32);
193 BTRFS_SETGET_STACK_FUNCS(stack_chunk_io_width, struct btrfs_chunk, io_width, 32);
195 sector_size, 32);
259 extent_count, 32);
260 BTRFS_SETGET_FUNCS(free_space_flags, struct btrfs_free_space_info, flags, 32);
282 BTRFS_SETGET_FUNCS(inode_nlink, struct btrfs_inode_item, nlink, 32);
283 BTRFS_SETGET_FUNCS(inode_uid, struct btrfs_inode_item, uid, 32);
284 BTRFS_SETGET_FUNCS(inode_gid, struct btrfs_inode_item, gid, 32);
285 BTRFS_SETGET_FUNCS(inode_mode, struct btrfs_inode_item, mode, 32);
298 BTRFS_SETGET_STACK_FUNCS(stack_inode_nlink, struct btrfs_inode_item, nlink, 32);
299 BTRFS_SETGET_STACK_FUNCS(stack_inode_uid, struct btrfs_inode_item, uid, 32);
300 BTRFS_SETGET_STACK_FUNCS(stack_inode_gid, struct btrfs_inode_item, gid, 32);
301 BTRFS_SETGET_STACK_FUNCS(stack_inode_mode, struct btrfs_inode_item, mode, 32);
305 BTRFS_SETGET_FUNCS(timespec_nsec, struct btrfs_timespec, nsec, 32);
307 BTRFS_SETGET_STACK_FUNCS(stack_timespec_nsec, struct btrfs_timespec, nsec, 32);
357 BTRFS_SETGET_FUNCS(extent_data_ref_count, struct btrfs_extent_data_ref, count, 32);
359 BTRFS_SETGET_FUNCS(shared_data_ref_count, struct btrfs_shared_data_ref, count, 32);
450 BTRFS_SETGET_FUNCS(raw_item_offset, struct btrfs_item, offset, 32);
451 BTRFS_SETGET_FUNCS(raw_item_size, struct btrfs_item, size, 32);
452 BTRFS_SETGET_STACK_FUNCS(stack_item_offset, struct btrfs_item, offset, 32);
453 BTRFS_SETGET_STACK_FUNCS(stack_item_size, struct btrfs_item, size, 32);
479 struct btrfs_item *item = btrfs_item_nr(token->eb, slot); \
485 struct btrfs_item *item = btrfs_item_nr(token->eb, slot); \
587 * Optimized helpers for little-endian architectures where CPU and on-disk
633 cpu->offset = le64_to_cpu(disk->offset); in btrfs_disk_key_to_cpu()
634 cpu->type = disk->type; in btrfs_disk_key_to_cpu()
635 cpu->objectid = le64_to_cpu(disk->objectid); in btrfs_disk_key_to_cpu()
641 disk->offset = cpu_to_le64(cpu->offset); in btrfs_cpu_key_to_disk()
642 disk->type = cpu->type; in btrfs_cpu_key_to_disk()
643 disk->objectid = cpu_to_le64(cpu->objectid); in btrfs_cpu_key_to_disk()
680 BTRFS_SETGET_HEADER_FUNCS(header_nritems, struct btrfs_header, nritems, 32);
686 BTRFS_SETGET_STACK_FUNCS(stack_header_nritems, struct btrfs_header, nritems, 32);
731 BTRFS_SETGET_FUNCS(disk_root_refs, struct btrfs_root_item, refs, 32);
740 BTRFS_SETGET_STACK_FUNCS(root_refs, struct btrfs_root_item, refs, 32);
852 cpu->profiles = le64_to_cpu(disk->profiles); in btrfs_disk_balance_args_to_cpu()
853 cpu->usage = le64_to_cpu(disk->usage); in btrfs_disk_balance_args_to_cpu()
854 cpu->devid = le64_to_cpu(disk->devid); in btrfs_disk_balance_args_to_cpu()
855 cpu->pstart = le64_to_cpu(disk->pstart); in btrfs_disk_balance_args_to_cpu()
856 cpu->pend = le64_to_cpu(disk->pend); in btrfs_disk_balance_args_to_cpu()
857 cpu->vstart = le64_to_cpu(disk->vstart); in btrfs_disk_balance_args_to_cpu()
858 cpu->vend = le64_to_cpu(disk->vend); in btrfs_disk_balance_args_to_cpu()
859 cpu->target = le64_to_cpu(disk->target); in btrfs_disk_balance_args_to_cpu()
860 cpu->flags = le64_to_cpu(disk->flags); in btrfs_disk_balance_args_to_cpu()
861 cpu->limit = le64_to_cpu(disk->limit); in btrfs_disk_balance_args_to_cpu()
862 cpu->stripes_min = le32_to_cpu(disk->stripes_min); in btrfs_disk_balance_args_to_cpu()
863 cpu->stripes_max = le32_to_cpu(disk->stripes_max); in btrfs_disk_balance_args_to_cpu()
872 disk->profiles = cpu_to_le64(cpu->profiles); in btrfs_cpu_balance_args_to_disk()
873 disk->usage = cpu_to_le64(cpu->usage); in btrfs_cpu_balance_args_to_disk()
874 disk->devid = cpu_to_le64(cpu->devid); in btrfs_cpu_balance_args_to_disk()
875 disk->pstart = cpu_to_le64(cpu->pstart); in btrfs_cpu_balance_args_to_disk()
876 disk->pend = cpu_to_le64(cpu->pend); in btrfs_cpu_balance_args_to_disk()
877 disk->vstart = cpu_to_le64(cpu->vstart); in btrfs_cpu_balance_args_to_disk()
878 disk->vend = cpu_to_le64(cpu->vend); in btrfs_cpu_balance_args_to_disk()
879 disk->target = cpu_to_le64(cpu->target); in btrfs_cpu_balance_args_to_disk()
880 disk->flags = cpu_to_le64(cpu->flags); in btrfs_cpu_balance_args_to_disk()
881 disk->limit = cpu_to_le64(cpu->limit); in btrfs_cpu_balance_args_to_disk()
882 disk->stripes_min = cpu_to_le32(cpu->stripes_min); in btrfs_cpu_balance_args_to_disk()
883 disk->stripes_max = cpu_to_le32(cpu->stripes_max); in btrfs_cpu_balance_args_to_disk()
893 struct btrfs_super_block, sys_chunk_array_size, 32);
910 sectorsize, 32);
912 nodesize, 32);
914 stripesize, 32);