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()
130 static int afs_dir_scan_block(union afs_xdr_dir_block *block, struct qstr *name, in afs_dir_scan_block() argument
139 bitmap = (u64)block->hdr.bitmap[0] << 0 * 8; in afs_dir_scan_block()
140 bitmap |= (u64)block->hdr.bitmap[1] << 1 * 8; in afs_dir_scan_block()
141 bitmap |= (u64)block->hdr.bitmap[2] << 2 * 8; in afs_dir_scan_block()
142 bitmap |= (u64)block->hdr.bitmap[3] << 3 * 8; in afs_dir_scan_block()
143 bitmap |= (u64)block->hdr.bitmap[4] << 4 * 8; in afs_dir_scan_block()
144 bitmap |= (u64)block->hdr.bitmap[5] << 5 * 8; in afs_dir_scan_block()
145 bitmap |= (u64)block->hdr.bitmap[6] << 6 * 8; in afs_dir_scan_block()
146 bitmap |= (u64)block->hdr.bitmap[7] << 7 * 8; in afs_dir_scan_block()
153 de = &block->dirents[d]; in afs_dir_scan_block()
176 union afs_xdr_dir_block *block, int block_num) in afs_edit_init_block() argument
178 memset(block, 0, sizeof(*block)); in afs_edit_init_block()
179 block->hdr.npages = htons(1); in afs_edit_init_block()
180 block->hdr.magic = AFS_DIR_MAGIC; in afs_edit_init_block()
181 block->hdr.bitmap[0] = 1; in afs_edit_init_block()
184 block->hdr.bitmap[0] = 0xff; in afs_edit_init_block()
185 block->hdr.bitmap[1] = 0x1f; in afs_edit_init_block()
186 memset(block->meta.alloc_ctrs, in afs_edit_init_block()
188 sizeof(block->meta.alloc_ctrs)); in afs_edit_init_block()
210 union afs_xdr_dir_block *meta, *block; in afs_edit_dir_add() local
259 block = kmap_local_folio(folio, b * AFS_DIR_BLOCK_SIZE - folio_file_pos(folio)); in afs_edit_dir_add()
268 ntohs(block->hdr.npages), in afs_edit_dir_add()
269 ntohs(block->hdr.magic)); in afs_edit_dir_add()
274 afs_edit_init_block(meta, block, b); in afs_edit_dir_add()
284 slot = afs_find_contig_bits(block, need_slots); in afs_edit_dir_add()
291 kunmap_local(block); in afs_edit_dir_add()
311 block = kmap_local_folio(folio, 0); in afs_edit_dir_add()
319 de = &block->dirents[slot]; in afs_edit_dir_add()
329 afs_set_contig_bits(block, slot, need_slots); in afs_edit_dir_add()
330 kunmap_local(block); in afs_edit_dir_add()
354 kunmap_local(block); in afs_edit_dir_add()
377 union afs_xdr_dir_block *meta, *block; in afs_edit_dir_remove() local
420 block = kmap_local_folio(folio, b * AFS_DIR_BLOCK_SIZE - folio_file_pos(folio)); in afs_edit_dir_remove()
428 slot = afs_dir_scan_block(block, name, b); in afs_edit_dir_remove()
433 kunmap_local(block); in afs_edit_dir_remove()
447 de = &block->dirents[slot]; in afs_edit_dir_remove()
456 afs_clear_contig_bits(block, slot, need_slots); in afs_edit_dir_remove()
457 kunmap_local(block); in afs_edit_dir_remove()
482 kunmap_local(block); in afs_edit_dir_remove()