Lines Matching refs:sbi
27 struct msdos_sb_info *sbi = MSDOS_SB(sb); in fat12_ent_blocknr() local
29 WARN_ON(entry < FAT_START_ENT || sbi->max_cluster <= entry); in fat12_ent_blocknr()
31 *blocknr = sbi->fat_start + (bytes >> sb->s_blocksize_bits); in fat12_ent_blocknr()
37 struct msdos_sb_info *sbi = MSDOS_SB(sb); in fat_ent_blocknr() local
38 int bytes = (entry << sbi->fatent_shift); in fat_ent_blocknr()
39 WARN_ON(entry < FAT_START_ENT || sbi->max_cluster <= entry); in fat_ent_blocknr()
41 *blocknr = sbi->fat_start + (bytes >> sb->s_blocksize_bits); in fat_ent_blocknr()
276 static inline void lock_fat(struct msdos_sb_info *sbi) in lock_fat() argument
278 mutex_lock(&sbi->fat_lock); in lock_fat()
281 static inline void unlock_fat(struct msdos_sb_info *sbi) in unlock_fat() argument
283 mutex_unlock(&sbi->fat_lock); in unlock_fat()
288 struct msdos_sb_info *sbi = MSDOS_SB(sb); in fat_ent_access_init() local
290 mutex_init(&sbi->fat_lock); in fat_ent_access_init()
292 switch (sbi->fat_bits) { in fat_ent_access_init()
294 sbi->fatent_shift = 2; in fat_ent_access_init()
295 sbi->fatent_ops = &fat32_ops; in fat_ent_access_init()
298 sbi->fatent_shift = 1; in fat_ent_access_init()
299 sbi->fatent_ops = &fat16_ops; in fat_ent_access_init()
302 sbi->fatent_shift = -1; in fat_ent_access_init()
303 sbi->fatent_ops = &fat12_ops; in fat_ent_access_init()
312 struct msdos_sb_info *sbi = MSDOS_SB(sb); in fat_ent_update_ptr() local
313 struct fatent_operations *ops = sbi->fatent_ops; in fat_ent_update_ptr()
319 if (sbi->fat_bits == 12) { in fat_ent_update_ptr()
341 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); in fat_ent_read() local
342 struct fatent_operations *ops = sbi->fatent_ops; in fat_ent_read()
346 if (entry < FAT_START_ENT || sbi->max_cluster <= entry) { in fat_ent_read()
368 struct msdos_sb_info *sbi = MSDOS_SB(sb); in fat_mirror_bhs() local
373 for (copy = 1; copy < sbi->fats; copy++) { in fat_mirror_bhs()
374 sector_t backup_fat = sbi->fat_length * copy; in fat_mirror_bhs()
412 static inline int fat_ent_next(struct msdos_sb_info *sbi, in fat_ent_next() argument
415 if (sbi->fatent_ops->ent_next(fatent)) { in fat_ent_next()
416 if (fatent->entry < sbi->max_cluster) in fat_ent_next()
455 struct msdos_sb_info *sbi = MSDOS_SB(sb); in fat_alloc_clusters() local
456 struct fatent_operations *ops = sbi->fatent_ops; in fat_alloc_clusters()
463 lock_fat(sbi); in fat_alloc_clusters()
464 if (sbi->free_clusters != -1 && sbi->free_clus_valid && in fat_alloc_clusters()
465 sbi->free_clusters < nr_cluster) { in fat_alloc_clusters()
466 unlock_fat(sbi); in fat_alloc_clusters()
474 fatent_set_entry(&fatent, sbi->prev_free + 1); in fat_alloc_clusters()
475 while (count < sbi->max_cluster) { in fat_alloc_clusters()
476 if (fatent.entry >= sbi->max_cluster) in fat_alloc_clusters()
495 sbi->prev_free = entry; in fat_alloc_clusters()
496 if (sbi->free_clusters != -1) in fat_alloc_clusters()
497 sbi->free_clusters--; in fat_alloc_clusters()
512 if (count == sbi->max_cluster) in fat_alloc_clusters()
514 } while (fat_ent_next(sbi, &fatent)); in fat_alloc_clusters()
518 sbi->free_clusters = 0; in fat_alloc_clusters()
519 sbi->free_clus_valid = 1; in fat_alloc_clusters()
524 unlock_fat(sbi); in fat_alloc_clusters()
544 struct msdos_sb_info *sbi = MSDOS_SB(sb); in fat_free_clusters() local
545 struct fatent_operations *ops = sbi->fatent_ops; in fat_free_clusters()
553 lock_fat(sbi); in fat_free_clusters()
573 sb_issue_discard(sb, fat_clus_to_blknr(sbi, first_cl), in fat_free_clusters()
574 nr_clus * sbi->sec_per_clus); in fat_free_clusters()
579 if (sbi->free_clusters != -1) { in fat_free_clusters()
580 sbi->free_clusters++; in fat_free_clusters()
610 unlock_fat(sbi); in fat_free_clusters()
635 struct msdos_sb_info *sbi = MSDOS_SB(sb); in fat_count_free_clusters() local
636 struct fatent_operations *ops = sbi->fatent_ops; in fat_count_free_clusters()
641 lock_fat(sbi); in fat_count_free_clusters()
642 if (sbi->free_clusters != -1 && sbi->free_clus_valid) in fat_count_free_clusters()
652 while (fatent.entry < sbi->max_cluster) { in fat_count_free_clusters()
655 unsigned long rest = sbi->fat_length - cur_block; in fat_count_free_clusters()
667 } while (fat_ent_next(sbi, &fatent)); in fat_count_free_clusters()
669 sbi->free_clusters = free; in fat_count_free_clusters()
670 sbi->free_clus_valid = 1; in fat_count_free_clusters()
674 unlock_fat(sbi); in fat_count_free_clusters()