Lines Matching full:sbi

139 	struct erofs_sb_info *sbi = EROFS_SB(sb);  in erofs_init_device()  local
148 if (!sbi->devs->flatdev && !dif->path) { in erofs_init_device()
163 } else if (!sbi->devs->flatdev) { in erofs_init_device()
164 file = erofs_is_fileio_mode(sbi) ? in erofs_init_device()
171 if (!erofs_is_fileio_mode(sbi)) { in erofs_init_device()
183 sbi->total_blocks += dif->blocks; in erofs_init_device()
191 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_scan_devices() local
198 sbi->total_blocks = sbi->dif0.blocks; in erofs_scan_devices()
199 if (!erofs_sb_has_device_table(sbi)) in erofs_scan_devices()
204 if (sbi->devs->extra_devices && in erofs_scan_devices()
205 ondisk_extradevs != sbi->devs->extra_devices) { in erofs_scan_devices()
207 ondisk_extradevs, sbi->devs->extra_devices); in erofs_scan_devices()
213 if (!sbi->devs->extra_devices && !erofs_is_fscache_mode(sb)) in erofs_scan_devices()
214 sbi->devs->flatdev = true; in erofs_scan_devices()
216 sbi->device_id_mask = roundup_pow_of_two(ondisk_extradevs + 1) - 1; in erofs_scan_devices()
218 down_read(&sbi->devs->rwsem); in erofs_scan_devices()
219 if (sbi->devs->extra_devices) { in erofs_scan_devices()
220 idr_for_each_entry(&sbi->devs->tree, dif, id) { in erofs_scan_devices()
233 err = idr_alloc(&sbi->devs->tree, dif, 0, 0, GFP_KERNEL); in erofs_scan_devices()
238 ++sbi->devs->extra_devices; in erofs_scan_devices()
245 up_read(&sbi->devs->rwsem); in erofs_scan_devices()
252 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_read_superblock() local
271 sbi->blkszbits = dsb->blkszbits; in erofs_read_superblock()
272 if (sbi->blkszbits < 9 || sbi->blkszbits > PAGE_SHIFT) { in erofs_read_superblock()
273 erofs_err(sb, "blkszbits %u isn't supported", sbi->blkszbits); in erofs_read_superblock()
281 sbi->feature_compat = le32_to_cpu(dsb->feature_compat); in erofs_read_superblock()
282 if (erofs_sb_has_sb_chksum(sbi)) { in erofs_read_superblock()
289 sbi->feature_incompat = le32_to_cpu(dsb->feature_incompat); in erofs_read_superblock()
290 if (sbi->feature_incompat & ~EROFS_ALL_FEATURE_INCOMPAT) { in erofs_read_superblock()
292 sbi->feature_incompat & ~EROFS_ALL_FEATURE_INCOMPAT); in erofs_read_superblock()
296 sbi->sb_size = 128 + dsb->sb_extslots * EROFS_SB_EXTSLOT_SIZE; in erofs_read_superblock()
297 if (sbi->sb_size > PAGE_SIZE - EROFS_SUPER_OFFSET) { in erofs_read_superblock()
299 sbi->sb_size); in erofs_read_superblock()
302 sbi->dif0.blocks = le32_to_cpu(dsb->blocks); in erofs_read_superblock()
303 sbi->meta_blkaddr = le32_to_cpu(dsb->meta_blkaddr); in erofs_read_superblock()
305 sbi->xattr_blkaddr = le32_to_cpu(dsb->xattr_blkaddr); in erofs_read_superblock()
306 sbi->xattr_prefix_start = le32_to_cpu(dsb->xattr_prefix_start); in erofs_read_superblock()
307 sbi->xattr_prefix_count = dsb->xattr_prefix_count; in erofs_read_superblock()
308 sbi->xattr_filter_reserved = dsb->xattr_filter_reserved; in erofs_read_superblock()
310 sbi->islotbits = ilog2(sizeof(struct erofs_inode_compact)); in erofs_read_superblock()
311 sbi->root_nid = le16_to_cpu(dsb->root_nid); in erofs_read_superblock()
312 sbi->packed_nid = le64_to_cpu(dsb->packed_nid); in erofs_read_superblock()
313 sbi->inos = le64_to_cpu(dsb->inos); in erofs_read_superblock()
315 sbi->build_time = le64_to_cpu(dsb->build_time); in erofs_read_superblock()
316 sbi->build_time_nsec = le32_to_cpu(dsb->build_time_nsec); in erofs_read_superblock()
335 static void erofs_default_options(struct erofs_sb_info *sbi) in erofs_default_options() argument
338 sbi->opt.cache_strategy = EROFS_ZIP_CACHE_READAROUND; in erofs_default_options()
339 sbi->opt.max_sync_decompress_pages = 3; in erofs_default_options()
340 sbi->opt.sync_decompress = EROFS_SYNC_DECOMPRESS_AUTO; in erofs_default_options()
343 set_opt(&sbi->opt, XATTR_USER); in erofs_default_options()
346 set_opt(&sbi->opt, POSIX_ACL); in erofs_default_options()
386 struct erofs_sb_info *sbi = fc->s_fs_info; in erofs_fc_set_dax_mode() local
390 set_opt(&sbi->opt, DAX_ALWAYS); in erofs_fc_set_dax_mode()
391 clear_opt(&sbi->opt, DAX_NEVER); in erofs_fc_set_dax_mode()
394 set_opt(&sbi->opt, DAX_NEVER); in erofs_fc_set_dax_mode()
395 clear_opt(&sbi->opt, DAX_ALWAYS); in erofs_fc_set_dax_mode()
410 struct erofs_sb_info *sbi = fc->s_fs_info; in erofs_fc_parse_param() local
423 set_opt(&sbi->opt, XATTR_USER); in erofs_fc_parse_param()
425 clear_opt(&sbi->opt, XATTR_USER); in erofs_fc_parse_param()
433 set_opt(&sbi->opt, POSIX_ACL); in erofs_fc_parse_param()
435 clear_opt(&sbi->opt, POSIX_ACL); in erofs_fc_parse_param()
442 sbi->opt.cache_strategy = result.uint_32; in erofs_fc_parse_param()
464 down_write(&sbi->devs->rwsem); in erofs_fc_parse_param()
465 ret = idr_alloc(&sbi->devs->tree, dif, 0, 0, GFP_KERNEL); in erofs_fc_parse_param()
466 up_write(&sbi->devs->rwsem); in erofs_fc_parse_param()
472 ++sbi->devs->extra_devices; in erofs_fc_parse_param()
476 kfree(sbi->fsid); in erofs_fc_parse_param()
477 sbi->fsid = kstrdup(param->string, GFP_KERNEL); in erofs_fc_parse_param()
478 if (!sbi->fsid) in erofs_fc_parse_param()
482 kfree(sbi->domain_id); in erofs_fc_parse_param()
483 sbi->domain_id = kstrdup(param->string, GFP_KERNEL); in erofs_fc_parse_param()
484 if (!sbi->domain_id) in erofs_fc_parse_param()
496 set_opt(&sbi->opt, DIRECT_IO); in erofs_fc_parse_param()
498 clear_opt(&sbi->opt, DIRECT_IO); in erofs_fc_parse_param()
548 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_set_sysfs_name() local
550 if (sbi->domain_id) in erofs_set_sysfs_name()
551 super_set_sysfs_name_generic(sb, "%s,%s", sbi->domain_id, in erofs_set_sysfs_name()
552 sbi->fsid); in erofs_set_sysfs_name()
553 else if (sbi->fsid) in erofs_set_sysfs_name()
554 super_set_sysfs_name_generic(sb, "%s", sbi->fsid); in erofs_set_sysfs_name()
555 else if (erofs_is_fileio_mode(sbi)) in erofs_set_sysfs_name()
565 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_fc_fill_super() local
573 sbi->blkszbits = PAGE_SHIFT; in erofs_fc_fill_super()
592 sbi->dif0.dax_dev = fs_dax_get_by_bdev(sb->s_bdev, in erofs_fc_fill_super()
593 &sbi->dif0.dax_part_off, NULL, NULL); in erofs_fc_fill_super()
600 if (sb->s_blocksize_bits != sbi->blkszbits) { in erofs_fc_fill_super()
606 if (erofs_is_fileio_mode(sbi)) { in erofs_fc_fill_super()
607 sb->s_blocksize = 1 << sbi->blkszbits; in erofs_fc_fill_super()
608 sb->s_blocksize_bits = sbi->blkszbits; in erofs_fc_fill_super()
609 } else if (!sb_set_blocksize(sb, 1 << sbi->blkszbits)) { in erofs_fc_fill_super()
615 if (test_opt(&sbi->opt, DAX_ALWAYS)) { in erofs_fc_fill_super()
616 if (!sbi->dif0.dax_dev) { in erofs_fc_fill_super()
618 clear_opt(&sbi->opt, DAX_ALWAYS); in erofs_fc_fill_super()
619 } else if (sbi->blkszbits != PAGE_SHIFT) { in erofs_fc_fill_super()
621 clear_opt(&sbi->opt, DAX_ALWAYS); in erofs_fc_fill_super()
629 if (test_opt(&sbi->opt, POSIX_ACL)) in erofs_fc_fill_super()
635 xa_init(&sbi->managed_pslots); in erofs_fc_fill_super()
638 inode = erofs_iget(sb, sbi->root_nid); in erofs_fc_fill_super()
644 sbi->root_nid, inode->i_mode); in erofs_fc_fill_super()
654 if (erofs_sb_has_fragments(sbi) && sbi->packed_nid) { in erofs_fc_fill_super()
655 sbi->packed_inode = erofs_iget(sb, sbi->packed_nid); in erofs_fc_fill_super()
656 if (IS_ERR(sbi->packed_inode)) { in erofs_fc_fill_super()
657 err = PTR_ERR(sbi->packed_inode); in erofs_fc_fill_super()
658 sbi->packed_inode = NULL; in erofs_fc_fill_super()
675 erofs_info(sb, "mounted with root inode @ nid %llu.", sbi->root_nid); in erofs_fc_fill_super()
681 struct erofs_sb_info *sbi = fc->s_fs_info; in erofs_fc_get_tree() local
684 if (IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND) && sbi->fsid) in erofs_fc_get_tree()
699 sbi->dif0.file = file; in erofs_fc_get_tree()
701 if (S_ISREG(file_inode(sbi->dif0.file)->i_mode) && in erofs_fc_get_tree()
702 sbi->dif0.file->f_mapping->a_ops->read_folio) in erofs_fc_get_tree()
712 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_fc_reconfigure() local
725 sbi->opt = new_sbi->opt; in erofs_fc_reconfigure()
754 static void erofs_sb_free(struct erofs_sb_info *sbi) in erofs_sb_free() argument
756 erofs_free_dev_context(sbi->devs); in erofs_sb_free()
757 kfree(sbi->fsid); in erofs_sb_free()
758 kfree(sbi->domain_id); in erofs_sb_free()
759 if (sbi->dif0.file) in erofs_sb_free()
760 fput(sbi->dif0.file); in erofs_sb_free()
761 kfree(sbi); in erofs_sb_free()
766 struct erofs_sb_info *sbi = fc->s_fs_info; in erofs_fc_free() local
768 if (sbi) /* free here if an error occurs before transferring to sb */ in erofs_fc_free()
769 erofs_sb_free(sbi); in erofs_fc_free()
781 struct erofs_sb_info *sbi; in erofs_init_fs_context() local
783 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); in erofs_init_fs_context()
784 if (!sbi) in erofs_init_fs_context()
787 sbi->devs = kzalloc(sizeof(struct erofs_dev_context), GFP_KERNEL); in erofs_init_fs_context()
788 if (!sbi->devs) { in erofs_init_fs_context()
789 kfree(sbi); in erofs_init_fs_context()
792 fc->s_fs_info = sbi; in erofs_init_fs_context()
794 idr_init(&sbi->devs->tree); in erofs_init_fs_context()
795 init_rwsem(&sbi->devs->rwsem); in erofs_init_fs_context()
796 erofs_default_options(sbi); in erofs_init_fs_context()
803 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_kill_sb() local
805 if ((IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND) && sbi->fsid) || in erofs_kill_sb()
806 sbi->dif0.file) in erofs_kill_sb()
810 fs_put_dax(sbi->dif0.dax_dev, NULL); in erofs_kill_sb()
812 erofs_sb_free(sbi); in erofs_kill_sb()
818 struct erofs_sb_info *const sbi = EROFS_SB(sb); in erofs_put_super() local
820 DBG_BUGON(!sbi); in erofs_put_super()
826 iput(sbi->managed_cache); in erofs_put_super()
827 sbi->managed_cache = NULL; in erofs_put_super()
829 iput(sbi->packed_inode); in erofs_put_super()
830 sbi->packed_inode = NULL; in erofs_put_super()
831 erofs_free_dev_context(sbi->devs); in erofs_put_super()
832 sbi->devs = NULL; in erofs_put_super()
903 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_statfs() local
907 buf->f_blocks = sbi->total_blocks; in erofs_statfs()
910 buf->f_ffree = ULLONG_MAX - sbi->inos; in erofs_statfs()
923 struct erofs_sb_info *sbi = EROFS_SB(root->d_sb); in erofs_show_options() local
924 struct erofs_mount_opts *opt = &sbi->opt; in erofs_show_options()
938 if (erofs_is_fileio_mode(sbi) && test_opt(opt, DIRECT_IO)) in erofs_show_options()
941 if (sbi->fsid) in erofs_show_options()
942 seq_printf(seq, ",fsid=%s", sbi->fsid); in erofs_show_options()
943 if (sbi->domain_id) in erofs_show_options()
944 seq_printf(seq, ",domain_id=%s", sbi->domain_id); in erofs_show_options()