Lines Matching refs:block
23 static int afs_find_contig_bits(union afs_xdr_dir_block *block, unsigned int nr_slots) in afs_find_contig_bits() argument
29 bitmap = (u64)block->hdr.bitmap[0] << 0 * 8; in afs_find_contig_bits()
30 bitmap |= (u64)block->hdr.bitmap[1] << 1 * 8; in afs_find_contig_bits()
31 bitmap |= (u64)block->hdr.bitmap[2] << 2 * 8; in afs_find_contig_bits()
32 bitmap |= (u64)block->hdr.bitmap[3] << 3 * 8; in afs_find_contig_bits()
33 bitmap |= (u64)block->hdr.bitmap[4] << 4 * 8; in afs_find_contig_bits()
34 bitmap |= (u64)block->hdr.bitmap[5] << 5 * 8; in afs_find_contig_bits()
35 bitmap |= (u64)block->hdr.bitmap[6] << 6 * 8; in afs_find_contig_bits()
36 bitmap |= (u64)block->hdr.bitmap[7] << 7 * 8; in afs_find_contig_bits()
68 static void afs_set_contig_bits(union afs_xdr_dir_block *block, in afs_set_contig_bits() argument
76 block->hdr.bitmap[0] |= (u8)(mask >> 0 * 8); in afs_set_contig_bits()
77 block->hdr.bitmap[1] |= (u8)(mask >> 1 * 8); in afs_set_contig_bits()
78 block->hdr.bitmap[2] |= (u8)(mask >> 2 * 8); in afs_set_contig_bits()
79 block->hdr.bitmap[3] |= (u8)(mask >> 3 * 8); in afs_set_contig_bits()
80 block->hdr.bitmap[4] |= (u8)(mask >> 4 * 8); in afs_set_contig_bits()
81 block->hdr.bitmap[5] |= (u8)(mask >> 5 * 8); in afs_set_contig_bits()
82 block->hdr.bitmap[6] |= (u8)(mask >> 6 * 8); in afs_set_contig_bits()
83 block->hdr.bitmap[7] |= (u8)(mask >> 7 * 8); in afs_set_contig_bits()
89 static void afs_clear_contig_bits(union afs_xdr_dir_block *block, in afs_clear_contig_bits() argument
97 block->hdr.bitmap[0] &= ~(u8)(mask >> 0 * 8); in afs_clear_contig_bits()
98 block->hdr.bitmap[1] &= ~(u8)(mask >> 1 * 8); in afs_clear_contig_bits()
99 block->hdr.bitmap[2] &= ~(u8)(mask >> 2 * 8); in afs_clear_contig_bits()
100 block->hdr.bitmap[3] &= ~(u8)(mask >> 3 * 8); in afs_clear_contig_bits()
101 block->hdr.bitmap[4] &= ~(u8)(mask >> 4 * 8); in afs_clear_contig_bits()
102 block->hdr.bitmap[5] &= ~(u8)(mask >> 5 * 8); in afs_clear_contig_bits()
103 block->hdr.bitmap[6] &= ~(u8)(mask >> 6 * 8); in afs_clear_contig_bits()
104 block->hdr.bitmap[7] &= ~(u8)(mask >> 7 * 8); in afs_clear_contig_bits()
129 static int afs_dir_scan_block(union afs_xdr_dir_block *block, struct qstr *name, in afs_dir_scan_block() argument
138 bitmap = (u64)block->hdr.bitmap[0] << 0 * 8; in afs_dir_scan_block()
139 bitmap |= (u64)block->hdr.bitmap[1] << 1 * 8; in afs_dir_scan_block()
140 bitmap |= (u64)block->hdr.bitmap[2] << 2 * 8; in afs_dir_scan_block()
141 bitmap |= (u64)block->hdr.bitmap[3] << 3 * 8; in afs_dir_scan_block()
142 bitmap |= (u64)block->hdr.bitmap[4] << 4 * 8; in afs_dir_scan_block()
143 bitmap |= (u64)block->hdr.bitmap[5] << 5 * 8; in afs_dir_scan_block()
144 bitmap |= (u64)block->hdr.bitmap[6] << 6 * 8; in afs_dir_scan_block()
145 bitmap |= (u64)block->hdr.bitmap[7] << 7 * 8; in afs_dir_scan_block()
152 de = &block->dirents[d]; in afs_dir_scan_block()
175 union afs_xdr_dir_block *block, int block_num) in afs_edit_init_block() argument
177 memset(block, 0, sizeof(*block)); in afs_edit_init_block()
178 block->hdr.npages = htons(1); in afs_edit_init_block()
179 block->hdr.magic = AFS_DIR_MAGIC; in afs_edit_init_block()
180 block->hdr.bitmap[0] = 1; in afs_edit_init_block()
183 block->hdr.bitmap[0] = 0xff; in afs_edit_init_block()
184 block->hdr.bitmap[1] = 0x1f; in afs_edit_init_block()
185 memset(block->meta.alloc_ctrs, in afs_edit_init_block()
187 sizeof(block->meta.alloc_ctrs)); in afs_edit_init_block()
209 union afs_xdr_dir_block *meta, *block; in afs_edit_dir_add() local
258 block = kmap_local_folio(folio, b * AFS_DIR_BLOCK_SIZE - folio_file_pos(folio)); in afs_edit_dir_add()
267 ntohs(block->hdr.npages), in afs_edit_dir_add()
268 ntohs(block->hdr.magic)); in afs_edit_dir_add()
273 afs_edit_init_block(meta, block, b); in afs_edit_dir_add()
283 slot = afs_find_contig_bits(block, need_slots); in afs_edit_dir_add()
290 kunmap_local(block); in afs_edit_dir_add()
310 block = kmap_local_folio(folio, 0); in afs_edit_dir_add()
318 de = &block->dirents[slot]; in afs_edit_dir_add()
328 afs_set_contig_bits(block, slot, need_slots); in afs_edit_dir_add()
329 kunmap_local(block); in afs_edit_dir_add()
353 kunmap_local(block); in afs_edit_dir_add()
376 union afs_xdr_dir_block *meta, *block; in afs_edit_dir_remove() local
419 block = kmap_local_folio(folio, b * AFS_DIR_BLOCK_SIZE - folio_file_pos(folio)); in afs_edit_dir_remove()
427 slot = afs_dir_scan_block(block, name, b); in afs_edit_dir_remove()
432 kunmap_local(block); in afs_edit_dir_remove()
446 de = &block->dirents[slot]; in afs_edit_dir_remove()
455 afs_clear_contig_bits(block, slot, need_slots); in afs_edit_dir_remove()
456 kunmap_local(block); in afs_edit_dir_remove()
481 kunmap_local(block); in afs_edit_dir_remove()