Lines Matching refs:fs_info

127 void __btrfs_handle_fs_error(struct btrfs_fs_info *fs_info, const char *function,  in __btrfs_handle_fs_error()  argument
130 struct super_block *sb = fs_info->sb; in __btrfs_handle_fs_error()
165 set_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state); in __btrfs_handle_fs_error()
174 btrfs_discard_stop(fs_info); in __btrfs_handle_fs_error()
178 btrfs_info(fs_info, "forced readonly"); in __btrfs_handle_fs_error()
217 void __cold btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...) in btrfs_printk() argument
245 fs_info ? fs_info->sb->s_id : "<unknown>", &vaf); in btrfs_printk()
269 struct btrfs_fs_info *fs_info = trans->fs_info; in __btrfs_abort_transaction() local
278 btrfs_warn(fs_info, in __btrfs_abort_transaction()
285 wake_up(&fs_info->transaction_wait); in __btrfs_abort_transaction()
286 wake_up(&fs_info->transaction_blocked_wait); in __btrfs_abort_transaction()
287 __btrfs_handle_fs_error(fs_info, function, line, errno, NULL); in __btrfs_abort_transaction()
294 void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function, in __btrfs_panic() argument
302 if (fs_info) in __btrfs_panic()
303 s_id = fs_info->sb->s_id; in __btrfs_panic()
309 if (fs_info && (btrfs_test_opt(fs_info, PANIC_ON_FATAL_ERROR))) in __btrfs_panic()
313 btrfs_crit(fs_info, "panic in %s:%d: %pV (errno=%d %s)", in __btrfs_panic()
1136 char *btrfs_get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info, in btrfs_get_subvol_name_from_objectid() argument
1139 struct btrfs_root *root = fs_info->tree_root; in btrfs_get_subvol_name_from_objectid()
1205 fs_root = btrfs_get_fs_root(fs_info, subvol_objectid, true); in btrfs_get_subvol_name_from_objectid()
1273 static int get_default_subvol_objectid(struct btrfs_fs_info *fs_info, u64 *objectid) in get_default_subvol_objectid() argument
1275 struct btrfs_root *root = fs_info->tree_root; in get_default_subvol_objectid()
1291 dir_id = btrfs_super_root_dir(fs_info->super_copy); in get_default_subvol_objectid()
1319 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_fill_super() local
1337 btrfs_err(fs_info, "super_setup_bdi failed"); in btrfs_fill_super()
1343 btrfs_err(fs_info, "open_ctree failed"); in btrfs_fill_super()
1347 inode = btrfs_iget(sb, BTRFS_FIRST_FREE_OBJECTID, fs_info->fs_root); in btrfs_fill_super()
1364 close_ctree(fs_info); in btrfs_fill_super()
1371 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_sync_fs() local
1372 struct btrfs_root *root = fs_info->tree_root; in btrfs_sync_fs()
1374 trace_btrfs_sync_fs(fs_info, wait); in btrfs_sync_fs()
1377 filemap_flush(fs_info->btree_inode->i_mapping); in btrfs_sync_fs()
1381 btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1); in btrfs_sync_fs()
1391 if (fs_info->pending_changes == 0) in btrfs_sync_fs()
1515 struct btrfs_fs_info *fs_info = btrfs_sb(s); in btrfs_test_super() local
1517 return fs_info->fs_devices == p->fs_devices; in btrfs_test_super()
1569 struct btrfs_fs_info *fs_info = btrfs_sb(s); in mount_subvol() local
1575 btrfs_err(fs_info, "'%s' is not a valid subvolume", in mount_subvol()
1585 btrfs_err(fs_info, in mount_subvol()
1616 struct btrfs_fs_info *fs_info = NULL; in btrfs_mount_root() local
1638 fs_info = kvzalloc(sizeof(struct btrfs_fs_info), GFP_KERNEL); in btrfs_mount_root()
1639 if (!fs_info) { in btrfs_mount_root()
1643 btrfs_init_fs_info(fs_info); in btrfs_mount_root()
1645 fs_info->super_copy = kzalloc(BTRFS_SUPER_INFO_SIZE, GFP_KERNEL); in btrfs_mount_root()
1646 fs_info->super_for_commit = kzalloc(BTRFS_SUPER_INFO_SIZE, GFP_KERNEL); in btrfs_mount_root()
1647 if (!fs_info->super_copy || !fs_info->super_for_commit) { in btrfs_mount_root()
1667 fs_info->fs_devices = fs_devices; in btrfs_mount_root()
1681 fs_info); in btrfs_mount_root()
1689 btrfs_free_fs_info(fs_info); in btrfs_mount_root()
1696 set_bit(BTRFS_FS_CSUM_IMPL_FAST, &fs_info->flags); in btrfs_mount_root()
1712 btrfs_free_fs_info(fs_info); in btrfs_mount_root()
1795 static void btrfs_resize_thread_pool(struct btrfs_fs_info *fs_info, in btrfs_resize_thread_pool() argument
1801 fs_info->thread_pool_size = new_pool_size; in btrfs_resize_thread_pool()
1803 btrfs_info(fs_info, "resize thread pool %d -> %d", in btrfs_resize_thread_pool()
1806 btrfs_workqueue_set_max(fs_info->workers, new_pool_size); in btrfs_resize_thread_pool()
1807 btrfs_workqueue_set_max(fs_info->delalloc_workers, new_pool_size); in btrfs_resize_thread_pool()
1808 btrfs_workqueue_set_max(fs_info->caching_workers, new_pool_size); in btrfs_resize_thread_pool()
1809 btrfs_workqueue_set_max(fs_info->endio_workers, new_pool_size); in btrfs_resize_thread_pool()
1810 btrfs_workqueue_set_max(fs_info->endio_meta_workers, new_pool_size); in btrfs_resize_thread_pool()
1811 btrfs_workqueue_set_max(fs_info->endio_meta_write_workers, in btrfs_resize_thread_pool()
1813 btrfs_workqueue_set_max(fs_info->endio_write_workers, new_pool_size); in btrfs_resize_thread_pool()
1814 btrfs_workqueue_set_max(fs_info->endio_freespace_worker, new_pool_size); in btrfs_resize_thread_pool()
1815 btrfs_workqueue_set_max(fs_info->delayed_workers, new_pool_size); in btrfs_resize_thread_pool()
1816 btrfs_workqueue_set_max(fs_info->readahead_workers, new_pool_size); in btrfs_resize_thread_pool()
1817 btrfs_workqueue_set_max(fs_info->scrub_wr_completion_workers, in btrfs_resize_thread_pool()
1821 static inline void btrfs_remount_begin(struct btrfs_fs_info *fs_info, in btrfs_remount_begin() argument
1825 (!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) || in btrfs_remount_begin()
1828 wait_event(fs_info->transaction_wait, in btrfs_remount_begin()
1829 (atomic_read(&fs_info->defrag_running) == 0)); in btrfs_remount_begin()
1831 sync_filesystem(fs_info->sb); in btrfs_remount_begin()
1835 static inline void btrfs_remount_cleanup(struct btrfs_fs_info *fs_info, in btrfs_remount_cleanup() argument
1843 (!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) || sb_rdonly(fs_info->sb))) { in btrfs_remount_cleanup()
1844 btrfs_cleanup_defrag_inodes(fs_info); in btrfs_remount_cleanup()
1849 btrfs_test_opt(fs_info, DISCARD_ASYNC)) in btrfs_remount_cleanup()
1850 btrfs_discard_resume(fs_info); in btrfs_remount_cleanup()
1852 !btrfs_test_opt(fs_info, DISCARD_ASYNC)) in btrfs_remount_cleanup()
1853 btrfs_discard_cleanup(fs_info); in btrfs_remount_cleanup()
1858 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_remount() local
1859 struct btrfs_root *root = fs_info->tree_root; in btrfs_remount()
1861 unsigned long old_opts = fs_info->mount_opt; in btrfs_remount()
1862 unsigned long old_compress_type = fs_info->compress_type; in btrfs_remount()
1863 u64 old_max_inline = fs_info->max_inline; in btrfs_remount()
1864 u32 old_thread_pool_size = fs_info->thread_pool_size; in btrfs_remount()
1865 u32 old_metadata_ratio = fs_info->metadata_ratio; in btrfs_remount()
1869 set_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state); in btrfs_remount()
1882 ret = btrfs_parse_options(fs_info, data, *flags); in btrfs_remount()
1886 btrfs_remount_begin(fs_info, old_opts, *flags); in btrfs_remount()
1887 btrfs_resize_thread_pool(fs_info, in btrfs_remount()
1888 fs_info->thread_pool_size, old_thread_pool_size); in btrfs_remount()
1898 cancel_work_sync(&fs_info->async_reclaim_work); in btrfs_remount()
1899 cancel_work_sync(&fs_info->async_data_reclaim_work); in btrfs_remount()
1901 btrfs_discard_cleanup(fs_info); in btrfs_remount()
1904 down(&fs_info->uuid_tree_rescan_sem); in btrfs_remount()
1906 up(&fs_info->uuid_tree_rescan_sem); in btrfs_remount()
1917 btrfs_delete_unused_bgs(fs_info); in btrfs_remount()
1919 btrfs_dev_replace_suspend_for_unmount(fs_info); in btrfs_remount()
1920 btrfs_scrub_cancel(fs_info); in btrfs_remount()
1921 btrfs_pause_balance(fs_info); in btrfs_remount()
1929 btrfs_qgroup_wait_for_completion(fs_info, false); in btrfs_remount()
1931 ret = btrfs_commit_super(fs_info); in btrfs_remount()
1935 if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) { in btrfs_remount()
1936 btrfs_err(fs_info, in btrfs_remount()
1941 if (fs_info->fs_devices->rw_devices == 0) { in btrfs_remount()
1946 if (!btrfs_check_rw_degradable(fs_info, NULL)) { in btrfs_remount()
1947 btrfs_warn(fs_info, in btrfs_remount()
1953 if (btrfs_super_log_root(fs_info->super_copy) != 0) { in btrfs_remount()
1954 btrfs_warn(fs_info, in btrfs_remount()
1960 ret = btrfs_cleanup_fs_roots(fs_info); in btrfs_remount()
1965 mutex_lock(&fs_info->cleaner_mutex); in btrfs_remount()
1967 mutex_unlock(&fs_info->cleaner_mutex); in btrfs_remount()
1971 ret = btrfs_resume_balance_async(fs_info); in btrfs_remount()
1975 ret = btrfs_resume_dev_replace_async(fs_info); in btrfs_remount()
1977 btrfs_warn(fs_info, "failed to resume dev_replace"); in btrfs_remount()
1981 btrfs_qgroup_rescan_resume(fs_info); in btrfs_remount()
1983 if (!fs_info->uuid_root) { in btrfs_remount()
1984 btrfs_info(fs_info, "creating UUID tree"); in btrfs_remount()
1985 ret = btrfs_create_uuid_tree(fs_info); in btrfs_remount()
1987 btrfs_warn(fs_info, in btrfs_remount()
1995 set_bit(BTRFS_FS_OPEN, &fs_info->flags); in btrfs_remount()
2004 wake_up_process(fs_info->transaction_kthread); in btrfs_remount()
2005 btrfs_remount_cleanup(fs_info, old_opts); in btrfs_remount()
2006 clear_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state); in btrfs_remount()
2015 fs_info->mount_opt = old_opts; in btrfs_remount()
2016 fs_info->compress_type = old_compress_type; in btrfs_remount()
2017 fs_info->max_inline = old_max_inline; in btrfs_remount()
2018 btrfs_resize_thread_pool(fs_info, in btrfs_remount()
2019 old_thread_pool_size, fs_info->thread_pool_size); in btrfs_remount()
2020 fs_info->metadata_ratio = old_metadata_ratio; in btrfs_remount()
2021 btrfs_remount_cleanup(fs_info, old_opts); in btrfs_remount()
2022 clear_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state); in btrfs_remount()
2057 static inline int btrfs_calc_avail_data_space(struct btrfs_fs_info *fs_info, in btrfs_calc_avail_data_space() argument
2061 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; in btrfs_calc_avail_data_space()
2074 nr_devices = fs_info->fs_devices->open_devices; in btrfs_calc_avail_data_space()
2077 nr_devices = fs_info->fs_devices->open_devices; in btrfs_calc_avail_data_space()
2091 type = btrfs_data_alloc_profile(fs_info); in btrfs_calc_avail_data_space()
2186 struct btrfs_fs_info *fs_info = btrfs_sb(dentry->d_sb); in btrfs_statfs() local
2187 struct btrfs_super_block *disk_super = fs_info->super_copy; in btrfs_statfs()
2193 __be32 *fsid = (__be32 *)fs_info->fs_devices->fsid; in btrfs_statfs()
2195 struct btrfs_block_rsv *block_rsv = &fs_info->global_block_rsv; in btrfs_statfs()
2200 list_for_each_entry(found, &fs_info->space_info, list) { in btrfs_statfs()
2243 ret = btrfs_calc_avail_data_space(fs_info, &total_free_data); in btrfs_statfs()
2295 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_kill_super() local
2297 btrfs_free_fs_info(fs_info); in btrfs_kill_super()
2383 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_freeze() local
2384 struct btrfs_root *root = fs_info->tree_root; in btrfs_freeze()
2386 set_bit(BTRFS_FS_FROZEN, &fs_info->flags); in btrfs_freeze()
2405 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_unfreeze() local
2407 clear_bit(BTRFS_FS_FROZEN, &fs_info->flags); in btrfs_unfreeze()
2413 struct btrfs_fs_info *fs_info = btrfs_sb(root->d_sb); in btrfs_show_devname() local
2424 list_for_each_entry_rcu(dev, &fs_info->fs_devices->devices, dev_list) { in btrfs_show_devname()