Lines Matching refs:sbi
45 struct sysv_sb_info * sbi = SYSV_SB(sb); in sysv_free_block() local
47 sysv_zone_t *blocks = sbi->s_bcache; in sysv_free_block()
49 unsigned block = fs32_to_cpu(sbi, nr); in sysv_free_block()
56 if (sbi->s_type == FSTYPE_AFS) in sysv_free_block()
59 if (block < sbi->s_firstdatazone || block >= sbi->s_nzones) { in sysv_free_block()
64 mutex_lock(&sbi->s_lock); in sysv_free_block()
65 count = fs16_to_cpu(sbi, *sbi->s_bcache_count); in sysv_free_block()
67 if (count > sbi->s_flc_size) { in sysv_free_block()
69 mutex_unlock(&sbi->s_lock); in sysv_free_block()
76 if (count == sbi->s_flc_size || count == 0) { in sysv_free_block()
77 block += sbi->s_block_base; in sysv_free_block()
81 mutex_unlock(&sbi->s_lock); in sysv_free_block()
85 *(__fs16*)bh->b_data = cpu_to_fs16(sbi, count); in sysv_free_block()
92 sbi->s_bcache[count++] = nr; in sysv_free_block()
94 *sbi->s_bcache_count = cpu_to_fs16(sbi, count); in sysv_free_block()
95 fs32_add(sbi, sbi->s_free_blocks, 1); in sysv_free_block()
97 mutex_unlock(&sbi->s_lock); in sysv_free_block()
102 struct sysv_sb_info *sbi = SYSV_SB(sb); in sysv_new_block() local
108 mutex_lock(&sbi->s_lock); in sysv_new_block()
109 count = fs16_to_cpu(sbi, *sbi->s_bcache_count); in sysv_new_block()
113 nr = sbi->s_bcache[--count]; in sysv_new_block()
117 block = fs32_to_cpu(sbi, nr); in sysv_new_block()
119 *sbi->s_bcache_count = cpu_to_fs16(sbi, count); in sysv_new_block()
121 if (block < sbi->s_firstdatazone || block >= sbi->s_nzones) { in sysv_new_block()
130 block += sbi->s_block_base; in sysv_new_block()
134 *sbi->s_bcache_count = cpu_to_fs16(sbi, 1); in sysv_new_block()
137 count = fs16_to_cpu(sbi, *(__fs16*)bh->b_data); in sysv_new_block()
138 if (count > sbi->s_flc_size) { in sysv_new_block()
143 *sbi->s_bcache_count = cpu_to_fs16(sbi, count); in sysv_new_block()
144 memcpy(sbi->s_bcache, get_chunk(sb, bh), in sysv_new_block()
149 fs32_add(sbi, sbi->s_free_blocks, -1); in sysv_new_block()
151 mutex_unlock(&sbi->s_lock); in sysv_new_block()
155 mutex_unlock(&sbi->s_lock); in sysv_new_block()
161 struct sysv_sb_info * sbi = SYSV_SB(sb); in sysv_count_free_blocks() local
174 if (sbi->s_type == FSTYPE_AFS) in sysv_count_free_blocks()
177 mutex_lock(&sbi->s_lock); in sysv_count_free_blocks()
178 sb_count = fs32_to_cpu(sbi, *sbi->s_free_blocks); in sysv_count_free_blocks()
185 n = fs16_to_cpu(sbi, *sbi->s_bcache_count); in sysv_count_free_blocks()
186 blocks = sbi->s_bcache; in sysv_count_free_blocks()
189 if (n > sbi->s_flc_size) in sysv_count_free_blocks()
197 block = fs32_to_cpu(sbi, zone); in sysv_count_free_blocks()
201 if (block < sbi->s_firstdatazone || block >= sbi->s_nzones) in sysv_count_free_blocks()
203 block += sbi->s_block_base; in sysv_count_free_blocks()
207 n = fs16_to_cpu(sbi, *(__fs16*)bh->b_data); in sysv_count_free_blocks()
215 mutex_unlock(&sbi->s_lock); in sysv_count_free_blocks()
236 *sbi->s_free_blocks = cpu_to_fs32(sbi, count); in sysv_count_free_blocks()