Lines Matching full:block
17 * Find a number of contiguous clear bits in a directory block bitmask.
20 * variable. The first bit doesn't count as it corresponds to the block header
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()
66 * Set a number of contiguous bits in the directory block bitmap.
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()
87 * Clear a number of contiguous bits in the directory block bitmap.
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()
108 * Scan a directory block looking for a dirent of the right name.
110 static int afs_dir_scan_block(union afs_xdr_dir_block *block, struct qstr *name, in afs_dir_scan_block() argument
119 bitmap = (u64)block->hdr.bitmap[0] << 0 * 8; in afs_dir_scan_block()
120 bitmap |= (u64)block->hdr.bitmap[1] << 1 * 8; in afs_dir_scan_block()
121 bitmap |= (u64)block->hdr.bitmap[2] << 2 * 8; in afs_dir_scan_block()
122 bitmap |= (u64)block->hdr.bitmap[3] << 3 * 8; in afs_dir_scan_block()
123 bitmap |= (u64)block->hdr.bitmap[4] << 4 * 8; in afs_dir_scan_block()
124 bitmap |= (u64)block->hdr.bitmap[5] << 5 * 8; in afs_dir_scan_block()
125 bitmap |= (u64)block->hdr.bitmap[6] << 6 * 8; in afs_dir_scan_block()
126 bitmap |= (u64)block->hdr.bitmap[7] << 7 * 8; in afs_dir_scan_block()
133 de = &block->dirents[d]; in afs_dir_scan_block()
137 /* The block was NUL-terminated by afs_dir_check_page(). */ in afs_dir_scan_block()
152 * Initialise a new directory block. Note that block 0 is special and contains
156 union afs_xdr_dir_block *block, int block_num) in afs_edit_init_block() argument
158 memset(block, 0, sizeof(*block)); in afs_edit_init_block()
159 block->hdr.npages = htons(1); in afs_edit_init_block()
160 block->hdr.magic = AFS_DIR_MAGIC; in afs_edit_init_block()
161 block->hdr.bitmap[0] = 1; in afs_edit_init_block()
164 block->hdr.bitmap[0] = 0xff; in afs_edit_init_block()
165 block->hdr.bitmap[1] = 0x1f; in afs_edit_init_block()
166 memset(block->meta.alloc_ctrs, in afs_edit_init_block()
168 sizeof(block->meta.alloc_ctrs)); in afs_edit_init_block()
190 union afs_xdr_dir_block *meta, *block; in afs_edit_dir_add() local
227 /* Find a block that has sufficient slots available. Each VM page in afs_edit_dir_add()
255 block = &dir_page->blocks[b % AFS_DIR_BLOCKS_PER_PAGE]; in afs_edit_dir_add()
257 _debug("block %u: %2u %3u %u", in afs_edit_dir_add()
260 ntohs(block->hdr.npages), in afs_edit_dir_add()
261 ntohs(block->hdr.magic)); in afs_edit_dir_add()
263 /* Initialise the block if necessary. */ in afs_edit_dir_add()
266 afs_edit_init_block(meta, block, b); in afs_edit_dir_add()
276 slot = afs_find_contig_bits(block, need_slots); in afs_edit_dir_add()
303 block = meta; in afs_edit_dir_add()
311 de = &block->dirents[slot]; in afs_edit_dir_add()
321 afs_set_contig_bits(block, slot, need_slots); in afs_edit_dir_add()
369 union afs_xdr_dir_block *meta, *block; in afs_edit_dir_remove() local
421 block = &dir_page->blocks[b % AFS_DIR_BLOCKS_PER_PAGE]; in afs_edit_dir_remove()
425 slot = afs_dir_scan_block(block, name, b); in afs_edit_dir_remove()
444 de = &block->dirents[slot]; in afs_edit_dir_remove()
453 afs_clear_contig_bits(block, slot, need_slots); in afs_edit_dir_remove()