Lines Matching refs:sb
43 static void exfat_put_super(struct super_block *sb) in exfat_put_super() argument
45 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_put_super()
55 static int exfat_sync_fs(struct super_block *sb, int wait) in exfat_sync_fs() argument
57 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_sync_fs()
65 sync_blockdev(sb->s_bdev); in exfat_sync_fs()
66 if (exfat_clear_volume_dirty(sb)) in exfat_sync_fs()
74 struct super_block *sb = dentry->d_sb; in exfat_statfs() local
75 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_statfs()
76 unsigned long long id = huge_encode_dev(sb->s_bdev->bd_dev); in exfat_statfs()
80 if (exfat_count_used_clusters(sb, &sbi->used_clusters)) { in exfat_statfs()
87 buf->f_type = sb->s_magic; in exfat_statfs()
98 static int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flags) in exfat_set_vol_flags() argument
100 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_set_vol_flags()
116 if (sb_rdonly(sb)) in exfat_set_vol_flags()
134 int exfat_set_volume_dirty(struct super_block *sb) in exfat_set_volume_dirty() argument
136 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_set_volume_dirty()
138 return exfat_set_vol_flags(sb, sbi->vol_flags | VOLUME_DIRTY); in exfat_set_volume_dirty()
141 int exfat_clear_volume_dirty(struct super_block *sb) in exfat_clear_volume_dirty() argument
143 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_clear_volume_dirty()
145 return exfat_set_vol_flags(sb, sbi->vol_flags & ~VOLUME_DIRTY); in exfat_clear_volume_dirty()
150 struct super_block *sb = root->d_sb; in exfat_show_options() local
151 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_show_options()
181 static struct inode *exfat_alloc_inode(struct super_block *sb) in exfat_alloc_inode() argument
320 static void exfat_hash_init(struct super_block *sb) in exfat_hash_init() argument
322 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_hash_init()
332 struct super_block *sb = inode->i_sb; in exfat_read_root() local
333 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_read_root()
350 if (exfat_count_num_clusters(sb, &cdir, &num_clu)) in exfat_read_root()
354 num_subdirs = exfat_count_dir_entries(sb, &cdir); in exfat_read_root()
380 static int exfat_calibrate_blocksize(struct super_block *sb, int logical_sect) in exfat_calibrate_blocksize() argument
382 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_calibrate_blocksize()
386 exfat_err(sb, "bogus logical sector size %u", logical_sect); in exfat_calibrate_blocksize()
390 if (logical_sect < sb->s_blocksize) { in exfat_calibrate_blocksize()
391 exfat_err(sb, "logical sector size too small for device (logical sector size = %u)", in exfat_calibrate_blocksize()
396 if (logical_sect > sb->s_blocksize) { in exfat_calibrate_blocksize()
400 if (!sb_set_blocksize(sb, logical_sect)) { in exfat_calibrate_blocksize()
401 exfat_err(sb, "unable to set blocksize %u", in exfat_calibrate_blocksize()
405 sbi->boot_bh = sb_bread(sb, 0); in exfat_calibrate_blocksize()
407 exfat_err(sb, "unable to read boot sector (logical sector size = %lu)", in exfat_calibrate_blocksize()
408 sb->s_blocksize); in exfat_calibrate_blocksize()
415 static int exfat_read_boot_sector(struct super_block *sb) in exfat_read_boot_sector() argument
418 struct exfat_sb_info *sbi = EXFAT_SB(sb); in exfat_read_boot_sector()
421 sb_min_blocksize(sb, 512); in exfat_read_boot_sector()
424 sbi->boot_bh = sb_bread(sb, 0); in exfat_read_boot_sector()
426 exfat_err(sb, "unable to read boot sector"); in exfat_read_boot_sector()
433 exfat_err(sb, "invalid boot record signature"); in exfat_read_boot_sector()
438 exfat_err(sb, "invalid fs_name"); /* fs_name may unprintable */ in exfat_read_boot_sector()
450 exfat_err(sb, "bogus number of FAT structure"); in exfat_read_boot_sector()
482 exfat_err(sb, "bogus fat length"); in exfat_read_boot_sector()
487 exfat_err(sb, "bogus data start sector"); in exfat_read_boot_sector()
491 exfat_warn(sb, "Volume was not properly unmounted. Some data may be corrupt. Please run fsck."); in exfat_read_boot_sector()
493 exfat_warn(sb, "Medium has reported failures. Some data may be lost."); in exfat_read_boot_sector()
496 sb->s_maxbytes = (u64)(sbi->num_clusters - EXFAT_RESERVED_CLUSTERS) << in exfat_read_boot_sector()
500 if (exfat_calibrate_blocksize(sb, 1 << p_boot->sect_size_bits)) in exfat_read_boot_sector()
506 static int exfat_verify_boot_region(struct super_block *sb) in exfat_verify_boot_region() argument
515 bh = sb_bread(sb, sn); in exfat_verify_boot_region()
521 p_sig = (__le32 *)&bh->b_data[sb->s_blocksize - 4]; in exfat_verify_boot_region()
523 exfat_warn(sb, "Invalid exboot-signature(sector = %d): 0x%08x", in exfat_verify_boot_region()
527 chksum = exfat_calc_chksum32(bh->b_data, sb->s_blocksize, in exfat_verify_boot_region()
533 bh = sb_bread(sb, sn); in exfat_verify_boot_region()
537 for (i = 0; i < sb->s_blocksize; i += sizeof(u32)) { in exfat_verify_boot_region()
540 exfat_err(sb, "Invalid boot checksum (boot checksum : 0x%08x, checksum : 0x%08x)", in exfat_verify_boot_region()
551 static int __exfat_fill_super(struct super_block *sb) in __exfat_fill_super() argument
554 struct exfat_sb_info *sbi = EXFAT_SB(sb); in __exfat_fill_super()
556 ret = exfat_read_boot_sector(sb); in __exfat_fill_super()
558 exfat_err(sb, "failed to read boot sector"); in __exfat_fill_super()
562 ret = exfat_verify_boot_region(sb); in __exfat_fill_super()
564 exfat_err(sb, "invalid boot region"); in __exfat_fill_super()
568 ret = exfat_create_upcase_table(sb); in __exfat_fill_super()
570 exfat_err(sb, "failed to load upcase table"); in __exfat_fill_super()
574 ret = exfat_load_bitmap(sb); in __exfat_fill_super()
576 exfat_err(sb, "failed to load alloc-bitmap"); in __exfat_fill_super()
580 ret = exfat_count_used_clusters(sb, &sbi->used_clusters); in __exfat_fill_super()
582 exfat_err(sb, "failed to scan clusters"); in __exfat_fill_super()
597 static int exfat_fill_super(struct super_block *sb, struct fs_context *fc) in exfat_fill_super() argument
599 struct exfat_sb_info *sbi = sb->s_fs_info; in exfat_fill_super()
608 struct request_queue *q = bdev_get_queue(sb->s_bdev); in exfat_fill_super()
611 exfat_warn(sb, "mounting with \"discard\" option, but the device does not support discard"); in exfat_fill_super()
616 sb->s_flags |= SB_NODIRATIME; in exfat_fill_super()
617 sb->s_magic = EXFAT_SUPER_MAGIC; in exfat_fill_super()
618 sb->s_op = &exfat_sops; in exfat_fill_super()
620 sb->s_time_gran = 10 * NSEC_PER_MSEC; in exfat_fill_super()
621 sb->s_time_min = EXFAT_MIN_TIMESTAMP_SECS; in exfat_fill_super()
622 sb->s_time_max = EXFAT_MAX_TIMESTAMP_SECS; in exfat_fill_super()
624 err = __exfat_fill_super(sb); in exfat_fill_super()
626 exfat_err(sb, "failed to recognize exfat type"); in exfat_fill_super()
631 exfat_hash_init(sb); in exfat_fill_super()
638 exfat_err(sb, "IO charset %s not found", in exfat_fill_super()
646 sb->s_d_op = &exfat_utf8_dentry_ops; in exfat_fill_super()
648 sb->s_d_op = &exfat_dentry_ops; in exfat_fill_super()
650 root_inode = new_inode(sb); in exfat_fill_super()
652 exfat_err(sb, "failed to allocate root inode"); in exfat_fill_super()
661 exfat_err(sb, "failed to initialize root inode"); in exfat_fill_super()
668 sb->s_root = d_make_root(root_inode); in exfat_fill_super()
669 if (!sb->s_root) { in exfat_fill_super()
670 exfat_err(sb, "failed to get the root dentry"); in exfat_fill_super()
679 sb->s_root = NULL; in exfat_fill_super()
689 sb->s_fs_info = NULL; in exfat_fill_super()