Lines Matching +full:cpu +full:- +full:nr
1 /* SPDX-License-Identifier: GPL-2.0 */
92 const type *p = page_address(eb->pages[0]) + \
93 offset_in_page(eb->start); \
94 return get_unaligned_le##bits(&p->member); \
99 type *p = page_address(eb->pages[0]) + offset_in_page(eb->start); \
100 put_unaligned_le##bits(val, &p->member); \
106 return get_unaligned_le##bits(&s->member); \
110 put_unaligned_le##bits(val, &s->member); \
124 WARN_ON(!IS_ALIGNED(val, eb->fs_info->sectorsize)); in btrfs_set_device_total_bytes()
203 static inline struct btrfs_stripe *btrfs_stripe_nr(struct btrfs_chunk *c, int nr) in btrfs_stripe_nr() argument
208 offset += nr * sizeof(struct btrfs_stripe); in btrfs_stripe_nr()
212 static inline char *btrfs_stripe_dev_uuid_nr(struct btrfs_chunk *c, int nr) in btrfs_stripe_dev_uuid_nr() argument
214 return btrfs_stripe_dev_uuid(btrfs_stripe_nr(c, nr)); in btrfs_stripe_dev_uuid_nr()
218 struct btrfs_chunk *c, int nr) in btrfs_stripe_offset_nr() argument
220 return btrfs_stripe_offset(eb, btrfs_stripe_nr(c, nr)); in btrfs_stripe_offset_nr()
224 struct btrfs_chunk *c, int nr, in btrfs_set_stripe_offset_nr() argument
227 btrfs_set_stripe_offset(eb, btrfs_stripe_nr(c, nr), val); in btrfs_set_stripe_offset_nr()
231 struct btrfs_chunk *c, int nr) in btrfs_stripe_devid_nr() argument
233 return btrfs_stripe_devid(eb, btrfs_stripe_nr(c, nr)); in btrfs_stripe_devid_nr()
237 struct btrfs_chunk *c, int nr, in btrfs_set_stripe_devid_nr() argument
240 btrfs_set_stripe_devid(eb, btrfs_stripe_nr(c, nr), val); in btrfs_set_stripe_devid_nr()
378 static inline u64 btrfs_node_blockptr(const struct extent_buffer *eb, int nr) in btrfs_node_blockptr() argument
383 sizeof(struct btrfs_key_ptr) * nr; in btrfs_node_blockptr()
388 int nr, u64 val) in btrfs_set_node_blockptr() argument
393 sizeof(struct btrfs_key_ptr) * nr; in btrfs_set_node_blockptr()
397 static inline u64 btrfs_node_ptr_generation(const struct extent_buffer *eb, int nr) in btrfs_node_ptr_generation() argument
402 sizeof(struct btrfs_key_ptr) * nr; in btrfs_node_ptr_generation()
407 int nr, u64 val) in btrfs_set_node_ptr_generation() argument
412 sizeof(struct btrfs_key_ptr) * nr; in btrfs_set_node_ptr_generation()
416 static inline unsigned long btrfs_node_key_ptr_offset(const struct extent_buffer *eb, int nr) in btrfs_node_key_ptr_offset() argument
419 sizeof(struct btrfs_key_ptr) * nr; in btrfs_node_key_ptr_offset()
423 struct btrfs_disk_key *disk_key, int nr);
426 struct btrfs_disk_key *disk_key, int nr) in btrfs_set_node_key() argument
430 ptr = btrfs_node_key_ptr_offset(eb, nr); in btrfs_set_node_key()
441 static inline unsigned long btrfs_item_nr_offset(const struct extent_buffer *eb, int nr) in btrfs_item_nr_offset() argument
444 sizeof(struct btrfs_item) * nr; in btrfs_item_nr_offset()
447 static inline struct btrfs_item *btrfs_item_nr(const struct extent_buffer *eb, int nr) in btrfs_item_nr() argument
449 return (struct btrfs_item *)btrfs_item_nr_offset(eb, nr); in btrfs_item_nr()
465 struct btrfs_item *item = btrfs_item_nr(token->eb, slot); \
471 struct btrfs_item *item = btrfs_item_nr(token->eb, slot); \
478 static inline u32 btrfs_item_data_end(const struct extent_buffer *eb, int nr) in btrfs_item_data_end() argument
480 return btrfs_item_offset(eb, nr) + btrfs_item_size(eb, nr); in btrfs_item_data_end()
484 struct btrfs_disk_key *disk_key, int nr) in btrfs_item_key() argument
486 struct btrfs_item *item = btrfs_item_nr(eb, nr); in btrfs_item_key()
492 struct btrfs_disk_key *disk_key, int nr) in btrfs_set_item_key() argument
494 struct btrfs_item *item = btrfs_item_nr(eb, nr); in btrfs_set_item_key()
573 * Optimized helpers for little-endian architectures where CPU and on-disk
590 struct btrfs_key *cpu_key, int nr) in btrfs_node_key_to_cpu() argument
594 btrfs_node_key(eb, disk_key, nr); in btrfs_node_key_to_cpu()
598 struct btrfs_key *cpu_key, int nr) in btrfs_item_key_to_cpu() argument
602 btrfs_item_key(eb, disk_key, nr); in btrfs_item_key_to_cpu()
616 static inline void btrfs_disk_key_to_cpu(struct btrfs_key *cpu, in btrfs_disk_key_to_cpu() argument
619 cpu->offset = le64_to_cpu(disk->offset); in btrfs_disk_key_to_cpu()
620 cpu->type = disk->type; in btrfs_disk_key_to_cpu()
621 cpu->objectid = le64_to_cpu(disk->objectid); in btrfs_disk_key_to_cpu()
625 const struct btrfs_key *cpu) in btrfs_cpu_key_to_disk() argument
627 disk->offset = cpu_to_le64(cpu->offset); in btrfs_cpu_key_to_disk()
628 disk->type = cpu->type; in btrfs_cpu_key_to_disk()
629 disk->objectid = cpu_to_le64(cpu->objectid); in btrfs_cpu_key_to_disk()
633 struct btrfs_key *key, int nr) in btrfs_node_key_to_cpu() argument
637 btrfs_node_key(eb, &disk_key, nr); in btrfs_node_key_to_cpu()
642 struct btrfs_key *key, int nr) in btrfs_item_key_to_cpu() argument
646 btrfs_item_key(eb, &disk_key, nr); in btrfs_item_key_to_cpu()
833 static inline void btrfs_disk_balance_args_to_cpu(struct btrfs_balance_args *cpu, in btrfs_disk_balance_args_to_cpu() argument
836 memset(cpu, 0, sizeof(*cpu)); in btrfs_disk_balance_args_to_cpu()
838 cpu->profiles = le64_to_cpu(disk->profiles); in btrfs_disk_balance_args_to_cpu()
839 cpu->usage = le64_to_cpu(disk->usage); in btrfs_disk_balance_args_to_cpu()
840 cpu->devid = le64_to_cpu(disk->devid); in btrfs_disk_balance_args_to_cpu()
841 cpu->pstart = le64_to_cpu(disk->pstart); in btrfs_disk_balance_args_to_cpu()
842 cpu->pend = le64_to_cpu(disk->pend); in btrfs_disk_balance_args_to_cpu()
843 cpu->vstart = le64_to_cpu(disk->vstart); in btrfs_disk_balance_args_to_cpu()
844 cpu->vend = le64_to_cpu(disk->vend); in btrfs_disk_balance_args_to_cpu()
845 cpu->target = le64_to_cpu(disk->target); in btrfs_disk_balance_args_to_cpu()
846 cpu->flags = le64_to_cpu(disk->flags); in btrfs_disk_balance_args_to_cpu()
847 cpu->limit = le64_to_cpu(disk->limit); in btrfs_disk_balance_args_to_cpu()
848 cpu->stripes_min = le32_to_cpu(disk->stripes_min); in btrfs_disk_balance_args_to_cpu()
849 cpu->stripes_max = le32_to_cpu(disk->stripes_max); in btrfs_disk_balance_args_to_cpu()
854 const struct btrfs_balance_args *cpu) in btrfs_cpu_balance_args_to_disk() argument
858 disk->profiles = cpu_to_le64(cpu->profiles); in btrfs_cpu_balance_args_to_disk()
859 disk->usage = cpu_to_le64(cpu->usage); in btrfs_cpu_balance_args_to_disk()
860 disk->devid = cpu_to_le64(cpu->devid); in btrfs_cpu_balance_args_to_disk()
861 disk->pstart = cpu_to_le64(cpu->pstart); in btrfs_cpu_balance_args_to_disk()
862 disk->pend = cpu_to_le64(cpu->pend); in btrfs_cpu_balance_args_to_disk()
863 disk->vstart = cpu_to_le64(cpu->vstart); in btrfs_cpu_balance_args_to_disk()
864 disk->vend = cpu_to_le64(cpu->vend); in btrfs_cpu_balance_args_to_disk()
865 disk->target = cpu_to_le64(cpu->target); in btrfs_cpu_balance_args_to_disk()
866 disk->flags = cpu_to_le64(cpu->flags); in btrfs_cpu_balance_args_to_disk()
867 disk->limit = cpu_to_le64(cpu->limit); in btrfs_cpu_balance_args_to_disk()
868 disk->stripes_min = cpu_to_le32(cpu->stripes_min); in btrfs_cpu_balance_args_to_disk()
869 disk->stripes_max = cpu_to_le32(cpu->stripes_max); in btrfs_cpu_balance_args_to_disk()