Lines Matching refs:token

28 void btrfs_init_map_token(struct btrfs_map_token *token, struct extent_buffer *eb)  in btrfs_init_map_token()  argument
30 token->eb = eb; in btrfs_init_map_token()
31 token->kaddr = folio_address(eb->folios[0]); in btrfs_init_map_token()
32 token->offset = 0; in btrfs_init_map_token()
60 u##bits btrfs_get_token_##bits(struct btrfs_map_token *token, \
64 const unsigned long idx = get_eb_folio_index(token->eb, member_offset); \
65 const unsigned long oil = get_eb_offset_in_folio(token->eb, \
67 const int unit_size = token->eb->folio_size; \
68 const int unit_shift = token->eb->folio_shift; \
73 ASSERT(token); \
74 ASSERT(token->kaddr); \
75 ASSERT(check_setget_bounds(token->eb, ptr, off, size)); \
76 if (token->offset <= member_offset && \
77 member_offset + size <= token->offset + unit_size) { \
78 return get_unaligned_le##bits(token->kaddr + oil); \
80 token->kaddr = folio_address(token->eb->folios[idx]); \
81 token->offset = idx << unit_shift; \
83 return get_unaligned_le##bits(token->kaddr + oil); \
85 memcpy(lebytes, token->kaddr + oil, part); \
86 token->kaddr = folio_address(token->eb->folios[idx + 1]); \
87 token->offset = (idx + 1) << unit_shift; \
88 memcpy(lebytes + part, token->kaddr, size - part); \
113 void btrfs_set_token_##bits(struct btrfs_map_token *token, \
118 const unsigned long idx = get_eb_folio_index(token->eb, member_offset); \
119 const unsigned long oil = get_eb_offset_in_folio(token->eb, \
121 const int unit_size = token->eb->folio_size; \
122 const int unit_shift = token->eb->folio_shift; \
127 ASSERT(token); \
128 ASSERT(token->kaddr); \
129 ASSERT(check_setget_bounds(token->eb, ptr, off, size)); \
130 if (token->offset <= member_offset && \
131 member_offset + size <= token->offset + unit_size) { \
132 put_unaligned_le##bits(val, token->kaddr + oil); \
135 token->kaddr = folio_address(token->eb->folios[idx]); \
136 token->offset = idx << unit_shift; \
139 put_unaligned_le##bits(val, token->kaddr + oil); \
143 memcpy(token->kaddr + oil, lebytes, part); \
144 token->kaddr = folio_address(token->eb->folios[idx + 1]); \
145 token->offset = (idx + 1) << unit_shift; \
146 memcpy(token->kaddr, lebytes + part, size - part); \