Lines Matching full:sbi

174 	struct erofs_sb_info *sbi = EROFS_SB(sb);  in erofs_init_device()  local
185 if (!sbi->devs->flatdev && !dif->path) { in erofs_init_device()
200 } else if (!sbi->devs->flatdev) { in erofs_init_device()
212 sbi->total_blocks += dif->blocks; in erofs_init_device()
220 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_scan_devices() local
227 sbi->total_blocks = sbi->primarydevice_blocks; in erofs_scan_devices()
228 if (!erofs_sb_has_device_table(sbi)) in erofs_scan_devices()
233 if (sbi->devs->extra_devices && in erofs_scan_devices()
234 ondisk_extradevs != sbi->devs->extra_devices) { in erofs_scan_devices()
236 ondisk_extradevs, sbi->devs->extra_devices); in erofs_scan_devices()
242 if (!sbi->devs->extra_devices && !erofs_is_fscache_mode(sb)) in erofs_scan_devices()
243 sbi->devs->flatdev = true; in erofs_scan_devices()
245 sbi->device_id_mask = roundup_pow_of_two(ondisk_extradevs + 1) - 1; in erofs_scan_devices()
247 down_read(&sbi->devs->rwsem); in erofs_scan_devices()
248 if (sbi->devs->extra_devices) { in erofs_scan_devices()
249 idr_for_each_entry(&sbi->devs->tree, dif, id) { in erofs_scan_devices()
262 err = idr_alloc(&sbi->devs->tree, dif, 0, 0, GFP_KERNEL); in erofs_scan_devices()
267 ++sbi->devs->extra_devices; in erofs_scan_devices()
274 up_read(&sbi->devs->rwsem); in erofs_scan_devices()
281 struct erofs_sb_info *sbi; in erofs_read_superblock() local
293 sbi = EROFS_SB(sb); in erofs_read_superblock()
302 sbi->blkszbits = dsb->blkszbits; in erofs_read_superblock()
303 if (sbi->blkszbits < 9 || sbi->blkszbits > PAGE_SHIFT) { in erofs_read_superblock()
304 erofs_err(sb, "blkszbits %u isn't supported", sbi->blkszbits); in erofs_read_superblock()
312 sbi->feature_compat = le32_to_cpu(dsb->feature_compat); in erofs_read_superblock()
313 if (erofs_sb_has_sb_chksum(sbi)) { in erofs_read_superblock()
323 sbi->sb_size = 128 + dsb->sb_extslots * EROFS_SB_EXTSLOT_SIZE; in erofs_read_superblock()
324 if (sbi->sb_size > PAGE_SIZE - EROFS_SUPER_OFFSET) { in erofs_read_superblock()
326 sbi->sb_size); in erofs_read_superblock()
329 sbi->primarydevice_blocks = le32_to_cpu(dsb->blocks); in erofs_read_superblock()
330 sbi->meta_blkaddr = le32_to_cpu(dsb->meta_blkaddr); in erofs_read_superblock()
332 sbi->xattr_blkaddr = le32_to_cpu(dsb->xattr_blkaddr); in erofs_read_superblock()
333 sbi->xattr_prefix_start = le32_to_cpu(dsb->xattr_prefix_start); in erofs_read_superblock()
334 sbi->xattr_prefix_count = dsb->xattr_prefix_count; in erofs_read_superblock()
335 sbi->xattr_filter_reserved = dsb->xattr_filter_reserved; in erofs_read_superblock()
337 sbi->islotbits = ilog2(sizeof(struct erofs_inode_compact)); in erofs_read_superblock()
338 sbi->root_nid = le16_to_cpu(dsb->root_nid); in erofs_read_superblock()
339 sbi->packed_nid = le64_to_cpu(dsb->packed_nid); in erofs_read_superblock()
340 sbi->inos = le64_to_cpu(dsb->inos); in erofs_read_superblock()
342 sbi->build_time = le64_to_cpu(dsb->build_time); in erofs_read_superblock()
343 sbi->build_time_nsec = le32_to_cpu(dsb->build_time_nsec); in erofs_read_superblock()
347 ret = strscpy(sbi->volume_name, dsb->volume_name, in erofs_read_superblock()
370 static void erofs_default_options(struct erofs_sb_info *sbi) in erofs_default_options() argument
373 sbi->opt.cache_strategy = EROFS_ZIP_CACHE_READAROUND; in erofs_default_options()
374 sbi->opt.max_sync_decompress_pages = 3; in erofs_default_options()
375 sbi->opt.sync_decompress = EROFS_SYNC_DECOMPRESS_AUTO; in erofs_default_options()
378 set_opt(&sbi->opt, XATTR_USER); in erofs_default_options()
381 set_opt(&sbi->opt, POSIX_ACL); in erofs_default_options()
426 struct erofs_sb_info *sbi = fc->s_fs_info; in erofs_fc_set_dax_mode() local
431 set_opt(&sbi->opt, DAX_ALWAYS); in erofs_fc_set_dax_mode()
432 clear_opt(&sbi->opt, DAX_NEVER); in erofs_fc_set_dax_mode()
435 set_opt(&sbi->opt, DAX_NEVER); in erofs_fc_set_dax_mode()
436 clear_opt(&sbi->opt, DAX_ALWAYS); in erofs_fc_set_dax_mode()
451 struct erofs_sb_info *sbi = fc->s_fs_info; in erofs_fc_parse_param() local
464 set_opt(&sbi->opt, XATTR_USER); in erofs_fc_parse_param()
466 clear_opt(&sbi->opt, XATTR_USER); in erofs_fc_parse_param()
474 set_opt(&sbi->opt, POSIX_ACL); in erofs_fc_parse_param()
476 clear_opt(&sbi->opt, POSIX_ACL); in erofs_fc_parse_param()
483 sbi->opt.cache_strategy = result.uint_32; in erofs_fc_parse_param()
505 down_write(&sbi->devs->rwsem); in erofs_fc_parse_param()
506 ret = idr_alloc(&sbi->devs->tree, dif, 0, 0, GFP_KERNEL); in erofs_fc_parse_param()
507 up_write(&sbi->devs->rwsem); in erofs_fc_parse_param()
513 ++sbi->devs->extra_devices; in erofs_fc_parse_param()
517 kfree(sbi->fsid); in erofs_fc_parse_param()
518 sbi->fsid = kstrdup(param->string, GFP_KERNEL); in erofs_fc_parse_param()
519 if (!sbi->fsid) in erofs_fc_parse_param()
523 kfree(sbi->domain_id); in erofs_fc_parse_param()
524 sbi->domain_id = kstrdup(param->string, GFP_KERNEL); in erofs_fc_parse_param()
525 if (!sbi->domain_id) in erofs_fc_parse_param()
581 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_fc_fill_super() local
589 sbi->blkszbits = PAGE_SHIFT; in erofs_fc_fill_super()
607 sbi->dax_dev = fs_dax_get_by_bdev(sb->s_bdev, in erofs_fc_fill_super()
608 &sbi->dax_part_off, in erofs_fc_fill_super()
616 if (sb->s_blocksize_bits != sbi->blkszbits) { in erofs_fc_fill_super()
621 if (!sb_set_blocksize(sb, 1 << sbi->blkszbits)) { in erofs_fc_fill_super()
627 if (test_opt(&sbi->opt, DAX_ALWAYS)) { in erofs_fc_fill_super()
628 if (!sbi->dax_dev) { in erofs_fc_fill_super()
630 clear_opt(&sbi->opt, DAX_ALWAYS); in erofs_fc_fill_super()
631 } else if (sbi->blkszbits != PAGE_SHIFT) { in erofs_fc_fill_super()
633 clear_opt(&sbi->opt, DAX_ALWAYS); in erofs_fc_fill_super()
641 if (test_opt(&sbi->opt, POSIX_ACL)) in erofs_fc_fill_super()
647 xa_init(&sbi->managed_pslots); in erofs_fc_fill_super()
650 inode = erofs_iget(sb, ROOT_NID(sbi)); in erofs_fc_fill_super()
656 ROOT_NID(sbi), inode->i_mode); in erofs_fc_fill_super()
666 if (erofs_sb_has_fragments(sbi) && sbi->packed_nid) { in erofs_fc_fill_super()
667 sbi->packed_inode = erofs_iget(sb, sbi->packed_nid); in erofs_fc_fill_super()
668 if (IS_ERR(sbi->packed_inode)) { in erofs_fc_fill_super()
669 err = PTR_ERR(sbi->packed_inode); in erofs_fc_fill_super()
670 sbi->packed_inode = NULL; in erofs_fc_fill_super()
686 erofs_info(sb, "mounted with root inode @ nid %llu.", ROOT_NID(sbi)); in erofs_fc_fill_super()
692 struct erofs_sb_info *sbi = fc->s_fs_info; in erofs_fc_get_tree() local
694 if (IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND) && sbi->fsid) in erofs_fc_get_tree()
703 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_fc_reconfigure() local
716 sbi->opt = new_sbi->opt; in erofs_fc_reconfigure()
747 struct erofs_sb_info *sbi = fc->s_fs_info; in erofs_fc_free() local
749 if (!sbi) in erofs_fc_free()
752 erofs_free_dev_context(sbi->devs); in erofs_fc_free()
753 kfree(sbi->fsid); in erofs_fc_free()
754 kfree(sbi->domain_id); in erofs_fc_free()
755 kfree(sbi); in erofs_fc_free()
767 struct erofs_sb_info *sbi; in erofs_init_fs_context() local
769 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); in erofs_init_fs_context()
770 if (!sbi) in erofs_init_fs_context()
773 sbi->devs = kzalloc(sizeof(struct erofs_dev_context), GFP_KERNEL); in erofs_init_fs_context()
774 if (!sbi->devs) { in erofs_init_fs_context()
775 kfree(sbi); in erofs_init_fs_context()
778 fc->s_fs_info = sbi; in erofs_init_fs_context()
780 idr_init(&sbi->devs->tree); in erofs_init_fs_context()
781 init_rwsem(&sbi->devs->rwsem); in erofs_init_fs_context()
782 erofs_default_options(sbi); in erofs_init_fs_context()
789 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_kill_sb() local
791 if (IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND) && sbi->fsid) in erofs_kill_sb()
796 erofs_free_dev_context(sbi->devs); in erofs_kill_sb()
797 fs_put_dax(sbi->dax_dev, NULL); in erofs_kill_sb()
799 kfree(sbi->fsid); in erofs_kill_sb()
800 kfree(sbi->domain_id); in erofs_kill_sb()
801 kfree(sbi); in erofs_kill_sb()
807 struct erofs_sb_info *const sbi = EROFS_SB(sb); in erofs_put_super() local
809 DBG_BUGON(!sbi); in erofs_put_super()
815 iput(sbi->managed_cache); in erofs_put_super()
816 sbi->managed_cache = NULL; in erofs_put_super()
818 iput(sbi->packed_inode); in erofs_put_super()
819 sbi->packed_inode = NULL; in erofs_put_super()
820 erofs_free_dev_context(sbi->devs); in erofs_put_super()
821 sbi->devs = NULL; in erofs_put_super()
908 struct erofs_sb_info *sbi = EROFS_SB(sb); in erofs_statfs() local
916 buf->f_blocks = sbi->total_blocks; in erofs_statfs()
920 buf->f_ffree = ULLONG_MAX - sbi->inos; in erofs_statfs()
930 struct erofs_sb_info *sbi = EROFS_SB(root->d_sb); in erofs_show_options() local
931 struct erofs_mount_opts *opt = &sbi->opt; in erofs_show_options()
958 if (sbi->fsid) in erofs_show_options()
959 seq_printf(seq, ",fsid=%s", sbi->fsid); in erofs_show_options()
960 if (sbi->domain_id) in erofs_show_options()
961 seq_printf(seq, ",domain_id=%s", sbi->domain_id); in erofs_show_options()