Lines Matching full:sbi
32 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_allocate_bitmap() local
37 sbi->map_clu = le32_to_cpu(ep->dentry.bitmap.start_clu); in exfat_allocate_bitmap()
39 need_map_size = ((EXFAT_DATA_CLUSTER_COUNT(sbi) - 1) / BITS_PER_BYTE) in exfat_allocate_bitmap()
51 sbi->map_sectors = ((need_map_size - 1) >> in exfat_allocate_bitmap()
53 sbi->vol_amap = kvmalloc_array(sbi->map_sectors, in exfat_allocate_bitmap()
55 if (!sbi->vol_amap) in exfat_allocate_bitmap()
58 sector = exfat_cluster_to_sector(sbi, sbi->map_clu); in exfat_allocate_bitmap()
59 for (i = 0; i < sbi->map_sectors; i++) { in exfat_allocate_bitmap()
60 sbi->vol_amap[i] = sb_bread(sb, sector + i); in exfat_allocate_bitmap()
61 if (!sbi->vol_amap[i]) { in exfat_allocate_bitmap()
66 brelse(sbi->vol_amap[j++]); in exfat_allocate_bitmap()
68 kvfree(sbi->vol_amap); in exfat_allocate_bitmap()
69 sbi->vol_amap = NULL; in exfat_allocate_bitmap()
81 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_load_bitmap() local
83 exfat_chain_set(&clu, sbi->root_dir, 0, ALLOC_FAT_CHAIN); in exfat_load_bitmap()
85 for (i = 0; i < sbi->dentries_per_clu; i++) { in exfat_load_bitmap()
115 void exfat_free_bitmap(struct exfat_sb_info *sbi) in exfat_free_bitmap() argument
119 for (i = 0; i < sbi->map_sectors; i++) in exfat_free_bitmap()
120 __brelse(sbi->vol_amap[i]); in exfat_free_bitmap()
122 kvfree(sbi->vol_amap); in exfat_free_bitmap()
130 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_set_bitmap() local
132 if (!is_valid_cluster(sbi, clu)) in exfat_set_bitmap()
139 set_bit_le(b, sbi->vol_amap[i]->b_data); in exfat_set_bitmap()
140 exfat_update_bh(sbi->vol_amap[i], sync); in exfat_set_bitmap()
149 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_clear_bitmap() local
150 struct exfat_mount_options *opts = &sbi->options; in exfat_clear_bitmap()
152 if (!is_valid_cluster(sbi, clu)) in exfat_clear_bitmap()
159 clear_bit_le(b, sbi->vol_amap[i]->b_data); in exfat_clear_bitmap()
160 exfat_update_bh(sbi->vol_amap[i], sync); in exfat_clear_bitmap()
166 exfat_cluster_to_sector(sbi, clu), in exfat_clear_bitmap()
167 (1 << sbi->sect_per_clus_bits), GFP_NOFS, 0); in exfat_clear_bitmap()
185 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_find_free_bitmap() local
196 for (i = EXFAT_FIRST_CLUSTER; i < sbi->num_clusters; in exfat_find_free_bitmap()
198 bitval = *(__le_long *)(sbi->vol_amap[map_i]->b_data + map_b); in exfat_find_free_bitmap()
206 if (clu_free < sbi->num_clusters) in exfat_find_free_bitmap()
213 clu_base >= sbi->num_clusters) { in exfat_find_free_bitmap()
214 if (++map_i >= sbi->map_sectors) { in exfat_find_free_bitmap()
227 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_count_used_clusters() local
230 unsigned int total_clus = EXFAT_DATA_CLUSTER_COUNT(sbi); in exfat_count_used_clusters()
236 bitmap = (void *)(sbi->vol_amap[map_i]->b_data + map_b); in exfat_count_used_clusters()
246 bitmap = (void *)(sbi->vol_amap[map_i]->b_data + map_b); in exfat_count_used_clusters()
260 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_trim_fs() local
263 clu_start = max_t(u64, range->start >> sbi->cluster_size_bits, in exfat_trim_fs()
265 clu_end = clu_start + (range->len >> sbi->cluster_size_bits) - 1; in exfat_trim_fs()
266 trim_minlen = range->minlen >> sbi->cluster_size_bits; in exfat_trim_fs()
268 if (clu_start >= sbi->num_clusters || range->len < sbi->cluster_size) in exfat_trim_fs()
271 if (clu_end >= sbi->num_clusters) in exfat_trim_fs()
272 clu_end = sbi->num_clusters - 1; in exfat_trim_fs()
274 mutex_lock(&sbi->bitmap_lock); in exfat_trim_fs()
293 exfat_cluster_to_sector(sbi, trim_begin), in exfat_trim_fs()
294 count * sbi->sect_per_clus, GFP_NOFS, 0); in exfat_trim_fs()
320 err = sb_issue_discard(sb, exfat_cluster_to_sector(sbi, trim_begin), in exfat_trim_fs()
321 count * sbi->sect_per_clus, GFP_NOFS, 0); in exfat_trim_fs()
329 mutex_unlock(&sbi->bitmap_lock); in exfat_trim_fs()
330 range->len = trimmed_total << sbi->cluster_size_bits; in exfat_trim_fs()