Lines Matching full:sbi
162 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_init_device() local
171 if (!sbi->devs->flatdev && !dif->path) { in erofs_init_device()
186 } else if (!sbi->devs->flatdev) { in erofs_init_device()
187 file = erofs_is_fileio_mode(sbi) ? in erofs_init_device()
194 if (!erofs_is_fileio_mode(sbi)) { in erofs_init_device()
206 sbi->total_blocks += dif->blocks; in erofs_init_device()
214 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_scan_devices() local
221 sbi->total_blocks = sbi->primarydevice_blocks; in erofs_scan_devices()
222 if (!erofs_sb_has_device_table(sbi)) in erofs_scan_devices()
227 if (sbi->devs->extra_devices && in erofs_scan_devices()
228 ondisk_extradevs != sbi->devs->extra_devices) { in erofs_scan_devices()
230 ondisk_extradevs, sbi->devs->extra_devices); in erofs_scan_devices()
236 if (!sbi->devs->extra_devices && !erofs_is_fscache_mode(sb)) in erofs_scan_devices()
237 sbi->devs->flatdev = true; in erofs_scan_devices()
239 sbi->device_id_mask = roundup_pow_of_two(ondisk_extradevs + 1) - 1; in erofs_scan_devices()
241 down_read(&sbi->devs->rwsem); in erofs_scan_devices()
242 if (sbi->devs->extra_devices) { in erofs_scan_devices()
243 idr_for_each_entry(&sbi->devs->tree, dif, id) { in erofs_scan_devices()
256 err = idr_alloc(&sbi->devs->tree, dif, 0, 0, GFP_KERNEL); in erofs_scan_devices()
261 ++sbi->devs->extra_devices; in erofs_scan_devices()
268 up_read(&sbi->devs->rwsem); in erofs_scan_devices()
275 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_read_superblock() local
294 sbi->blkszbits = dsb->blkszbits; in erofs_read_superblock()
295 if (sbi->blkszbits < 9 || sbi->blkszbits > PAGE_SHIFT) { in erofs_read_superblock()
296 erofs_err(sb, "blkszbits %u isn't supported", sbi->blkszbits); in erofs_read_superblock()
304 sbi->feature_compat = le32_to_cpu(dsb->feature_compat); in erofs_read_superblock()
305 if (erofs_sb_has_sb_chksum(sbi)) { in erofs_read_superblock()
312 sbi->feature_incompat = le32_to_cpu(dsb->feature_incompat); in erofs_read_superblock()
313 if (sbi->feature_incompat & ~EROFS_ALL_FEATURE_INCOMPAT) { in erofs_read_superblock()
315 sbi->feature_incompat & ~EROFS_ALL_FEATURE_INCOMPAT); in erofs_read_superblock()
319 sbi->sb_size = 128 + dsb->sb_extslots * EROFS_SB_EXTSLOT_SIZE; in erofs_read_superblock()
320 if (sbi->sb_size > PAGE_SIZE - EROFS_SUPER_OFFSET) { in erofs_read_superblock()
322 sbi->sb_size); in erofs_read_superblock()
325 sbi->primarydevice_blocks = le32_to_cpu(dsb->blocks); in erofs_read_superblock()
326 sbi->meta_blkaddr = le32_to_cpu(dsb->meta_blkaddr); in erofs_read_superblock()
328 sbi->xattr_blkaddr = le32_to_cpu(dsb->xattr_blkaddr); in erofs_read_superblock()
329 sbi->xattr_prefix_start = le32_to_cpu(dsb->xattr_prefix_start); in erofs_read_superblock()
330 sbi->xattr_prefix_count = dsb->xattr_prefix_count; in erofs_read_superblock()
331 sbi->xattr_filter_reserved = dsb->xattr_filter_reserved; in erofs_read_superblock()
333 sbi->islotbits = ilog2(sizeof(struct erofs_inode_compact)); in erofs_read_superblock()
334 sbi->root_nid = le16_to_cpu(dsb->root_nid); in erofs_read_superblock()
335 sbi->packed_nid = le64_to_cpu(dsb->packed_nid); in erofs_read_superblock()
336 sbi->inos = le64_to_cpu(dsb->inos); in erofs_read_superblock()
338 sbi->build_time = le64_to_cpu(dsb->build_time); in erofs_read_superblock()
339 sbi->build_time_nsec = le32_to_cpu(dsb->build_time_nsec); in erofs_read_superblock()
343 ret = strscpy(sbi->volume_name, dsb->volume_name, in erofs_read_superblock()
366 static void erofs_default_options(struct erofs_sb_info *sbi) in erofs_default_options() argument
369 sbi->opt.cache_strategy = EROFS_ZIP_CACHE_READAROUND; in erofs_default_options()
370 sbi->opt.max_sync_decompress_pages = 3; in erofs_default_options()
371 sbi->opt.sync_decompress = EROFS_SYNC_DECOMPRESS_AUTO; in erofs_default_options()
374 set_opt(&sbi->opt, XATTR_USER); in erofs_default_options()
377 set_opt(&sbi->opt, POSIX_ACL); in erofs_default_options()
422 struct erofs_sb_info *sbi = fc->s_fs_info; in erofs_fc_set_dax_mode() local
426 set_opt(&sbi->opt, DAX_ALWAYS); in erofs_fc_set_dax_mode()
427 clear_opt(&sbi->opt, DAX_NEVER); in erofs_fc_set_dax_mode()
430 set_opt(&sbi->opt, DAX_NEVER); in erofs_fc_set_dax_mode()
431 clear_opt(&sbi->opt, DAX_ALWAYS); in erofs_fc_set_dax_mode()
446 struct erofs_sb_info *sbi = fc->s_fs_info; in erofs_fc_parse_param() local
459 set_opt(&sbi->opt, XATTR_USER); in erofs_fc_parse_param()
461 clear_opt(&sbi->opt, XATTR_USER); in erofs_fc_parse_param()
469 set_opt(&sbi->opt, POSIX_ACL); in erofs_fc_parse_param()
471 clear_opt(&sbi->opt, POSIX_ACL); in erofs_fc_parse_param()
478 sbi->opt.cache_strategy = result.uint_32; in erofs_fc_parse_param()
500 down_write(&sbi->devs->rwsem); in erofs_fc_parse_param()
501 ret = idr_alloc(&sbi->devs->tree, dif, 0, 0, GFP_KERNEL); in erofs_fc_parse_param()
502 up_write(&sbi->devs->rwsem); in erofs_fc_parse_param()
508 ++sbi->devs->extra_devices; in erofs_fc_parse_param()
512 kfree(sbi->fsid); in erofs_fc_parse_param()
513 sbi->fsid = kstrdup(param->string, GFP_KERNEL); in erofs_fc_parse_param()
514 if (!sbi->fsid) in erofs_fc_parse_param()
518 kfree(sbi->domain_id); in erofs_fc_parse_param()
519 sbi->domain_id = kstrdup(param->string, GFP_KERNEL); in erofs_fc_parse_param()
520 if (!sbi->domain_id) in erofs_fc_parse_param()
576 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_set_sysfs_name() local
578 if (sbi->domain_id) in erofs_set_sysfs_name()
579 super_set_sysfs_name_generic(sb, "%s,%s", sbi->domain_id, in erofs_set_sysfs_name()
580 sbi->fsid); in erofs_set_sysfs_name()
581 else if (sbi->fsid) in erofs_set_sysfs_name()
582 super_set_sysfs_name_generic(sb, "%s", sbi->fsid); in erofs_set_sysfs_name()
583 else if (erofs_is_fileio_mode(sbi)) in erofs_set_sysfs_name()
593 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_fc_fill_super() local
601 sbi->blkszbits = PAGE_SHIFT; in erofs_fc_fill_super()
620 sbi->dax_dev = fs_dax_get_by_bdev(sb->s_bdev, in erofs_fc_fill_super()
621 &sbi->dax_part_off, in erofs_fc_fill_super()
629 if (sb->s_blocksize_bits != sbi->blkszbits) { in erofs_fc_fill_super()
634 if (!sb_set_blocksize(sb, 1 << sbi->blkszbits)) { in erofs_fc_fill_super()
640 if (test_opt(&sbi->opt, DAX_ALWAYS)) { in erofs_fc_fill_super()
641 if (!sbi->dax_dev) { in erofs_fc_fill_super()
643 clear_opt(&sbi->opt, DAX_ALWAYS); in erofs_fc_fill_super()
644 } else if (sbi->blkszbits != PAGE_SHIFT) { in erofs_fc_fill_super()
646 clear_opt(&sbi->opt, DAX_ALWAYS); in erofs_fc_fill_super()
654 if (test_opt(&sbi->opt, POSIX_ACL)) in erofs_fc_fill_super()
660 xa_init(&sbi->managed_pslots); in erofs_fc_fill_super()
663 inode = erofs_iget(sb, sbi->root_nid); in erofs_fc_fill_super()
669 sbi->root_nid, inode->i_mode); in erofs_fc_fill_super()
679 if (erofs_sb_has_fragments(sbi) && sbi->packed_nid) { in erofs_fc_fill_super()
680 sbi->packed_inode = erofs_iget(sb, sbi->packed_nid); in erofs_fc_fill_super()
681 if (IS_ERR(sbi->packed_inode)) { in erofs_fc_fill_super()
682 err = PTR_ERR(sbi->packed_inode); in erofs_fc_fill_super()
683 sbi->packed_inode = NULL; in erofs_fc_fill_super()
700 erofs_info(sb, "mounted with root inode @ nid %llu.", sbi->root_nid); in erofs_fc_fill_super()
706 struct erofs_sb_info *sbi = fc->s_fs_info; in erofs_fc_get_tree() local
709 if (IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND) && sbi->fsid) in erofs_fc_get_tree()
719 sbi->fdev = filp_open(fc->source, O_RDONLY | O_LARGEFILE, 0); in erofs_fc_get_tree()
720 if (IS_ERR(sbi->fdev)) in erofs_fc_get_tree()
721 return PTR_ERR(sbi->fdev); in erofs_fc_get_tree()
723 if (S_ISREG(file_inode(sbi->fdev)->i_mode) && in erofs_fc_get_tree()
724 sbi->fdev->f_mapping->a_ops->read_folio) in erofs_fc_get_tree()
726 fput(sbi->fdev); in erofs_fc_get_tree()
735 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_fc_reconfigure() local
748 sbi->opt = new_sbi->opt; in erofs_fc_reconfigure()
779 struct erofs_sb_info *sbi = fc->s_fs_info; in erofs_fc_free() local
781 if (!sbi) in erofs_fc_free()
784 erofs_free_dev_context(sbi->devs); in erofs_fc_free()
785 kfree(sbi->fsid); in erofs_fc_free()
786 kfree(sbi->domain_id); in erofs_fc_free()
787 kfree(sbi); in erofs_fc_free()
799 struct erofs_sb_info *sbi; in erofs_init_fs_context() local
801 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); in erofs_init_fs_context()
802 if (!sbi) in erofs_init_fs_context()
805 sbi->devs = kzalloc(sizeof(struct erofs_dev_context), GFP_KERNEL); in erofs_init_fs_context()
806 if (!sbi->devs) { in erofs_init_fs_context()
807 kfree(sbi); in erofs_init_fs_context()
810 fc->s_fs_info = sbi; in erofs_init_fs_context()
812 idr_init(&sbi->devs->tree); in erofs_init_fs_context()
813 init_rwsem(&sbi->devs->rwsem); in erofs_init_fs_context()
814 erofs_default_options(sbi); in erofs_init_fs_context()
821 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_kill_sb() local
823 if ((IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND) && sbi->fsid) || sbi->fdev) in erofs_kill_sb()
828 erofs_free_dev_context(sbi->devs); in erofs_kill_sb()
829 fs_put_dax(sbi->dax_dev, NULL); in erofs_kill_sb()
831 kfree(sbi->fsid); in erofs_kill_sb()
832 kfree(sbi->domain_id); in erofs_kill_sb()
833 if (sbi->fdev) in erofs_kill_sb()
834 fput(sbi->fdev); in erofs_kill_sb()
835 kfree(sbi); in erofs_kill_sb()
841 struct erofs_sb_info *const sbi = EROFS_SB(sb); in erofs_put_super() local
843 DBG_BUGON(!sbi); in erofs_put_super()
849 iput(sbi->managed_cache); in erofs_put_super()
850 sbi->managed_cache = NULL; in erofs_put_super()
852 iput(sbi->packed_inode); in erofs_put_super()
853 sbi->packed_inode = NULL; in erofs_put_super()
854 erofs_free_dev_context(sbi->devs); in erofs_put_super()
855 sbi->devs = NULL; in erofs_put_super()
926 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_statfs() local
930 buf->f_blocks = sbi->total_blocks; in erofs_statfs()
933 buf->f_ffree = ULLONG_MAX - sbi->inos; in erofs_statfs()
946 struct erofs_sb_info *sbi = EROFS_SB(root->d_sb); in erofs_show_options() local
947 struct erofs_mount_opts *opt = &sbi->opt; in erofs_show_options()
962 if (sbi->fsid) in erofs_show_options()
963 seq_printf(seq, ",fsid=%s", sbi->fsid); in erofs_show_options()
964 if (sbi->domain_id) in erofs_show_options()
965 seq_printf(seq, ",domain_id=%s", sbi->domain_id); in erofs_show_options()