Lines Matching full:sb
20 void _erofs_err(struct super_block *sb, const char *func, const char *fmt, ...) in _erofs_err() argument
30 if (sb) in _erofs_err()
31 pr_err("(device %s): %s: %pV", sb->s_id, func, &vaf); in _erofs_err()
37 void _erofs_info(struct super_block *sb, const char *func, const char *fmt, ...) in _erofs_info() argument
47 if (sb) in _erofs_info()
48 pr_info("(device %s): %pV", sb->s_id, &vaf); in _erofs_info()
54 static int erofs_superblock_csum_verify(struct super_block *sb, void *sbdata) in erofs_superblock_csum_verify() argument
56 size_t len = 1 << EROFS_SB(sb)->blkszbits; in erofs_superblock_csum_verify()
74 erofs_err(sb, "invalid checksum 0x%08x, 0x%08x expected", in erofs_superblock_csum_verify()
88 static struct inode *erofs_alloc_inode(struct super_block *sb) in erofs_alloc_inode() argument
91 alloc_inode_sb(sb, erofs_inode_cachep, GFP_KERNEL); in erofs_alloc_inode()
111 static bool check_layout_compatibility(struct super_block *sb, in check_layout_compatibility() argument
116 EROFS_SB(sb)->feature_incompat = feature; in check_layout_compatibility()
120 erofs_err(sb, "unidentified incompatible feature %x, please upgrade kernel", in check_layout_compatibility()
128 void *erofs_read_metadata(struct super_block *sb, struct erofs_buf *buf, in erofs_read_metadata() argument
135 ptr = erofs_bread(buf, erofs_blknr(sb, *offset), EROFS_KMAP); in erofs_read_metadata()
139 len = le16_to_cpu(*(__le16 *)&ptr[erofs_blkoff(sb, *offset)]); in erofs_read_metadata()
149 cnt = min_t(int, sb->s_blocksize - erofs_blkoff(sb, *offset), in erofs_read_metadata()
151 ptr = erofs_bread(buf, erofs_blknr(sb, *offset), EROFS_KMAP); in erofs_read_metadata()
156 memcpy(buffer + i, ptr + erofs_blkoff(sb, *offset), cnt); in erofs_read_metadata()
163 static int z_erofs_parse_cfgs(struct super_block *sb, in z_erofs_parse_cfgs() argument
169 erofs_err(sb, "compression disabled, unable to mount compressed EROFS"); in z_erofs_parse_cfgs()
174 static int erofs_init_device(struct erofs_buf *buf, struct super_block *sb, in erofs_init_device() argument
177 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_init_device()
183 ptr = erofs_read_metabuf(buf, sb, erofs_blknr(sb, *pos), EROFS_KMAP); in erofs_init_device()
186 dis = ptr + erofs_blkoff(sb, *pos); in erofs_init_device()
190 erofs_err(sb, "empty device tag @ pos %llu", *pos); in erofs_init_device()
198 if (erofs_is_fscache_mode(sb)) { in erofs_init_device()
199 fscache = erofs_fscache_register_cookie(sb, dif->path, 0); in erofs_init_device()
205 sb->s_type, NULL); in erofs_init_device()
220 static int erofs_scan_devices(struct super_block *sb, in erofs_scan_devices() argument
223 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_scan_devices()
238 erofs_err(sb, "extra devices don't match (ondisk %u, given %u)", in erofs_scan_devices()
245 if (!sbi->devs->extra_devices && !erofs_is_fscache_mode(sb)) in erofs_scan_devices()
253 err = erofs_init_device(&buf, sb, dif, &pos); in erofs_scan_devices()
272 err = erofs_init_device(&buf, sb, dif, &pos); in erofs_scan_devices()
282 static int erofs_read_superblock(struct super_block *sb) in erofs_read_superblock() argument
290 data = erofs_read_metabuf(&buf, sb, 0, EROFS_KMAP); in erofs_read_superblock()
292 erofs_err(sb, "cannot read erofs superblock"); in erofs_read_superblock()
296 sbi = EROFS_SB(sb); in erofs_read_superblock()
301 erofs_err(sb, "cannot find valid erofs superblock"); in erofs_read_superblock()
307 erofs_err(sb, "blkszbits %u isn't supported", sbi->blkszbits); in erofs_read_superblock()
311 erofs_err(sb, "dirblkbits %u isn't supported", dsb->dirblkbits); in erofs_read_superblock()
317 ret = erofs_superblock_csum_verify(sb, data); in erofs_read_superblock()
323 if (!check_layout_compatibility(sb, dsb)) in erofs_read_superblock()
328 erofs_err(sb, "invalid sb_extslots %u (more than a fs block)", in erofs_read_superblock()
348 memcpy(&sb->s_uuid, dsb->uuid, sizeof(dsb->uuid)); in erofs_read_superblock()
353 erofs_err(sb, "bad volume name without NIL terminator"); in erofs_read_superblock()
359 ret = z_erofs_parse_cfgs(sb, dsb); in erofs_read_superblock()
364 ret = erofs_scan_devices(sb, dsb); in erofs_read_superblock()
366 if (erofs_is_fscache_mode(sb)) in erofs_read_superblock()
367 erofs_info(sb, "EXPERIMENTAL fscache-based on-demand read feature in use. Use at your own risk!"); in erofs_read_superblock()
543 static struct inode *erofs_nfs_get_inode(struct super_block *sb, in erofs_nfs_get_inode() argument
546 return erofs_iget(sb, ino); in erofs_nfs_get_inode()
549 static struct dentry *erofs_fh_to_dentry(struct super_block *sb, in erofs_fh_to_dentry() argument
552 return generic_fh_to_dentry(sb, fid, fh_len, fh_type, in erofs_fh_to_dentry()
556 static struct dentry *erofs_fh_to_parent(struct super_block *sb, in erofs_fh_to_parent() argument
559 return generic_fh_to_parent(sb, fid, fh_len, fh_type, in erofs_fh_to_parent()
582 static int erofs_fc_fill_pseudo_super(struct super_block *sb, struct fs_context *fc) in erofs_fc_fill_pseudo_super() argument
586 return simple_fill_super(sb, EROFS_SUPER_MAGIC, &empty_descr); in erofs_fc_fill_pseudo_super()
589 static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc) in erofs_fc_fill_super() argument
596 sb->s_magic = EROFS_SUPER_MAGIC; in erofs_fc_fill_super()
597 sb->s_flags |= SB_RDONLY | SB_NOATIME; in erofs_fc_fill_super()
598 sb->s_maxbytes = MAX_LFS_FILESIZE; in erofs_fc_fill_super()
599 sb->s_op = &erofs_sops; in erofs_fc_fill_super()
605 sb->s_fs_info = sbi; in erofs_fc_fill_super()
615 if (erofs_is_fscache_mode(sb)) { in erofs_fc_fill_super()
616 sb->s_blocksize = PAGE_SIZE; in erofs_fc_fill_super()
617 sb->s_blocksize_bits = PAGE_SHIFT; in erofs_fc_fill_super()
619 err = erofs_fscache_register_fs(sb); in erofs_fc_fill_super()
623 err = super_setup_bdi(sb); in erofs_fc_fill_super()
627 if (!sb_set_blocksize(sb, PAGE_SIZE)) { in erofs_fc_fill_super()
632 sbi->dax_dev = fs_dax_get_by_bdev(sb->s_bdev, in erofs_fc_fill_super()
637 err = erofs_read_superblock(sb); in erofs_fc_fill_super()
641 if (sb->s_blocksize_bits != sbi->blkszbits) { in erofs_fc_fill_super()
642 if (erofs_is_fscache_mode(sb)) { in erofs_fc_fill_super()
646 if (!sb_set_blocksize(sb, 1 << sbi->blkszbits)) { in erofs_fc_fill_super()
662 sb->s_time_gran = 1; in erofs_fc_fill_super()
663 sb->s_xattr = erofs_xattr_handlers; in erofs_fc_fill_super()
664 sb->s_export_op = &erofs_export_ops; in erofs_fc_fill_super()
667 sb->s_flags |= SB_POSIXACL; in erofs_fc_fill_super()
669 sb->s_flags &= ~SB_POSIXACL; in erofs_fc_fill_super()
675 inode = erofs_iget(sb, sbi->root_nid); in erofs_fc_fill_super()
680 erofs_err(sb, "rootino(nid %llu) is not a directory(i_mode %o)", in erofs_fc_fill_super()
686 sb->s_root = d_make_root(inode); in erofs_fc_fill_super()
687 if (!sb->s_root) in erofs_fc_fill_super()
690 erofs_shrinker_register(sb); in erofs_fc_fill_super()
692 sbi->packed_inode = erofs_iget(sb, sbi->packed_nid); in erofs_fc_fill_super()
699 err = erofs_init_managed_cache(sb); in erofs_fc_fill_super()
703 err = erofs_xattr_prefixes_init(sb); in erofs_fc_fill_super()
707 err = erofs_register_sysfs(sb); in erofs_fc_fill_super()
711 erofs_info(sb, "mounted with root inode @ nid %llu.", sbi->root_nid); in erofs_fc_fill_super()
732 struct super_block *sb = fc->root->d_sb; in erofs_fc_reconfigure() local
733 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_fc_reconfigure()
736 DBG_BUGON(!sb_rdonly(sb)); in erofs_fc_reconfigure()
739 erofs_info(sb, "ignoring reconfiguration for fsid|domain_id."); in erofs_fc_reconfigure()
823 static void erofs_kill_sb(struct super_block *sb) in erofs_kill_sb() argument
828 if (sb->s_flags & SB_KERNMOUNT) { in erofs_kill_sb()
829 kill_anon_super(sb); in erofs_kill_sb()
833 if (erofs_is_fscache_mode(sb)) in erofs_kill_sb()
834 kill_anon_super(sb); in erofs_kill_sb()
836 kill_block_super(sb); in erofs_kill_sb()
838 sbi = EROFS_SB(sb); in erofs_kill_sb()
844 erofs_fscache_unregister_fs(sb); in erofs_kill_sb()
848 sb->s_fs_info = NULL; in erofs_kill_sb()
851 static void erofs_put_super(struct super_block *sb) in erofs_put_super() argument
853 struct erofs_sb_info *const sbi = EROFS_SB(sb); in erofs_put_super()
857 erofs_unregister_sysfs(sb); in erofs_put_super()
858 erofs_shrinker_unregister(sb); in erofs_put_super()
859 erofs_xattr_prefixes_cleanup(sb); in erofs_put_super()
868 erofs_fscache_unregister_fs(sb); in erofs_put_super()
953 struct super_block *sb = dentry->d_sb; in erofs_statfs() local
954 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_statfs()
957 if (!erofs_is_fscache_mode(sb)) in erofs_statfs()
958 id = huge_encode_dev(sb->s_bdev->bd_dev); in erofs_statfs()
960 buf->f_type = sb->s_magic; in erofs_statfs()
961 buf->f_bsize = sb->s_blocksize; in erofs_statfs()