Lines Matching refs:sbi

115 	struct msdos_sb_info *sbi = MSDOS_SB(sb);  in __fat_get_block()  local
137 offset = (unsigned long)iblock & (sbi->sec_per_clus - 1); in __fat_get_block()
145 mapped_blocks = sbi->sec_per_clus - offset; in __fat_get_block()
336 struct msdos_sb_info *sbi = MSDOS_SB(sb); in fat_hash_init() local
339 spin_lock_init(&sbi->inode_hash_lock); in fat_hash_init()
341 INIT_HLIST_HEAD(&sbi->inode_hashtable[i]); in fat_hash_init()
351 struct msdos_sb_info *sbi = MSDOS_SB(sb); in dir_hash_init() local
354 spin_lock_init(&sbi->dir_hash_lock); in dir_hash_init()
356 INIT_HLIST_HEAD(&sbi->dir_hashtable[i]); in dir_hash_init()
361 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); in fat_attach() local
364 struct hlist_head *head = sbi->inode_hashtable in fat_attach()
367 spin_lock(&sbi->inode_hash_lock); in fat_attach()
370 spin_unlock(&sbi->inode_hash_lock); in fat_attach()
377 if (S_ISDIR(inode->i_mode) && sbi->options.nfs) { in fat_attach()
378 struct hlist_head *d_head = sbi->dir_hashtable; in fat_attach()
381 spin_lock(&sbi->dir_hash_lock); in fat_attach()
383 spin_unlock(&sbi->dir_hash_lock); in fat_attach()
390 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); in fat_detach() local
391 spin_lock(&sbi->inode_hash_lock); in fat_detach()
394 spin_unlock(&sbi->inode_hash_lock); in fat_detach()
396 if (S_ISDIR(inode->i_mode) && sbi->options.nfs) { in fat_detach()
397 spin_lock(&sbi->dir_hash_lock); in fat_detach()
399 spin_unlock(&sbi->dir_hash_lock); in fat_detach()
406 struct msdos_sb_info *sbi = MSDOS_SB(sb); in fat_iget() local
407 struct hlist_head *head = sbi->inode_hashtable + fat_hash(i_pos); in fat_iget()
411 spin_lock(&sbi->inode_hash_lock); in fat_iget()
420 spin_unlock(&sbi->inode_hash_lock); in fat_iget()
436 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); in fat_calc_dir_size() local
446 inode->i_size = (fclus + 1) << sbi->cluster_bits; in fat_calc_dir_size()
454 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); in fat_fill_inode() local
458 inode->i_uid = sbi->options.fs_uid; in fat_fill_inode()
459 inode->i_gid = sbi->options.fs_gid; in fat_fill_inode()
465 inode->i_mode = fat_make_mode(sbi, de->attr, S_IRWXUGO); in fat_fill_inode()
466 inode->i_op = sbi->dir_ops; in fat_fill_inode()
469 MSDOS_I(inode)->i_start = fat_get_start(sbi, de); in fat_fill_inode()
479 inode->i_mode = fat_make_mode(sbi, de->attr, in fat_fill_inode()
480 ((sbi->options.showexec && !is_exec(de->name + 8)) in fat_fill_inode()
482 MSDOS_I(inode)->i_start = fat_get_start(sbi, de); in fat_fill_inode()
492 if (sbi->options.sys_immutable) in fat_fill_inode()
497 inode->i_blocks = ((inode->i_size + (sbi->cluster_size - 1)) in fat_fill_inode()
498 & ~((loff_t)sbi->cluster_size - 1)) >> 9; in fat_fill_inode()
500 fat_time_fat2unix(sbi, &inode->i_mtime, de->time, de->date, 0); in fat_fill_inode()
501 if (sbi->options.isvfat) { in fat_fill_inode()
502 fat_time_fat2unix(sbi, &inode->i_ctime, de->ctime, in fat_fill_inode()
504 fat_time_fat2unix(sbi, &inode->i_atime, 0, de->adate, 0); in fat_fill_inode()
511 static inline void fat_lock_build_inode(struct msdos_sb_info *sbi) in fat_lock_build_inode() argument
513 if (sbi->options.nfs == FAT_NFS_NOSTALE_RO) in fat_lock_build_inode()
514 mutex_lock(&sbi->nfs_build_inode_lock); in fat_lock_build_inode()
517 static inline void fat_unlock_build_inode(struct msdos_sb_info *sbi) in fat_unlock_build_inode() argument
519 if (sbi->options.nfs == FAT_NFS_NOSTALE_RO) in fat_unlock_build_inode()
520 mutex_unlock(&sbi->nfs_build_inode_lock); in fat_unlock_build_inode()
573 struct msdos_sb_info *sbi = MSDOS_SB(sb); in fat_set_state() local
580 if (sbi->dirty) { in fat_set_state()
598 if (sbi->fat_bits == 32) { in fat_set_state()
617 struct msdos_sb_info *sbi = container_of(p, struct msdos_sb_info, rcu); in delayed_free() local
618 unload_nls(sbi->nls_disk); in delayed_free()
619 unload_nls(sbi->nls_io); in delayed_free()
620 if (sbi->options.iocharset != fat_default_iocharset) in delayed_free()
621 kfree(sbi->options.iocharset); in delayed_free()
622 kfree(sbi); in delayed_free()
627 struct msdos_sb_info *sbi = MSDOS_SB(sb); in fat_put_super() local
631 iput(sbi->fsinfo_inode); in fat_put_super()
632 iput(sbi->fat_inode); in fat_put_super()
634 call_rcu(&sbi->rcu, delayed_free); in fat_put_super()
699 struct msdos_sb_info *sbi = MSDOS_SB(sb); in fat_remount() local
700 *flags |= MS_NODIRATIME | (sbi->options.isvfat ? 0 : MS_NOATIME); in fat_remount()
718 struct msdos_sb_info *sbi = MSDOS_SB(sb); in fat_statfs() local
722 if (sbi->free_clusters == -1 || !sbi->free_clus_valid) { in fat_statfs()
729 buf->f_bsize = sbi->cluster_size; in fat_statfs()
730 buf->f_blocks = sbi->max_cluster - FAT_START_ENT; in fat_statfs()
731 buf->f_bfree = sbi->free_clusters; in fat_statfs()
732 buf->f_bavail = sbi->free_clusters; in fat_statfs()
736 (sbi->options.isvfat ? FAT_LFN_LEN : 12) * NLS_MAX_CHARSET_SIZE; in fat_statfs()
744 struct msdos_sb_info *sbi = MSDOS_SB(sb); in __fat_write_inode() local
755 i_pos = fat_i_pos_read(sbi, inode); in __fat_write_inode()
759 fat_get_blknr_offset(sbi, i_pos, &blocknr, &offset); in __fat_write_inode()
766 spin_lock(&sbi->inode_hash_lock); in __fat_write_inode()
768 spin_unlock(&sbi->inode_hash_lock); in __fat_write_inode()
780 fat_time_unix2fat(sbi, &inode->i_mtime, &raw_entry->time, in __fat_write_inode()
782 if (sbi->options.isvfat) { in __fat_write_inode()
784 fat_time_unix2fat(sbi, &inode->i_ctime, &raw_entry->ctime, in __fat_write_inode()
786 fat_time_unix2fat(sbi, &inode->i_atime, &atime, in __fat_write_inode()
789 spin_unlock(&sbi->inode_hash_lock); in __fat_write_inode()
836 struct msdos_sb_info *sbi = MSDOS_SB(root->d_sb); in fat_show_options() local
837 struct fat_mount_options *opts = &sbi->options; in fat_show_options()
850 if (sbi->nls_disk) in fat_show_options()
852 seq_printf(m, ",codepage=%s", &sbi->nls_disk->charset[2]); in fat_show_options()
854 if (sbi->nls_io) in fat_show_options()
855 seq_printf(m, ",iocharset=%s", sbi->nls_io->charset); in fat_show_options()
1273 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); in fat_read_root() local
1277 inode->i_uid = sbi->options.fs_uid; in fat_read_root()
1278 inode->i_gid = sbi->options.fs_gid; in fat_read_root()
1281 inode->i_mode = fat_make_mode(sbi, ATTR_DIR, S_IRWXUGO); in fat_read_root()
1282 inode->i_op = sbi->dir_ops; in fat_read_root()
1284 if (sbi->fat_bits == 32) { in fat_read_root()
1285 MSDOS_I(inode)->i_start = sbi->root_cluster; in fat_read_root()
1291 inode->i_size = sbi->dir_entries * sizeof(struct msdos_dir_entry); in fat_read_root()
1293 inode->i_blocks = ((inode->i_size + (sbi->cluster_size - 1)) in fat_read_root()
1294 & ~((loff_t)sbi->cluster_size - 1)) >> 9; in fat_read_root()
1308 struct msdos_sb_info *sbi = MSDOS_SB(sb); in calc_fat_clusters() local
1311 if (sbi->fat_bits != 12) { in calc_fat_clusters()
1312 unsigned long ent_per_sec = sb->s_blocksize * 8 / sbi->fat_bits; in calc_fat_clusters()
1313 return ent_per_sec * sbi->fat_length; in calc_fat_clusters()
1316 return sbi->fat_length * sb->s_blocksize * 8 / sbi->fat_bits; in calc_fat_clusters()
1492 struct msdos_sb_info *sbi; in fat_fill_super() local
1505 sbi = kzalloc(sizeof(struct msdos_sb_info), GFP_KERNEL); in fat_fill_super()
1506 if (!sbi) in fat_fill_super()
1508 sb->s_fs_info = sbi; in fat_fill_super()
1514 mutex_init(&sbi->nfs_build_inode_lock); in fat_fill_super()
1515 ratelimit_state_init(&sbi->ratelimit, DEFAULT_RATELIMIT_INTERVAL, in fat_fill_super()
1518 error = parse_options(sb, data, isvfat, silent, &debug, &sbi->options); in fat_fill_super()
1534 if (error == -EINVAL && sbi->options.dos1xfloppy) in fat_fill_super()
1545 sbi->sec_per_clus = bpb.fat_sec_per_clus; in fat_fill_super()
1574 mutex_init(&sbi->s_lock); in fat_fill_super()
1575 sbi->cluster_size = sb->s_blocksize * sbi->sec_per_clus; in fat_fill_super()
1576 sbi->cluster_bits = ffs(sbi->cluster_size) - 1; in fat_fill_super()
1577 sbi->fats = bpb.fat_fats; in fat_fill_super()
1578 sbi->fat_bits = 0; /* Don't know yet */ in fat_fill_super()
1579 sbi->fat_start = bpb.fat_reserved; in fat_fill_super()
1580 sbi->fat_length = bpb.fat_fat_length; in fat_fill_super()
1581 sbi->root_cluster = 0; in fat_fill_super()
1582 sbi->free_clusters = -1; /* Don't know yet */ in fat_fill_super()
1583 sbi->free_clus_valid = 0; in fat_fill_super()
1584 sbi->prev_free = FAT_START_ENT; in fat_fill_super()
1587 if (!sbi->fat_length && bpb.fat32_length) { in fat_fill_super()
1592 sbi->fat_bits = 32; in fat_fill_super()
1593 sbi->fat_length = bpb.fat32_length; in fat_fill_super()
1594 sbi->root_cluster = bpb.fat32_root_cluster; in fat_fill_super()
1597 sbi->fsinfo_sector = bpb.fat32_info_sector; in fat_fill_super()
1598 if (sbi->fsinfo_sector == 0) in fat_fill_super()
1599 sbi->fsinfo_sector = 1; in fat_fill_super()
1601 fsinfo_bh = sb_bread(sb, sbi->fsinfo_sector); in fat_fill_super()
1604 " (sector = %lu)", sbi->fsinfo_sector); in fat_fill_super()
1614 sbi->fsinfo_sector); in fat_fill_super()
1616 if (sbi->options.usefree) in fat_fill_super()
1617 sbi->free_clus_valid = 1; in fat_fill_super()
1618 sbi->free_clusters = le32_to_cpu(fsinfo->free_clusters); in fat_fill_super()
1619 sbi->prev_free = le32_to_cpu(fsinfo->next_cluster); in fat_fill_super()
1626 if (sbi->fat_bits == 32) in fat_fill_super()
1627 sbi->vol_id = bpb.fat32_vol_id; in fat_fill_super()
1629 sbi->vol_id = bpb.fat16_vol_id; in fat_fill_super()
1631 sbi->dir_per_block = sb->s_blocksize / sizeof(struct msdos_dir_entry); in fat_fill_super()
1632 sbi->dir_per_block_bits = ffs(sbi->dir_per_block) - 1; in fat_fill_super()
1634 sbi->dir_start = sbi->fat_start + sbi->fats * sbi->fat_length; in fat_fill_super()
1635 sbi->dir_entries = bpb.fat_dir_entries; in fat_fill_super()
1636 if (sbi->dir_entries & (sbi->dir_per_block - 1)) { in fat_fill_super()
1639 " (%u)", sbi->dir_entries); in fat_fill_super()
1643 rootdir_sectors = sbi->dir_entries in fat_fill_super()
1645 sbi->data_start = sbi->dir_start + rootdir_sectors; in fat_fill_super()
1650 total_clusters = (total_sectors - sbi->data_start) / sbi->sec_per_clus; in fat_fill_super()
1652 if (sbi->fat_bits != 32) in fat_fill_super()
1653 sbi->fat_bits = (total_clusters > MAX_FAT12) ? 16 : 12; in fat_fill_super()
1656 if (sbi->fat_bits == 32) in fat_fill_super()
1657 sbi->dirty = bpb.fat32_state & FAT_STATE_DIRTY; in fat_fill_super()
1659 sbi->dirty = bpb.fat16_state & FAT_STATE_DIRTY; in fat_fill_super()
1671 sbi->max_cluster = total_clusters + FAT_START_ENT; in fat_fill_super()
1673 if (sbi->free_clusters != -1 && sbi->free_clusters > total_clusters) in fat_fill_super()
1674 sbi->free_clusters = -1; in fat_fill_super()
1676 sbi->prev_free %= sbi->max_cluster; in fat_fill_super()
1677 if (sbi->prev_free < FAT_START_ENT) in fat_fill_super()
1678 sbi->prev_free = FAT_START_ENT; in fat_fill_super()
1694 sprintf(buf, "cp%d", sbi->options.codepage); in fat_fill_super()
1695 sbi->nls_disk = load_nls(buf); in fat_fill_super()
1696 if (!sbi->nls_disk) { in fat_fill_super()
1702 if (sbi->options.isvfat) { in fat_fill_super()
1703 sbi->nls_io = load_nls(sbi->options.iocharset); in fat_fill_super()
1704 if (!sbi->nls_io) { in fat_fill_super()
1706 sbi->options.iocharset); in fat_fill_super()
1716 sbi->fat_inode = fat_inode; in fat_fill_super()
1722 sbi->fsinfo_inode = fsinfo_inode; in fat_fill_super()
1744 if (sbi->options.discard) { in fat_fill_super()
1765 unload_nls(sbi->nls_io); in fat_fill_super()
1766 unload_nls(sbi->nls_disk); in fat_fill_super()
1767 if (sbi->options.iocharset != fat_default_iocharset) in fat_fill_super()
1768 kfree(sbi->options.iocharset); in fat_fill_super()
1770 kfree(sbi); in fat_fill_super()