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 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3,/* 0 ~ 19*/
31 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4,/* 20 ~ 39*/
32 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5,/* 40 ~ 59*/
33 4, 5, 5, 6, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,/* 60 ~ 79*/
34 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4,/* 80 ~ 99*/
35 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6,/*100 ~ 119*/
36 4, 5, 5, 6, 5, 6, 6, 7, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4,/*120 ~ 139*/
37 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,/*140 ~ 159*/
38 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5,/*160 ~ 179*/
39 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 2, 3, 3, 4, 3, 4, 4, 5,/*180 ~ 199*/
40 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6,/*200 ~ 219*/
41 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,/*220 ~ 239*/
56 sbi->map_clu = le32_to_cpu(ep->dentry.bitmap.start_clu); in exfat_allocate_bitmap()
57 map_size = le64_to_cpu(ep->dentry.bitmap.size); in exfat_allocate_bitmap()
58 need_map_size = ((EXFAT_DATA_CLUSTER_COUNT(sbi) - 1) / BITS_PER_BYTE) in exfat_allocate_bitmap()
68 return -EIO; in exfat_allocate_bitmap()
70 sbi->map_sectors = ((need_map_size - 1) >> in exfat_allocate_bitmap()
71 (sb->s_blocksize_bits)) + 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()
75 return -ENOMEM; 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()
82 int j = 0; 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()
89 return -EIO; in exfat_allocate_bitmap()
93 return 0; in exfat_allocate_bitmap()
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()
110 return -EIO; in exfat_load_bitmap()
117 if (ep->dentry.bitmap.flags == 0x0) { in exfat_load_bitmap()
128 return -EIO; in exfat_load_bitmap()
131 return -EINVAL; in exfat_load_bitmap()
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()
145 * If the value of "clu" is 0, it means cluster 2 which is the first cluster of
152 struct super_block *sb = inode->i_sb; in exfat_set_bitmap()
160 set_bit_le(b, sbi->vol_amap[i]->b_data); in exfat_set_bitmap()
161 exfat_update_bh(sbi->vol_amap[i], IS_DIRSYNC(inode)); in exfat_set_bitmap()
162 return 0; in exfat_set_bitmap()
166 * If the value of "clu" is 0, it means cluster 2 which is the first cluster of
173 struct super_block *sb = inode->i_sb; in exfat_clear_bitmap()
175 struct exfat_mount_options *opts = &sbi->options; in exfat_clear_bitmap()
182 clear_bit_le(b, sbi->vol_amap[i]->b_data); in exfat_clear_bitmap()
183 exfat_update_bh(sbi->vol_amap[i], IS_DIRSYNC(inode)); in exfat_clear_bitmap()
185 if (opts->discard) { in exfat_clear_bitmap()
191 (1 << sbi->sect_per_clus_bits), GFP_NOFS, 0); in exfat_clear_bitmap()
193 if (ret_discard == -EOPNOTSUPP) { in exfat_clear_bitmap()
195 opts->discard = 0; in exfat_clear_bitmap()
201 * If the value of "clu" is 0, it means cluster 2 which is the first cluster of
219 for (i = EXFAT_FIRST_CLUSTER; i < sbi->num_clusters; in exfat_find_free_bitmap()
221 k = *(sbi->vol_amap[map_i]->b_data + map_b); in exfat_find_free_bitmap()
222 if (clu_mask > 0) { in exfat_find_free_bitmap()
224 clu_mask = 0; in exfat_find_free_bitmap()
226 if (k < 0xFF) { in exfat_find_free_bitmap()
228 if (clu_free < sbi->num_clusters) in exfat_find_free_bitmap()
233 if (++map_b >= sb->s_blocksize || in exfat_find_free_bitmap()
234 clu_base >= sbi->num_clusters) { in exfat_find_free_bitmap()
235 if (++map_i >= sbi->map_sectors) { in exfat_find_free_bitmap()
237 map_i = 0; in exfat_find_free_bitmap()
239 map_b = 0; in exfat_find_free_bitmap()
249 unsigned int count = 0; in exfat_count_used_clusters()
250 unsigned int i, map_i = 0, map_b = 0; in exfat_count_used_clusters()
254 const unsigned char last_bit_mask[] = {0, 0b00000001, 0b00000011, in exfat_count_used_clusters()
255 0b00000111, 0b00001111, 0b00011111, 0b00111111, 0b01111111}; in exfat_count_used_clusters()
258 for (i = 0; i < total_clus; i += BITS_PER_BYTE) { in exfat_count_used_clusters()
259 clu_bits = *(sbi->vol_amap[map_i]->b_data + map_b); in exfat_count_used_clusters()
261 if (++map_b >= (unsigned int)sb->s_blocksize) { in exfat_count_used_clusters()
263 map_b = 0; in exfat_count_used_clusters()
268 clu_bits = *(sbi->vol_amap[map_i]->b_data + map_b); in exfat_count_used_clusters()
274 return 0; in exfat_count_used_clusters()