Lines Matching refs:fs_info
99 void __btrfs_handle_fs_error(struct btrfs_fs_info *fs_info, const char *function, in __btrfs_handle_fs_error() argument
102 struct super_block *sb = fs_info->sb; in __btrfs_handle_fs_error()
137 set_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state); in __btrfs_handle_fs_error()
148 btrfs_info(fs_info, "forced readonly"); in __btrfs_handle_fs_error()
187 void btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...) in btrfs_printk() argument
215 fs_info ? fs_info->sb->s_id : "<unknown>", &vaf); in btrfs_printk()
239 struct btrfs_fs_info *fs_info = trans->fs_info; in __btrfs_abort_transaction() local
248 btrfs_warn(fs_info, in __btrfs_abort_transaction()
255 wake_up(&fs_info->transaction_wait); in __btrfs_abort_transaction()
256 wake_up(&fs_info->transaction_blocked_wait); in __btrfs_abort_transaction()
257 __btrfs_handle_fs_error(fs_info, function, line, errno, NULL); in __btrfs_abort_transaction()
264 void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function, in __btrfs_panic() argument
272 if (fs_info) in __btrfs_panic()
273 s_id = fs_info->sb->s_id; in __btrfs_panic()
279 if (fs_info && (btrfs_test_opt(fs_info, PANIC_ON_FATAL_ERROR))) in __btrfs_panic()
283 btrfs_crit(fs_info, "panic in %s:%d: %pV (errno=%d %s)", in __btrfs_panic()
999 static char *get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info, in get_subvol_name_from_objectid() argument
1002 struct btrfs_root *root = fs_info->tree_root; in get_subvol_name_from_objectid()
1071 fs_root = btrfs_read_fs_root_no_name(fs_info, &key); in get_subvol_name_from_objectid()
1135 static int get_default_subvol_objectid(struct btrfs_fs_info *fs_info, u64 *objectid) in get_default_subvol_objectid() argument
1137 struct btrfs_root *root = fs_info->tree_root; in get_default_subvol_objectid()
1153 dir_id = btrfs_super_root_dir(fs_info->super_copy); in get_default_subvol_objectid()
1181 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_fill_super() local
1200 btrfs_err(fs_info, "super_setup_bdi failed"); in btrfs_fill_super()
1206 btrfs_err(fs_info, "open_ctree failed"); in btrfs_fill_super()
1213 inode = btrfs_iget(sb, &key, fs_info->fs_root, NULL); in btrfs_fill_super()
1230 close_ctree(fs_info); in btrfs_fill_super()
1237 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_sync_fs() local
1238 struct btrfs_root *root = fs_info->tree_root; in btrfs_sync_fs()
1240 trace_btrfs_sync_fs(fs_info, wait); in btrfs_sync_fs()
1243 filemap_flush(fs_info->btree_inode->i_mapping); in btrfs_sync_fs()
1247 btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1); in btrfs_sync_fs()
1257 if (fs_info->pending_changes == 0) in btrfs_sync_fs()
1373 struct btrfs_fs_info *fs_info = btrfs_sb(s); in btrfs_test_super() local
1375 return fs_info->fs_devices == p->fs_devices; in btrfs_test_super()
1427 struct btrfs_fs_info *fs_info = btrfs_sb(s); in mount_subvol() local
1433 btrfs_err(fs_info, "'%s' is not a valid subvolume", in mount_subvol()
1443 btrfs_err(fs_info, in mount_subvol()
1480 static int setup_security_options(struct btrfs_fs_info *fs_info, in setup_security_options() argument
1495 if (!fs_info->security_opts.num_mnt_opts) { in setup_security_options()
1497 memcpy(&fs_info->security_opts, sec_opts, sizeof(*sec_opts)); in setup_security_options()
1524 struct btrfs_fs_info *fs_info = NULL; in btrfs_mount_root() local
1545 fs_info = kvzalloc(sizeof(struct btrfs_fs_info), GFP_KERNEL); in btrfs_mount_root()
1546 if (!fs_info) { in btrfs_mount_root()
1551 fs_info->super_copy = kzalloc(BTRFS_SUPER_INFO_SIZE, GFP_KERNEL); in btrfs_mount_root()
1552 fs_info->super_for_commit = kzalloc(BTRFS_SUPER_INFO_SIZE, GFP_KERNEL); in btrfs_mount_root()
1553 security_init_mnt_opts(&fs_info->security_opts); in btrfs_mount_root()
1554 if (!fs_info->super_copy || !fs_info->super_for_commit) { in btrfs_mount_root()
1574 fs_info->fs_devices = fs_devices; in btrfs_mount_root()
1588 fs_info); in btrfs_mount_root()
1596 free_fs_info(fs_info); in btrfs_mount_root()
1609 fs_info = btrfs_sb(s); in btrfs_mount_root()
1610 error = setup_security_options(fs_info, s, &new_sec_opts); in btrfs_mount_root()
1621 free_fs_info(fs_info); in btrfs_mount_root()
1705 static void btrfs_resize_thread_pool(struct btrfs_fs_info *fs_info, in btrfs_resize_thread_pool() argument
1711 fs_info->thread_pool_size = new_pool_size; in btrfs_resize_thread_pool()
1713 btrfs_info(fs_info, "resize thread pool %d -> %d", in btrfs_resize_thread_pool()
1716 btrfs_workqueue_set_max(fs_info->workers, new_pool_size); in btrfs_resize_thread_pool()
1717 btrfs_workqueue_set_max(fs_info->delalloc_workers, new_pool_size); in btrfs_resize_thread_pool()
1718 btrfs_workqueue_set_max(fs_info->submit_workers, new_pool_size); in btrfs_resize_thread_pool()
1719 btrfs_workqueue_set_max(fs_info->caching_workers, new_pool_size); in btrfs_resize_thread_pool()
1720 btrfs_workqueue_set_max(fs_info->endio_workers, new_pool_size); in btrfs_resize_thread_pool()
1721 btrfs_workqueue_set_max(fs_info->endio_meta_workers, new_pool_size); in btrfs_resize_thread_pool()
1722 btrfs_workqueue_set_max(fs_info->endio_meta_write_workers, in btrfs_resize_thread_pool()
1724 btrfs_workqueue_set_max(fs_info->endio_write_workers, new_pool_size); in btrfs_resize_thread_pool()
1725 btrfs_workqueue_set_max(fs_info->endio_freespace_worker, new_pool_size); in btrfs_resize_thread_pool()
1726 btrfs_workqueue_set_max(fs_info->delayed_workers, new_pool_size); in btrfs_resize_thread_pool()
1727 btrfs_workqueue_set_max(fs_info->readahead_workers, new_pool_size); in btrfs_resize_thread_pool()
1728 btrfs_workqueue_set_max(fs_info->scrub_wr_completion_workers, in btrfs_resize_thread_pool()
1732 static inline void btrfs_remount_prepare(struct btrfs_fs_info *fs_info) in btrfs_remount_prepare() argument
1734 set_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state); in btrfs_remount_prepare()
1737 static inline void btrfs_remount_begin(struct btrfs_fs_info *fs_info, in btrfs_remount_begin() argument
1741 (!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) || in btrfs_remount_begin()
1744 wait_event(fs_info->transaction_wait, in btrfs_remount_begin()
1745 (atomic_read(&fs_info->defrag_running) == 0)); in btrfs_remount_begin()
1747 sync_filesystem(fs_info->sb); in btrfs_remount_begin()
1751 static inline void btrfs_remount_cleanup(struct btrfs_fs_info *fs_info, in btrfs_remount_cleanup() argument
1759 (!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) || sb_rdonly(fs_info->sb))) { in btrfs_remount_cleanup()
1760 btrfs_cleanup_defrag_inodes(fs_info); in btrfs_remount_cleanup()
1763 clear_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state); in btrfs_remount_cleanup()
1768 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_remount() local
1769 struct btrfs_root *root = fs_info->tree_root; in btrfs_remount()
1771 unsigned long old_opts = fs_info->mount_opt; in btrfs_remount()
1772 unsigned long old_compress_type = fs_info->compress_type; in btrfs_remount()
1773 u64 old_max_inline = fs_info->max_inline; in btrfs_remount()
1774 u32 old_thread_pool_size = fs_info->thread_pool_size; in btrfs_remount()
1775 u32 old_metadata_ratio = fs_info->metadata_ratio; in btrfs_remount()
1779 btrfs_remount_prepare(fs_info); in btrfs_remount()
1788 ret = setup_security_options(fs_info, sb, in btrfs_remount()
1796 ret = btrfs_parse_options(fs_info, data, *flags); in btrfs_remount()
1800 btrfs_remount_begin(fs_info, old_opts, *flags); in btrfs_remount()
1801 btrfs_resize_thread_pool(fs_info, in btrfs_remount()
1802 fs_info->thread_pool_size, old_thread_pool_size); in btrfs_remount()
1812 cancel_work_sync(&fs_info->async_reclaim_work); in btrfs_remount()
1815 down(&fs_info->uuid_tree_rescan_sem); in btrfs_remount()
1817 up(&fs_info->uuid_tree_rescan_sem); in btrfs_remount()
1828 btrfs_delete_unused_bgs(fs_info); in btrfs_remount()
1830 btrfs_dev_replace_suspend_for_unmount(fs_info); in btrfs_remount()
1831 btrfs_scrub_cancel(fs_info); in btrfs_remount()
1832 btrfs_pause_balance(fs_info); in btrfs_remount()
1834 ret = btrfs_commit_super(fs_info); in btrfs_remount()
1838 if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) { in btrfs_remount()
1839 btrfs_err(fs_info, in btrfs_remount()
1844 if (fs_info->fs_devices->rw_devices == 0) { in btrfs_remount()
1849 if (!btrfs_check_rw_degradable(fs_info, NULL)) { in btrfs_remount()
1850 btrfs_warn(fs_info, in btrfs_remount()
1856 if (btrfs_super_log_root(fs_info->super_copy) != 0) { in btrfs_remount()
1861 ret = btrfs_cleanup_fs_roots(fs_info); in btrfs_remount()
1866 mutex_lock(&fs_info->cleaner_mutex); in btrfs_remount()
1868 mutex_unlock(&fs_info->cleaner_mutex); in btrfs_remount()
1872 ret = btrfs_resume_balance_async(fs_info); in btrfs_remount()
1876 ret = btrfs_resume_dev_replace_async(fs_info); in btrfs_remount()
1878 btrfs_warn(fs_info, "failed to resume dev_replace"); in btrfs_remount()
1882 btrfs_qgroup_rescan_resume(fs_info); in btrfs_remount()
1884 if (!fs_info->uuid_root) { in btrfs_remount()
1885 btrfs_info(fs_info, "creating UUID tree"); in btrfs_remount()
1886 ret = btrfs_create_uuid_tree(fs_info); in btrfs_remount()
1888 btrfs_warn(fs_info, in btrfs_remount()
1896 set_bit(BTRFS_FS_OPEN, &fs_info->flags); in btrfs_remount()
1899 wake_up_process(fs_info->transaction_kthread); in btrfs_remount()
1900 btrfs_remount_cleanup(fs_info, old_opts); in btrfs_remount()
1908 fs_info->mount_opt = old_opts; in btrfs_remount()
1909 fs_info->compress_type = old_compress_type; in btrfs_remount()
1910 fs_info->max_inline = old_max_inline; in btrfs_remount()
1911 btrfs_resize_thread_pool(fs_info, in btrfs_remount()
1912 old_thread_pool_size, fs_info->thread_pool_size); in btrfs_remount()
1913 fs_info->metadata_ratio = old_metadata_ratio; in btrfs_remount()
1914 btrfs_remount_cleanup(fs_info, old_opts); in btrfs_remount()
1948 static int btrfs_calc_avail_data_space(struct btrfs_fs_info *fs_info, in btrfs_calc_avail_data_space() argument
1952 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; in btrfs_calc_avail_data_space()
1965 nr_devices = fs_info->fs_devices->open_devices; in btrfs_calc_avail_data_space()
1968 nr_devices = fs_info->fs_devices->open_devices; in btrfs_calc_avail_data_space()
1982 type = btrfs_data_alloc_profile(fs_info); in btrfs_calc_avail_data_space()
2085 struct btrfs_fs_info *fs_info = btrfs_sb(dentry->d_sb); in btrfs_statfs() local
2086 struct btrfs_super_block *disk_super = fs_info->super_copy; in btrfs_statfs()
2087 struct list_head *head = &fs_info->space_info; in btrfs_statfs()
2093 __be32 *fsid = (__be32 *)fs_info->fsid; in btrfs_statfs()
2095 struct btrfs_block_rsv *block_rsv = &fs_info->global_block_rsv; in btrfs_statfs()
2146 ret = btrfs_calc_avail_data_space(fs_info, &total_free_data); in btrfs_statfs()
2188 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_kill_super() local
2190 free_fs_info(fs_info); in btrfs_kill_super()
2272 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_freeze() local
2273 struct btrfs_root *root = fs_info->tree_root; in btrfs_freeze()
2275 set_bit(BTRFS_FS_FROZEN, &fs_info->flags); in btrfs_freeze()
2294 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_unfreeze() local
2296 clear_bit(BTRFS_FS_FROZEN, &fs_info->flags); in btrfs_unfreeze()
2302 struct btrfs_fs_info *fs_info = btrfs_sb(root->d_sb); in btrfs_show_devname() local
2315 cur_devices = fs_info->fs_devices; in btrfs_show_devname()