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()
70 buf->f_type = sb->s_magic; in exfat_statfs()
81 static int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flags) in exfat_set_vol_flags() argument
83 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_set_vol_flags()
98 if (sb_rdonly(sb)) in exfat_set_vol_flags()
111 int exfat_set_volume_dirty(struct super_block *sb) in exfat_set_volume_dirty() argument
113 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_set_volume_dirty()
115 return exfat_set_vol_flags(sb, sbi->vol_flags | VOLUME_DIRTY); in exfat_set_volume_dirty()
118 int exfat_clear_volume_dirty(struct super_block *sb) in exfat_clear_volume_dirty() argument
120 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_clear_volume_dirty()
122 return exfat_set_vol_flags(sb, sbi->vol_flags & ~VOLUME_DIRTY); in exfat_clear_volume_dirty()
127 struct super_block *sb = root->d_sb; in exfat_show_options() local
128 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_show_options()
164 int exfat_force_shutdown(struct super_block *sb, u32 flags) in exfat_force_shutdown() argument
167 struct exfat_sb_info *sbi = sb->s_fs_info; in exfat_force_shutdown()
170 if (exfat_forced_shutdown(sb)) in exfat_force_shutdown()
176 ret = bdev_freeze(sb->s_bdev); in exfat_force_shutdown()
179 bdev_thaw(sb->s_bdev); in exfat_force_shutdown()
194 static void exfat_shutdown(struct super_block *sb) in exfat_shutdown() argument
196 exfat_force_shutdown(sb, EXFAT_GOING_DOWN_NOSYNC); in exfat_shutdown()
199 static struct inode *exfat_alloc_inode(struct super_block *sb) in exfat_alloc_inode() argument
203 ei = alloc_inode_sb(sb, exfat_inode_cachep, GFP_NOFS); in exfat_alloc_inode()
354 static void exfat_hash_init(struct super_block *sb) in exfat_hash_init() argument
356 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_hash_init()
366 struct super_block *sb = inode->i_sb; in exfat_read_root() local
367 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_read_root()
384 if (exfat_count_num_clusters(sb, &cdir, &num_clu)) in exfat_read_root()
388 num_subdirs = exfat_count_dir_entries(sb, &cdir); in exfat_read_root()
410 static int exfat_calibrate_blocksize(struct super_block *sb, int logical_sect) in exfat_calibrate_blocksize() argument
412 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_calibrate_blocksize()
415 exfat_err(sb, "bogus logical sector size %u", logical_sect); in exfat_calibrate_blocksize()
419 if (logical_sect < sb->s_blocksize) { in exfat_calibrate_blocksize()
420 exfat_err(sb, "logical sector size too small for device (logical sector size = %u)", in exfat_calibrate_blocksize()
425 if (logical_sect > sb->s_blocksize) { in exfat_calibrate_blocksize()
429 if (!sb_set_blocksize(sb, logical_sect)) { in exfat_calibrate_blocksize()
430 exfat_err(sb, "unable to set blocksize %u", in exfat_calibrate_blocksize()
434 sbi->boot_bh = sb_bread(sb, 0); in exfat_calibrate_blocksize()
436 exfat_err(sb, "unable to read boot sector (logical sector size = %lu)", in exfat_calibrate_blocksize()
437 sb->s_blocksize); in exfat_calibrate_blocksize()
444 static int exfat_read_boot_sector(struct super_block *sb) in exfat_read_boot_sector() argument
447 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_read_boot_sector()
450 sb_min_blocksize(sb, 512); in exfat_read_boot_sector()
453 sbi->boot_bh = sb_bread(sb, 0); in exfat_read_boot_sector()
455 exfat_err(sb, "unable to read boot sector"); in exfat_read_boot_sector()
462 exfat_err(sb, "invalid boot record signature"); in exfat_read_boot_sector()
467 exfat_err(sb, "invalid fs_name"); /* fs_name may unprintable */ in exfat_read_boot_sector()
479 exfat_err(sb, "bogus number of FAT structure"); in exfat_read_boot_sector()
488 exfat_err(sb, "bogus sector size bits : %u", in exfat_read_boot_sector()
497 exfat_err(sb, "bogus sectors bits per cluster : %u", in exfat_read_boot_sector()
529 exfat_err(sb, "bogus fat length"); in exfat_read_boot_sector()
536 exfat_err(sb, "bogus data start sector"); in exfat_read_boot_sector()
541 exfat_warn(sb, "Volume was not properly unmounted. Some data may be corrupt. Please run fsck."); in exfat_read_boot_sector()
543 exfat_warn(sb, "Medium has reported failures. Some data may be lost."); in exfat_read_boot_sector()
546 sb->s_maxbytes = (u64)(sbi->num_clusters - EXFAT_RESERVED_CLUSTERS) << in exfat_read_boot_sector()
550 if (exfat_calibrate_blocksize(sb, 1 << p_boot->sect_size_bits)) in exfat_read_boot_sector()
556 static int exfat_verify_boot_region(struct super_block *sb) in exfat_verify_boot_region() argument
565 bh = sb_bread(sb, sn); in exfat_verify_boot_region()
571 p_sig = (__le32 *)&bh->b_data[sb->s_blocksize - 4]; in exfat_verify_boot_region()
573 exfat_warn(sb, "Invalid exboot-signature(sector = %d): 0x%08x", in exfat_verify_boot_region()
577 chksum = exfat_calc_chksum32(bh->b_data, sb->s_blocksize, in exfat_verify_boot_region()
583 bh = sb_bread(sb, sn); in exfat_verify_boot_region()
587 for (i = 0; i < sb->s_blocksize; i += sizeof(u32)) { in exfat_verify_boot_region()
590 exfat_err(sb, "Invalid boot checksum (boot checksum : 0x%08x, checksum : 0x%08x)", in exfat_verify_boot_region()
601 static int __exfat_fill_super(struct super_block *sb) in __exfat_fill_super() argument
604 struct exfat_sb_info *sbi = EXFAT_SB(sb); in __exfat_fill_super()
606 ret = exfat_read_boot_sector(sb); in __exfat_fill_super()
608 exfat_err(sb, "failed to read boot sector"); in __exfat_fill_super()
612 ret = exfat_verify_boot_region(sb); in __exfat_fill_super()
614 exfat_err(sb, "invalid boot region"); in __exfat_fill_super()
618 ret = exfat_create_upcase_table(sb); in __exfat_fill_super()
620 exfat_err(sb, "failed to load upcase table"); in __exfat_fill_super()
624 ret = exfat_load_bitmap(sb); in __exfat_fill_super()
626 exfat_err(sb, "failed to load alloc-bitmap"); in __exfat_fill_super()
630 ret = exfat_count_used_clusters(sb, &sbi->used_clusters); in __exfat_fill_super()
632 exfat_err(sb, "failed to scan clusters"); in __exfat_fill_super()
645 static int exfat_fill_super(struct super_block *sb, struct fs_context *fc) in exfat_fill_super() argument
647 struct exfat_sb_info *sbi = sb->s_fs_info; in exfat_fill_super()
655 if (opts->discard && !bdev_max_discard_sectors(sb->s_bdev)) { in exfat_fill_super()
656 exfat_warn(sb, "mounting with \"discard\" option, but the device does not support discard"); in exfat_fill_super()
660 sb->s_flags |= SB_NODIRATIME; in exfat_fill_super()
661 sb->s_magic = EXFAT_SUPER_MAGIC; in exfat_fill_super()
662 sb->s_op = &exfat_sops; in exfat_fill_super()
664 sb->s_time_gran = 10 * NSEC_PER_MSEC; in exfat_fill_super()
665 sb->s_time_min = EXFAT_MIN_TIMESTAMP_SECS; in exfat_fill_super()
666 sb->s_time_max = EXFAT_MAX_TIMESTAMP_SECS; in exfat_fill_super()
668 err = __exfat_fill_super(sb); in exfat_fill_super()
670 exfat_err(sb, "failed to recognize exfat type"); in exfat_fill_super()
675 exfat_hash_init(sb); in exfat_fill_super()
682 exfat_err(sb, "IO charset %s not found", in exfat_fill_super()
690 sb->s_d_op = &exfat_utf8_dentry_ops; in exfat_fill_super()
692 sb->s_d_op = &exfat_dentry_ops; in exfat_fill_super()
694 root_inode = new_inode(sb); in exfat_fill_super()
696 exfat_err(sb, "failed to allocate root inode"); in exfat_fill_super()
705 exfat_err(sb, "failed to initialize root inode"); in exfat_fill_super()
712 sb->s_root = d_make_root(root_inode); in exfat_fill_super()
713 if (!sb->s_root) { in exfat_fill_super()
714 exfat_err(sb, "failed to get the root dentry"); in exfat_fill_super()
723 sb->s_root = NULL; in exfat_fill_super()
803 static void exfat_kill_sb(struct super_block *sb) in exfat_kill_sb() argument
805 struct exfat_sb_info *sbi = sb->s_fs_info; in exfat_kill_sb()
807 kill_block_super(sb); in exfat_kill_sb()