Lines Matching full:sb
21 void _erofs_printk(struct super_block *sb, const char *fmt, ...) in _erofs_printk() argument
32 if (sb) in _erofs_printk()
34 KERN_SOH_ASCII, level, sb->s_id, &vaf); in _erofs_printk()
40 static int erofs_superblock_csum_verify(struct super_block *sb, void *sbdata) in erofs_superblock_csum_verify() argument
43 u32 len = 1 << EROFS_SB(sb)->blkszbits, crc; in erofs_superblock_csum_verify()
54 erofs_err(sb, "invalid checksum 0x%08x, 0x%08x expected", in erofs_superblock_csum_verify()
66 static struct inode *erofs_alloc_inode(struct super_block *sb) in erofs_alloc_inode() argument
69 alloc_inode_sb(sb, erofs_inode_cachep, GFP_KERNEL); in erofs_alloc_inode()
90 void *erofs_read_metadata(struct super_block *sb, struct erofs_buf *buf, in erofs_read_metadata() argument
111 cnt = min_t(int, sb->s_blocksize - erofs_blkoff(sb, *offset), in erofs_read_metadata()
125 static int z_erofs_parse_cfgs(struct super_block *sb, in z_erofs_parse_cfgs() argument
131 erofs_err(sb, "compression disabled, unable to mount compressed EROFS"); in z_erofs_parse_cfgs()
136 static int erofs_init_device(struct erofs_buf *buf, struct super_block *sb, in erofs_init_device() argument
139 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_init_device()
144 dis = erofs_read_metabuf(buf, sb, *pos, false); in erofs_init_device()
150 erofs_err(sb, "empty device tag @ pos %llu", *pos); in erofs_init_device()
158 if (erofs_is_fscache_mode(sb)) { in erofs_init_device()
159 fscache = erofs_fscache_register_cookie(sb, dif->path, 0); in erofs_init_device()
167 BLK_OPEN_READ, sb->s_type, NULL); in erofs_init_device()
178 erofs_info(sb, "DAX unsupported by %s. Turning off DAX.", in erofs_init_device()
196 static int erofs_scan_devices(struct super_block *sb, in erofs_scan_devices() argument
199 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_scan_devices()
214 erofs_err(sb, "extra devices don't match (ondisk %u, given %u)", in erofs_scan_devices()
220 erofs_info(sb, "DAX unsupported by block device. Turning off DAX."); in erofs_scan_devices()
226 if (!sbi->devs->extra_devices && !erofs_is_fscache_mode(sb)) in erofs_scan_devices()
234 err = erofs_init_device(&buf, sb, dif, &pos); in erofs_scan_devices()
253 err = erofs_init_device(&buf, sb, dif, &pos); in erofs_scan_devices()
263 static int erofs_read_superblock(struct super_block *sb) in erofs_read_superblock() argument
265 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_read_superblock()
271 data = erofs_read_metabuf(&buf, sb, 0, false); in erofs_read_superblock()
273 erofs_err(sb, "cannot read erofs superblock"); in erofs_read_superblock()
280 erofs_err(sb, "cannot find valid erofs superblock"); in erofs_read_superblock()
286 erofs_err(sb, "blkszbits %u isn't supported", sbi->blkszbits); in erofs_read_superblock()
290 erofs_err(sb, "dirblkbits %u isn't supported", dsb->dirblkbits); in erofs_read_superblock()
296 ret = erofs_superblock_csum_verify(sb, data); in erofs_read_superblock()
304 erofs_err(sb, "unidentified incompatible feature %x, please upgrade kernel", in erofs_read_superblock()
311 erofs_err(sb, "invalid sb_extslots %u (more than a fs block)", in erofs_read_superblock()
344 super_set_uuid(sb, (void *)dsb->uuid, sizeof(dsb->uuid)); in erofs_read_superblock()
354 ret = z_erofs_parse_cfgs(sb, dsb); in erofs_read_superblock()
358 ret = erofs_scan_devices(sb, dsb); in erofs_read_superblock()
361 erofs_info(sb, "EXPERIMENTAL 48-bit layout support in use. Use at your own risk!"); in erofs_read_superblock()
363 erofs_info(sb, "EXPERIMENTAL metadata compression support in use. Use at your own risk!"); in erofs_read_superblock()
364 if (erofs_is_fscache_mode(sb)) in erofs_read_superblock()
365 erofs_info(sb, "[deprecated] fscache-based on-demand read feature in use. Use at your own risk!"); in erofs_read_superblock()
573 static struct dentry *erofs_fh_to_dentry(struct super_block *sb, in erofs_fh_to_dentry() argument
580 return d_obtain_alias(erofs_iget(sb, in erofs_fh_to_dentry()
584 static struct dentry *erofs_fh_to_parent(struct super_block *sb, in erofs_fh_to_parent() argument
590 return d_obtain_alias(erofs_iget(sb, in erofs_fh_to_parent()
613 static void erofs_set_sysfs_name(struct super_block *sb) in erofs_set_sysfs_name() argument
615 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_set_sysfs_name()
618 super_set_sysfs_name_generic(sb, "%s,%s", sbi->domain_id, in erofs_set_sysfs_name()
621 super_set_sysfs_name_generic(sb, "%s", sbi->fsid); in erofs_set_sysfs_name()
623 super_set_sysfs_name_generic(sb, "%s", in erofs_set_sysfs_name()
624 bdi_dev_name(sb->s_bdi)); in erofs_set_sysfs_name()
626 super_set_sysfs_name_id(sb); in erofs_set_sysfs_name()
629 static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc) in erofs_fc_fill_super() argument
632 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_fc_fill_super()
635 sb->s_magic = EROFS_SUPER_MAGIC; in erofs_fc_fill_super()
636 sb->s_flags |= SB_RDONLY | SB_NOATIME; in erofs_fc_fill_super()
637 sb->s_maxbytes = MAX_LFS_FILESIZE; in erofs_fc_fill_super()
638 sb->s_op = &erofs_sops; in erofs_fc_fill_super()
641 if (!sb->s_bdev) { in erofs_fc_fill_super()
642 sb->s_blocksize = PAGE_SIZE; in erofs_fc_fill_super()
643 sb->s_blocksize_bits = PAGE_SHIFT; in erofs_fc_fill_super()
645 if (erofs_is_fscache_mode(sb)) { in erofs_fc_fill_super()
646 err = erofs_fscache_register_fs(sb); in erofs_fc_fill_super()
650 err = super_setup_bdi(sb); in erofs_fc_fill_super()
654 if (!sb_set_blocksize(sb, PAGE_SIZE)) { in erofs_fc_fill_super()
659 sbi->dif0.dax_dev = fs_dax_get_by_bdev(sb->s_bdev, in erofs_fc_fill_super()
663 err = erofs_read_superblock(sb); in erofs_fc_fill_super()
667 if (sb->s_blocksize_bits != sbi->blkszbits) { in erofs_fc_fill_super()
668 if (erofs_is_fscache_mode(sb)) { in erofs_fc_fill_super()
674 sb->s_blocksize = 1 << sbi->blkszbits; in erofs_fc_fill_super()
675 sb->s_blocksize_bits = sbi->blkszbits; in erofs_fc_fill_super()
676 } else if (!sb_set_blocksize(sb, 1 << sbi->blkszbits)) { in erofs_fc_fill_super()
683 if (sbi->dif0.fsoff & (sb->s_blocksize - 1)) in erofs_fc_fill_super()
685 sbi->dif0.fsoff, sb->s_blocksize); in erofs_fc_fill_super()
686 if (erofs_is_fscache_mode(sb)) in erofs_fc_fill_super()
691 erofs_info(sb, "unsupported blocksize for DAX"); in erofs_fc_fill_super()
695 sb->s_time_gran = 1; in erofs_fc_fill_super()
696 sb->s_xattr = erofs_xattr_handlers; in erofs_fc_fill_super()
697 sb->s_export_op = &erofs_export_ops; in erofs_fc_fill_super()
700 sb->s_flags |= SB_POSIXACL; in erofs_fc_fill_super()
702 sb->s_flags &= ~SB_POSIXACL; in erofs_fc_fill_super()
704 err = z_erofs_init_super(sb); in erofs_fc_fill_super()
709 inode = erofs_iget(sb, sbi->packed_nid); in erofs_fc_fill_super()
715 inode = erofs_iget(sb, sbi->metabox_nid); in erofs_fc_fill_super()
721 inode = erofs_iget(sb, sbi->root_nid); in erofs_fc_fill_super()
726 erofs_err(sb, "rootino(nid %llu) is not a directory(i_mode %o)", in erofs_fc_fill_super()
731 sb->s_root = d_make_root(inode); in erofs_fc_fill_super()
732 if (!sb->s_root) in erofs_fc_fill_super()
735 erofs_shrinker_register(sb); in erofs_fc_fill_super()
736 err = erofs_xattr_prefixes_init(sb); in erofs_fc_fill_super()
740 erofs_set_sysfs_name(sb); in erofs_fc_fill_super()
741 err = erofs_register_sysfs(sb); in erofs_fc_fill_super()
746 erofs_info(sb, "mounted with root inode @ nid %llu.", sbi->root_nid); in erofs_fc_fill_super()
782 struct super_block *sb = fc->root->d_sb; in erofs_fc_reconfigure() local
783 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_fc_reconfigure()
786 DBG_BUGON(!sb_rdonly(sb)); in erofs_fc_reconfigure()
789 erofs_info(sb, "ignoring reconfiguration for fsid|domain_id."); in erofs_fc_reconfigure()
840 if (sbi) /* free here if an error occurs before transferring to sb */ in erofs_fc_free()
885 static void erofs_kill_sb(struct super_block *sb) in erofs_kill_sb() argument
887 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_kill_sb()
891 kill_anon_super(sb); in erofs_kill_sb()
893 kill_block_super(sb); in erofs_kill_sb()
896 erofs_fscache_unregister_fs(sb); in erofs_kill_sb()
898 sb->s_fs_info = NULL; in erofs_kill_sb()
901 static void erofs_put_super(struct super_block *sb) in erofs_put_super() argument
903 struct erofs_sb_info *const sbi = EROFS_SB(sb); in erofs_put_super()
905 erofs_unregister_sysfs(sb); in erofs_put_super()
906 erofs_shrinker_unregister(sb); in erofs_put_super()
907 erofs_xattr_prefixes_cleanup(sb); in erofs_put_super()
911 erofs_fscache_unregister_fs(sb); in erofs_put_super()
980 struct super_block *sb = dentry->d_sb; in erofs_statfs() local
981 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_statfs()
983 buf->f_type = sb->s_magic; in erofs_statfs()
984 buf->f_bsize = sb->s_blocksize; in erofs_statfs()
991 if (uuid_is_null(&sb->s_uuid)) in erofs_statfs()
992 buf->f_fsid = u64_to_fsid(!sb->s_bdev ? 0 : in erofs_statfs()
993 huge_encode_dev(sb->s_bdev->bd_dev)); in erofs_statfs()
995 buf->f_fsid = uuid_to_fsid(sb->s_uuid.b); in erofs_statfs()