Lines Matching refs:sbi
116 struct msdos_sb_info *sbi = MSDOS_SB(sb); in __fat_get_block() local
138 offset = (unsigned long)iblock & (sbi->sec_per_clus - 1); in __fat_get_block()
146 mapped_blocks = sbi->sec_per_clus - offset; in __fat_get_block()
337 struct msdos_sb_info *sbi = MSDOS_SB(sb); in fat_hash_init() local
340 spin_lock_init(&sbi->inode_hash_lock); in fat_hash_init()
342 INIT_HLIST_HEAD(&sbi->inode_hashtable[i]); in fat_hash_init()
352 struct msdos_sb_info *sbi = MSDOS_SB(sb); in dir_hash_init() local
355 spin_lock_init(&sbi->dir_hash_lock); in dir_hash_init()
357 INIT_HLIST_HEAD(&sbi->dir_hashtable[i]); in dir_hash_init()
362 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); in fat_attach() local
365 struct hlist_head *head = sbi->inode_hashtable in fat_attach()
368 spin_lock(&sbi->inode_hash_lock); in fat_attach()
371 spin_unlock(&sbi->inode_hash_lock); in fat_attach()
378 if (S_ISDIR(inode->i_mode) && sbi->options.nfs) { in fat_attach()
379 struct hlist_head *d_head = sbi->dir_hashtable; in fat_attach()
382 spin_lock(&sbi->dir_hash_lock); in fat_attach()
384 spin_unlock(&sbi->dir_hash_lock); in fat_attach()
391 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); in fat_detach() local
392 spin_lock(&sbi->inode_hash_lock); in fat_detach()
395 spin_unlock(&sbi->inode_hash_lock); in fat_detach()
397 if (S_ISDIR(inode->i_mode) && sbi->options.nfs) { in fat_detach()
398 spin_lock(&sbi->dir_hash_lock); in fat_detach()
400 spin_unlock(&sbi->dir_hash_lock); in fat_detach()
407 struct msdos_sb_info *sbi = MSDOS_SB(sb); in fat_iget() local
408 struct hlist_head *head = sbi->inode_hashtable + fat_hash(i_pos); in fat_iget()
412 spin_lock(&sbi->inode_hash_lock); in fat_iget()
421 spin_unlock(&sbi->inode_hash_lock); in fat_iget()
437 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); in fat_calc_dir_size() local
447 inode->i_size = (fclus + 1) << sbi->cluster_bits; in fat_calc_dir_size()
455 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); in fat_fill_inode() local
459 inode->i_uid = sbi->options.fs_uid; in fat_fill_inode()
460 inode->i_gid = sbi->options.fs_gid; in fat_fill_inode()
466 inode->i_mode = fat_make_mode(sbi, de->attr, S_IRWXUGO); in fat_fill_inode()
467 inode->i_op = sbi->dir_ops; in fat_fill_inode()
470 MSDOS_I(inode)->i_start = fat_get_start(sbi, de); in fat_fill_inode()
480 inode->i_mode = fat_make_mode(sbi, de->attr, in fat_fill_inode()
481 ((sbi->options.showexec && !is_exec(de->name + 8)) in fat_fill_inode()
483 MSDOS_I(inode)->i_start = fat_get_start(sbi, de); in fat_fill_inode()
493 if (sbi->options.sys_immutable) in fat_fill_inode()
498 inode->i_blocks = ((inode->i_size + (sbi->cluster_size - 1)) in fat_fill_inode()
499 & ~((loff_t)sbi->cluster_size - 1)) >> 9; in fat_fill_inode()
501 fat_time_fat2unix(sbi, &inode->i_mtime, de->time, de->date, 0); in fat_fill_inode()
502 if (sbi->options.isvfat) { in fat_fill_inode()
503 fat_time_fat2unix(sbi, &inode->i_ctime, de->ctime, in fat_fill_inode()
505 fat_time_fat2unix(sbi, &inode->i_atime, 0, de->adate, 0); in fat_fill_inode()
512 static inline void fat_lock_build_inode(struct msdos_sb_info *sbi) in fat_lock_build_inode() argument
514 if (sbi->options.nfs == FAT_NFS_NOSTALE_RO) in fat_lock_build_inode()
515 mutex_lock(&sbi->nfs_build_inode_lock); in fat_lock_build_inode()
518 static inline void fat_unlock_build_inode(struct msdos_sb_info *sbi) in fat_unlock_build_inode() argument
520 if (sbi->options.nfs == FAT_NFS_NOSTALE_RO) in fat_unlock_build_inode()
521 mutex_unlock(&sbi->nfs_build_inode_lock); in fat_unlock_build_inode()
574 struct msdos_sb_info *sbi = MSDOS_SB(sb); in fat_set_state() local
581 if (sbi->dirty) { in fat_set_state()
599 if (sbi->fat_bits == 32) { in fat_set_state()
618 struct msdos_sb_info *sbi = container_of(p, struct msdos_sb_info, rcu); in delayed_free() local
619 unload_nls(sbi->nls_disk); in delayed_free()
620 unload_nls(sbi->nls_io); in delayed_free()
621 if (sbi->options.iocharset != fat_default_iocharset) in delayed_free()
622 kfree(sbi->options.iocharset); in delayed_free()
623 kfree(sbi); in delayed_free()
628 struct msdos_sb_info *sbi = MSDOS_SB(sb); in fat_put_super() local
632 iput(sbi->fsinfo_inode); in fat_put_super()
633 iput(sbi->fat_inode); in fat_put_super()
635 call_rcu(&sbi->rcu, delayed_free); in fat_put_super()
700 struct msdos_sb_info *sbi = MSDOS_SB(sb); in fat_remount() local
701 *flags |= MS_NODIRATIME | (sbi->options.isvfat ? 0 : MS_NOATIME); in fat_remount()
719 struct msdos_sb_info *sbi = MSDOS_SB(sb); in fat_statfs() local
723 if (sbi->free_clusters == -1 || !sbi->free_clus_valid) { in fat_statfs()
730 buf->f_bsize = sbi->cluster_size; in fat_statfs()
731 buf->f_blocks = sbi->max_cluster - FAT_START_ENT; in fat_statfs()
732 buf->f_bfree = sbi->free_clusters; in fat_statfs()
733 buf->f_bavail = sbi->free_clusters; in fat_statfs()
737 (sbi->options.isvfat ? FAT_LFN_LEN : 12) * NLS_MAX_CHARSET_SIZE; in fat_statfs()
745 struct msdos_sb_info *sbi = MSDOS_SB(sb); in __fat_write_inode() local
756 i_pos = fat_i_pos_read(sbi, inode); in __fat_write_inode()
760 fat_get_blknr_offset(sbi, i_pos, &blocknr, &offset); in __fat_write_inode()
767 spin_lock(&sbi->inode_hash_lock); in __fat_write_inode()
769 spin_unlock(&sbi->inode_hash_lock); in __fat_write_inode()
781 fat_time_unix2fat(sbi, &inode->i_mtime, &raw_entry->time, in __fat_write_inode()
783 if (sbi->options.isvfat) { in __fat_write_inode()
785 fat_time_unix2fat(sbi, &inode->i_ctime, &raw_entry->ctime, in __fat_write_inode()
787 fat_time_unix2fat(sbi, &inode->i_atime, &atime, in __fat_write_inode()
790 spin_unlock(&sbi->inode_hash_lock); in __fat_write_inode()
837 struct msdos_sb_info *sbi = MSDOS_SB(root->d_sb); in fat_show_options() local
838 struct fat_mount_options *opts = &sbi->options; in fat_show_options()
851 if (sbi->nls_disk) in fat_show_options()
853 seq_printf(m, ",codepage=%s", &sbi->nls_disk->charset[2]); in fat_show_options()
855 if (sbi->nls_io) in fat_show_options()
856 seq_printf(m, ",iocharset=%s", sbi->nls_io->charset); in fat_show_options()
1274 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); in fat_read_root() local
1278 inode->i_uid = sbi->options.fs_uid; in fat_read_root()
1279 inode->i_gid = sbi->options.fs_gid; in fat_read_root()
1282 inode->i_mode = fat_make_mode(sbi, ATTR_DIR, S_IRWXUGO); in fat_read_root()
1283 inode->i_op = sbi->dir_ops; in fat_read_root()
1285 if (sbi->fat_bits == 32) { in fat_read_root()
1286 MSDOS_I(inode)->i_start = sbi->root_cluster; in fat_read_root()
1292 inode->i_size = sbi->dir_entries * sizeof(struct msdos_dir_entry); in fat_read_root()
1294 inode->i_blocks = ((inode->i_size + (sbi->cluster_size - 1)) in fat_read_root()
1295 & ~((loff_t)sbi->cluster_size - 1)) >> 9; in fat_read_root()
1309 struct msdos_sb_info *sbi = MSDOS_SB(sb); in calc_fat_clusters() local
1312 if (sbi->fat_bits != 12) { in calc_fat_clusters()
1313 unsigned long ent_per_sec = sb->s_blocksize * 8 / sbi->fat_bits; in calc_fat_clusters()
1314 return ent_per_sec * sbi->fat_length; in calc_fat_clusters()
1317 return sbi->fat_length * sb->s_blocksize * 8 / sbi->fat_bits; in calc_fat_clusters()
1493 struct msdos_sb_info *sbi; in fat_fill_super() local
1506 sbi = kzalloc(sizeof(struct msdos_sb_info), GFP_KERNEL); in fat_fill_super()
1507 if (!sbi) in fat_fill_super()
1509 sb->s_fs_info = sbi; in fat_fill_super()
1515 mutex_init(&sbi->nfs_build_inode_lock); in fat_fill_super()
1516 ratelimit_state_init(&sbi->ratelimit, DEFAULT_RATELIMIT_INTERVAL, in fat_fill_super()
1519 error = parse_options(sb, data, isvfat, silent, &debug, &sbi->options); in fat_fill_super()
1535 if (error == -EINVAL && sbi->options.dos1xfloppy) in fat_fill_super()
1546 sbi->sec_per_clus = bpb.fat_sec_per_clus; in fat_fill_super()
1575 mutex_init(&sbi->s_lock); in fat_fill_super()
1576 sbi->cluster_size = sb->s_blocksize * sbi->sec_per_clus; in fat_fill_super()
1577 sbi->cluster_bits = ffs(sbi->cluster_size) - 1; in fat_fill_super()
1578 sbi->fats = bpb.fat_fats; in fat_fill_super()
1579 sbi->fat_bits = 0; /* Don't know yet */ in fat_fill_super()
1580 sbi->fat_start = bpb.fat_reserved; in fat_fill_super()
1581 sbi->fat_length = bpb.fat_fat_length; in fat_fill_super()
1582 sbi->root_cluster = 0; in fat_fill_super()
1583 sbi->free_clusters = -1; /* Don't know yet */ in fat_fill_super()
1584 sbi->free_clus_valid = 0; in fat_fill_super()
1585 sbi->prev_free = FAT_START_ENT; in fat_fill_super()
1588 if (!sbi->fat_length && bpb.fat32_length) { in fat_fill_super()
1593 sbi->fat_bits = 32; in fat_fill_super()
1594 sbi->fat_length = bpb.fat32_length; in fat_fill_super()
1595 sbi->root_cluster = bpb.fat32_root_cluster; in fat_fill_super()
1598 sbi->fsinfo_sector = bpb.fat32_info_sector; in fat_fill_super()
1599 if (sbi->fsinfo_sector == 0) in fat_fill_super()
1600 sbi->fsinfo_sector = 1; in fat_fill_super()
1602 fsinfo_bh = sb_bread(sb, sbi->fsinfo_sector); in fat_fill_super()
1605 " (sector = %lu)", sbi->fsinfo_sector); in fat_fill_super()
1615 sbi->fsinfo_sector); in fat_fill_super()
1617 if (sbi->options.usefree) in fat_fill_super()
1618 sbi->free_clus_valid = 1; in fat_fill_super()
1619 sbi->free_clusters = le32_to_cpu(fsinfo->free_clusters); in fat_fill_super()
1620 sbi->prev_free = le32_to_cpu(fsinfo->next_cluster); in fat_fill_super()
1627 if (sbi->fat_bits == 32) in fat_fill_super()
1628 sbi->vol_id = bpb.fat32_vol_id; in fat_fill_super()
1630 sbi->vol_id = bpb.fat16_vol_id; in fat_fill_super()
1632 sbi->dir_per_block = sb->s_blocksize / sizeof(struct msdos_dir_entry); in fat_fill_super()
1633 sbi->dir_per_block_bits = ffs(sbi->dir_per_block) - 1; in fat_fill_super()
1635 sbi->dir_start = sbi->fat_start + sbi->fats * sbi->fat_length; in fat_fill_super()
1636 sbi->dir_entries = bpb.fat_dir_entries; in fat_fill_super()
1637 if (sbi->dir_entries & (sbi->dir_per_block - 1)) { in fat_fill_super()
1640 " (%u)", sbi->dir_entries); in fat_fill_super()
1644 rootdir_sectors = sbi->dir_entries in fat_fill_super()
1646 sbi->data_start = sbi->dir_start + rootdir_sectors; in fat_fill_super()
1651 total_clusters = (total_sectors - sbi->data_start) / sbi->sec_per_clus; in fat_fill_super()
1653 if (sbi->fat_bits != 32) in fat_fill_super()
1654 sbi->fat_bits = (total_clusters > MAX_FAT12) ? 16 : 12; in fat_fill_super()
1657 if (sbi->fat_bits == 32) in fat_fill_super()
1658 sbi->dirty = bpb.fat32_state & FAT_STATE_DIRTY; in fat_fill_super()
1660 sbi->dirty = bpb.fat16_state & FAT_STATE_DIRTY; in fat_fill_super()
1672 sbi->max_cluster = total_clusters + FAT_START_ENT; in fat_fill_super()
1674 if (sbi->free_clusters != -1 && sbi->free_clusters > total_clusters) in fat_fill_super()
1675 sbi->free_clusters = -1; in fat_fill_super()
1677 sbi->prev_free %= sbi->max_cluster; in fat_fill_super()
1678 if (sbi->prev_free < FAT_START_ENT) in fat_fill_super()
1679 sbi->prev_free = FAT_START_ENT; in fat_fill_super()
1695 sprintf(buf, "cp%d", sbi->options.codepage); in fat_fill_super()
1696 sbi->nls_disk = load_nls(buf); in fat_fill_super()
1697 if (!sbi->nls_disk) { in fat_fill_super()
1703 if (sbi->options.isvfat) { in fat_fill_super()
1704 sbi->nls_io = load_nls(sbi->options.iocharset); in fat_fill_super()
1705 if (!sbi->nls_io) { in fat_fill_super()
1707 sbi->options.iocharset); in fat_fill_super()
1717 sbi->fat_inode = fat_inode; in fat_fill_super()
1723 sbi->fsinfo_inode = fsinfo_inode; in fat_fill_super()
1745 if (sbi->options.discard) { in fat_fill_super()
1766 unload_nls(sbi->nls_io); in fat_fill_super()
1767 unload_nls(sbi->nls_disk); in fat_fill_super()
1768 if (sbi->options.iocharset != fat_default_iocharset) in fat_fill_super()
1769 kfree(sbi->options.iocharset); in fat_fill_super()
1771 kfree(sbi); in fat_fill_super()