Lines Matching refs:sbi
51 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_allocate_bitmap() local
56 sbi->map_clu = le32_to_cpu(ep->dentry.bitmap.start_clu); in exfat_allocate_bitmap()
58 need_map_size = ((EXFAT_DATA_CLUSTER_COUNT(sbi) - 1) / BITS_PER_BYTE) in exfat_allocate_bitmap()
70 sbi->map_sectors = ((need_map_size - 1) >> in exfat_allocate_bitmap()
72 sbi->vol_amap = kmalloc_array(sbi->map_sectors, in exfat_allocate_bitmap()
74 if (!sbi->vol_amap) in exfat_allocate_bitmap()
77 sector = exfat_cluster_to_sector(sbi, sbi->map_clu); in exfat_allocate_bitmap()
78 for (i = 0; i < sbi->map_sectors; i++) { in exfat_allocate_bitmap()
79 sbi->vol_amap[i] = sb_bread(sb, sector + i); in exfat_allocate_bitmap()
80 if (!sbi->vol_amap[i]) { in exfat_allocate_bitmap()
85 brelse(sbi->vol_amap[j++]); in exfat_allocate_bitmap()
87 kfree(sbi->vol_amap); in exfat_allocate_bitmap()
88 sbi->vol_amap = NULL; in exfat_allocate_bitmap()
100 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_load_bitmap() local
102 exfat_chain_set(&clu, sbi->root_dir, 0, ALLOC_FAT_CHAIN); in exfat_load_bitmap()
104 for (i = 0; i < sbi->dentries_per_clu; i++) { in exfat_load_bitmap()
134 void exfat_free_bitmap(struct exfat_sb_info *sbi) in exfat_free_bitmap() argument
138 for (i = 0; i < sbi->map_sectors; i++) in exfat_free_bitmap()
139 __brelse(sbi->vol_amap[i]); in exfat_free_bitmap()
141 kfree(sbi->vol_amap); in exfat_free_bitmap()
149 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_set_bitmap() local
151 if (!is_valid_cluster(sbi, clu)) in exfat_set_bitmap()
158 set_bit_le(b, sbi->vol_amap[i]->b_data); in exfat_set_bitmap()
159 exfat_update_bh(sbi->vol_amap[i], sync); in exfat_set_bitmap()
168 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_clear_bitmap() local
169 struct exfat_mount_options *opts = &sbi->options; in exfat_clear_bitmap()
171 if (!is_valid_cluster(sbi, clu)) in exfat_clear_bitmap()
178 clear_bit_le(b, sbi->vol_amap[i]->b_data); in exfat_clear_bitmap()
179 exfat_update_bh(sbi->vol_amap[i], sync); in exfat_clear_bitmap()
185 exfat_cluster_to_sector(sbi, clu), in exfat_clear_bitmap()
186 (1 << sbi->sect_per_clus_bits), GFP_NOFS, 0); in exfat_clear_bitmap()
204 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_find_free_bitmap() local
214 for (i = EXFAT_FIRST_CLUSTER; i < sbi->num_clusters; in exfat_find_free_bitmap()
216 k = *(sbi->vol_amap[map_i]->b_data + map_b); in exfat_find_free_bitmap()
223 if (clu_free < sbi->num_clusters) in exfat_find_free_bitmap()
229 clu_base >= sbi->num_clusters) { in exfat_find_free_bitmap()
230 if (++map_i >= sbi->map_sectors) { in exfat_find_free_bitmap()
243 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_count_used_clusters() local
246 unsigned int total_clus = EXFAT_DATA_CLUSTER_COUNT(sbi); in exfat_count_used_clusters()
254 clu_bits = *(sbi->vol_amap[map_i]->b_data + map_b); in exfat_count_used_clusters()
263 clu_bits = *(sbi->vol_amap[map_i]->b_data + map_b); in exfat_count_used_clusters()
277 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_trim_fs() local
280 clu_start = max_t(u64, range->start >> sbi->cluster_size_bits, in exfat_trim_fs()
282 clu_end = clu_start + (range->len >> sbi->cluster_size_bits) - 1; in exfat_trim_fs()
283 trim_minlen = range->minlen >> sbi->cluster_size_bits; in exfat_trim_fs()
285 if (clu_start >= sbi->num_clusters || range->len < sbi->cluster_size) in exfat_trim_fs()
288 if (clu_end >= sbi->num_clusters) in exfat_trim_fs()
289 clu_end = sbi->num_clusters - 1; in exfat_trim_fs()
291 mutex_lock(&sbi->bitmap_lock); in exfat_trim_fs()
310 exfat_cluster_to_sector(sbi, trim_begin), in exfat_trim_fs()
311 count * sbi->sect_per_clus, GFP_NOFS, 0); in exfat_trim_fs()
337 err = sb_issue_discard(sb, exfat_cluster_to_sector(sbi, trim_begin), in exfat_trim_fs()
338 count * sbi->sect_per_clus, GFP_NOFS, 0); in exfat_trim_fs()
346 mutex_unlock(&sbi->bitmap_lock); in exfat_trim_fs()
347 range->len = trimmed_total << sbi->cluster_size_bits; in exfat_trim_fs()