Lines Matching full:sb
34 static void exfat_put_super(struct super_block *sb) in exfat_put_super() argument
36 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_put_super()
44 static int exfat_sync_fs(struct super_block *sb, int wait) in exfat_sync_fs() argument
46 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_sync_fs()
49 if (unlikely(exfat_forced_shutdown(sb))) in exfat_sync_fs()
57 sync_blockdev(sb->s_bdev); in exfat_sync_fs()
58 if (exfat_clear_volume_dirty(sb)) in exfat_sync_fs()
66 struct super_block *sb = dentry->d_sb; in exfat_statfs() local
67 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_statfs()
68 unsigned long long id = huge_encode_dev(sb->s_bdev->bd_dev); in exfat_statfs()
72 if (exfat_count_used_clusters(sb, &sbi->used_clusters)) { in exfat_statfs()
79 buf->f_type = sb->s_magic; in exfat_statfs()
90 static int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flags) in exfat_set_vol_flags() argument
92 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_set_vol_flags()
107 if (sb_rdonly(sb)) in exfat_set_vol_flags()
120 int exfat_set_volume_dirty(struct super_block *sb) in exfat_set_volume_dirty() argument
122 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_set_volume_dirty()
124 return exfat_set_vol_flags(sb, sbi->vol_flags | VOLUME_DIRTY); in exfat_set_volume_dirty()
127 int exfat_clear_volume_dirty(struct super_block *sb) in exfat_clear_volume_dirty() argument
129 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_clear_volume_dirty()
131 return exfat_set_vol_flags(sb, sbi->vol_flags & ~VOLUME_DIRTY); in exfat_clear_volume_dirty()
136 struct super_block *sb = root->d_sb; in exfat_show_options() local
137 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_show_options()
173 int exfat_force_shutdown(struct super_block *sb, u32 flags) in exfat_force_shutdown() argument
176 struct exfat_sb_info *sbi = sb->s_fs_info; in exfat_force_shutdown()
179 if (exfat_forced_shutdown(sb)) in exfat_force_shutdown()
185 ret = bdev_freeze(sb->s_bdev); in exfat_force_shutdown()
188 bdev_thaw(sb->s_bdev); in exfat_force_shutdown()
203 static void exfat_shutdown(struct super_block *sb) in exfat_shutdown() argument
205 exfat_force_shutdown(sb, EXFAT_GOING_DOWN_NOSYNC); in exfat_shutdown()
208 static struct inode *exfat_alloc_inode(struct super_block *sb) in exfat_alloc_inode() argument
212 ei = alloc_inode_sb(sb, exfat_inode_cachep, GFP_NOFS); in exfat_alloc_inode()
363 static void exfat_hash_init(struct super_block *sb) in exfat_hash_init() argument
365 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_hash_init()
375 struct super_block *sb = inode->i_sb; in exfat_read_root() local
376 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_read_root()
393 if (exfat_count_num_clusters(sb, &cdir, &num_clu)) in exfat_read_root()
397 num_subdirs = exfat_count_dir_entries(sb, &cdir); in exfat_read_root()
419 static int exfat_calibrate_blocksize(struct super_block *sb, int logical_sect) in exfat_calibrate_blocksize() argument
421 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_calibrate_blocksize()
424 exfat_err(sb, "bogus logical sector size %u", logical_sect); in exfat_calibrate_blocksize()
428 if (logical_sect < sb->s_blocksize) { in exfat_calibrate_blocksize()
429 exfat_err(sb, "logical sector size too small for device (logical sector size = %u)", in exfat_calibrate_blocksize()
434 if (logical_sect > sb->s_blocksize) { in exfat_calibrate_blocksize()
438 if (!sb_set_blocksize(sb, logical_sect)) { in exfat_calibrate_blocksize()
439 exfat_err(sb, "unable to set blocksize %u", in exfat_calibrate_blocksize()
443 sbi->boot_bh = sb_bread(sb, 0); in exfat_calibrate_blocksize()
445 exfat_err(sb, "unable to read boot sector (logical sector size = %lu)", in exfat_calibrate_blocksize()
446 sb->s_blocksize); in exfat_calibrate_blocksize()
453 static int exfat_read_boot_sector(struct super_block *sb) in exfat_read_boot_sector() argument
456 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_read_boot_sector()
459 sb_min_blocksize(sb, 512); in exfat_read_boot_sector()
462 sbi->boot_bh = sb_bread(sb, 0); in exfat_read_boot_sector()
464 exfat_err(sb, "unable to read boot sector"); in exfat_read_boot_sector()
471 exfat_err(sb, "invalid boot record signature"); in exfat_read_boot_sector()
476 exfat_err(sb, "invalid fs_name"); /* fs_name may unprintable */ in exfat_read_boot_sector()
488 exfat_err(sb, "bogus number of FAT structure"); in exfat_read_boot_sector()
497 exfat_err(sb, "bogus sector size bits : %u", in exfat_read_boot_sector()
506 exfat_err(sb, "bogus sectors bits per cluster : %u", in exfat_read_boot_sector()
539 exfat_err(sb, "bogus fat length"); in exfat_read_boot_sector()
546 exfat_err(sb, "bogus data start sector"); in exfat_read_boot_sector()
551 exfat_warn(sb, "Volume was not properly unmounted. Some data may be corrupt. Please run fsck."); in exfat_read_boot_sector()
553 exfat_warn(sb, "Medium has reported failures. Some data may be lost."); in exfat_read_boot_sector()
556 sb->s_maxbytes = (u64)(sbi->num_clusters - EXFAT_RESERVED_CLUSTERS) << in exfat_read_boot_sector()
560 if (exfat_calibrate_blocksize(sb, 1 << p_boot->sect_size_bits)) in exfat_read_boot_sector()
566 static int exfat_verify_boot_region(struct super_block *sb) in exfat_verify_boot_region() argument
575 bh = sb_bread(sb, sn); in exfat_verify_boot_region()
581 p_sig = (__le32 *)&bh->b_data[sb->s_blocksize - 4]; in exfat_verify_boot_region()
583 exfat_warn(sb, "Invalid exboot-signature(sector = %d): 0x%08x", in exfat_verify_boot_region()
587 chksum = exfat_calc_chksum32(bh->b_data, sb->s_blocksize, in exfat_verify_boot_region()
593 bh = sb_bread(sb, sn); in exfat_verify_boot_region()
597 for (i = 0; i < sb->s_blocksize; i += sizeof(u32)) { in exfat_verify_boot_region()
600 exfat_err(sb, "Invalid boot checksum (boot checksum : 0x%08x, checksum : 0x%08x)", in exfat_verify_boot_region()
611 static int __exfat_fill_super(struct super_block *sb) in __exfat_fill_super() argument
614 struct exfat_sb_info *sbi = EXFAT_SB(sb); in __exfat_fill_super()
616 ret = exfat_read_boot_sector(sb); in __exfat_fill_super()
618 exfat_err(sb, "failed to read boot sector"); in __exfat_fill_super()
622 ret = exfat_verify_boot_region(sb); in __exfat_fill_super()
624 exfat_err(sb, "invalid boot region"); in __exfat_fill_super()
628 ret = exfat_create_upcase_table(sb); in __exfat_fill_super()
630 exfat_err(sb, "failed to load upcase table"); in __exfat_fill_super()
634 ret = exfat_load_bitmap(sb); in __exfat_fill_super()
636 exfat_err(sb, "failed to load alloc-bitmap"); in __exfat_fill_super()
640 ret = exfat_count_used_clusters(sb, &sbi->used_clusters); in __exfat_fill_super()
642 exfat_err(sb, "failed to scan clusters"); in __exfat_fill_super()
655 static int exfat_fill_super(struct super_block *sb, struct fs_context *fc) in exfat_fill_super() argument
657 struct exfat_sb_info *sbi = sb->s_fs_info; in exfat_fill_super()
665 if (opts->discard && !bdev_max_discard_sectors(sb->s_bdev)) { in exfat_fill_super()
666 exfat_warn(sb, "mounting with \"discard\" option, but the device does not support discard"); in exfat_fill_super()
670 sb->s_flags |= SB_NODIRATIME; in exfat_fill_super()
671 sb->s_magic = EXFAT_SUPER_MAGIC; in exfat_fill_super()
672 sb->s_op = &exfat_sops; in exfat_fill_super()
674 sb->s_time_gran = 10 * NSEC_PER_MSEC; in exfat_fill_super()
675 sb->s_time_min = EXFAT_MIN_TIMESTAMP_SECS; in exfat_fill_super()
676 sb->s_time_max = EXFAT_MAX_TIMESTAMP_SECS; in exfat_fill_super()
678 err = __exfat_fill_super(sb); in exfat_fill_super()
680 exfat_err(sb, "failed to recognize exfat type"); in exfat_fill_super()
685 exfat_hash_init(sb); in exfat_fill_super()
692 exfat_err(sb, "IO charset %s not found", in exfat_fill_super()
700 sb->s_d_op = &exfat_utf8_dentry_ops; in exfat_fill_super()
702 sb->s_d_op = &exfat_dentry_ops; in exfat_fill_super()
704 root_inode = new_inode(sb); in exfat_fill_super()
706 exfat_err(sb, "failed to allocate root inode"); in exfat_fill_super()
715 exfat_err(sb, "failed to initialize root inode"); in exfat_fill_super()
722 sb->s_root = d_make_root(root_inode); in exfat_fill_super()
723 if (!sb->s_root) { in exfat_fill_super()
724 exfat_err(sb, "failed to get the root dentry"); in exfat_fill_super()
733 sb->s_root = NULL; in exfat_fill_super()
813 static void exfat_kill_sb(struct super_block *sb) in exfat_kill_sb() argument
815 struct exfat_sb_info *sbi = sb->s_fs_info; in exfat_kill_sb()
817 kill_block_super(sb); in exfat_kill_sb()