Lines Matching full:sbi
41 struct affs_sb_info *sbi = AFFS_SB(sb); in affs_free_block() local
49 if (block > sbi->s_partition_size) in affs_free_block()
52 blk = block - sbi->s_reserved; in affs_free_block()
53 bmap = blk / sbi->s_bmap_bits; in affs_free_block()
54 bit = blk % sbi->s_bmap_bits; in affs_free_block()
55 bm = &sbi->s_bitmap[bmap]; in affs_free_block()
57 mutex_lock(&sbi->s_bmlock); in affs_free_block()
59 bh = sbi->s_bmap_bh; in affs_free_block()
60 if (sbi->s_last_bmap != bmap) { in affs_free_block()
65 sbi->s_bmap_bh = bh; in affs_free_block()
66 sbi->s_last_bmap = bmap; in affs_free_block()
86 mutex_unlock(&sbi->s_bmlock); in affs_free_block()
91 mutex_unlock(&sbi->s_bmlock); in affs_free_block()
96 sbi->s_bmap_bh = NULL; in affs_free_block()
97 sbi->s_last_bmap = ~0; in affs_free_block()
98 mutex_unlock(&sbi->s_bmlock); in affs_free_block()
118 struct affs_sb_info *sbi; in affs_alloc_block() local
126 sbi = AFFS_SB(sb); in affs_alloc_block()
136 if (!goal || goal > sbi->s_partition_size) { in affs_alloc_block()
141 goal = sbi->s_reserved; in affs_alloc_block()
144 blk = goal - sbi->s_reserved; in affs_alloc_block()
145 bmap = blk / sbi->s_bmap_bits; in affs_alloc_block()
146 bm = &sbi->s_bitmap[bmap]; in affs_alloc_block()
148 mutex_lock(&sbi->s_bmlock); in affs_alloc_block()
155 i = sbi->s_bmap_count; in affs_alloc_block()
161 if (bmap < sbi->s_bmap_count) in affs_alloc_block()
165 bm = sbi->s_bitmap; in affs_alloc_block()
167 blk = bmap * sbi->s_bmap_bits; in affs_alloc_block()
171 bh = sbi->s_bmap_bh; in affs_alloc_block()
172 if (sbi->s_last_bmap != bmap) { in affs_alloc_block()
177 sbi->s_bmap_bh = bh; in affs_alloc_block()
178 sbi->s_last_bmap = bmap; in affs_alloc_block()
182 bit = blk % sbi->s_bmap_bits; in affs_alloc_block()
207 blk += bit + sbi->s_reserved; in affs_alloc_block()
229 mutex_unlock(&sbi->s_bmlock); in affs_alloc_block()
236 sbi->s_bmap_bh = NULL; in affs_alloc_block()
237 sbi->s_last_bmap = ~0; in affs_alloc_block()
239 mutex_unlock(&sbi->s_bmlock); in affs_alloc_block()
251 struct affs_sb_info *sbi = AFFS_SB(sb); in affs_init_bitmap() local
256 if (!AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag) { in affs_init_bitmap()
262 sbi->s_last_bmap = ~0; in affs_init_bitmap()
263 sbi->s_bmap_bh = NULL; in affs_init_bitmap()
264 sbi->s_bmap_bits = sb->s_blocksize * 8 - 32; in affs_init_bitmap()
265 sbi->s_bmap_count = (sbi->s_partition_size - sbi->s_reserved + in affs_init_bitmap()
266 sbi->s_bmap_bits - 1) / sbi->s_bmap_bits; in affs_init_bitmap()
267 size = sbi->s_bmap_count * sizeof(*bm); in affs_init_bitmap()
268 bm = sbi->s_bitmap = kzalloc(size, GFP_KERNEL); in affs_init_bitmap()
269 if (!sbi->s_bitmap) { in affs_init_bitmap()
274 bmap_blk = (__be32 *)sbi->s_root_bh->b_data; in affs_init_bitmap()
278 for (i = sbi->s_bmap_count; i > 0; bm++, i--) { in affs_init_bitmap()
315 offset = (sbi->s_partition_size - sbi->s_reserved) % sbi->s_bmap_bits; in affs_init_bitmap()
355 struct affs_sb_info *sbi = AFFS_SB(sb); in affs_free_bitmap() local
357 if (!sbi->s_bitmap) in affs_free_bitmap()
360 affs_brelse(sbi->s_bmap_bh); in affs_free_bitmap()
361 sbi->s_bmap_bh = NULL; in affs_free_bitmap()
362 sbi->s_last_bmap = ~0; in affs_free_bitmap()
363 kfree(sbi->s_bitmap); in affs_free_bitmap()
364 sbi->s_bitmap = NULL; in affs_free_bitmap()