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
244 if (fs_info) in btrfs_printk()
246 fs_info->sb->s_id, &vaf); in btrfs_printk()
256 void __cold btrfs_warn_32bit_limit(struct btrfs_fs_info *fs_info) in btrfs_warn_32bit_limit() argument
258 if (!test_and_set_bit(BTRFS_FS_32BIT_WARN, &fs_info->flags)) { in btrfs_warn_32bit_limit()
259 btrfs_warn(fs_info, "reaching 32bit limit for logical addresses"); in btrfs_warn_32bit_limit()
260 btrfs_warn(fs_info, in btrfs_warn_32bit_limit()
263 btrfs_warn(fs_info, in btrfs_warn_32bit_limit()
268 void __cold btrfs_err_32bit_limit(struct btrfs_fs_info *fs_info) in btrfs_err_32bit_limit() argument
270 if (!test_and_set_bit(BTRFS_FS_32BIT_ERROR, &fs_info->flags)) { in btrfs_err_32bit_limit()
271 btrfs_err(fs_info, "reached 32bit limit for logical addresses"); in btrfs_err_32bit_limit()
272 btrfs_err(fs_info, in btrfs_err_32bit_limit()
275 btrfs_err(fs_info, in btrfs_err_32bit_limit()
299 struct btrfs_fs_info *fs_info = trans->fs_info; in __btrfs_abort_transaction() local
304 wake_up(&fs_info->transaction_wait); in __btrfs_abort_transaction()
305 wake_up(&fs_info->transaction_blocked_wait); in __btrfs_abort_transaction()
306 __btrfs_handle_fs_error(fs_info, function, line, errno, NULL); in __btrfs_abort_transaction()
313 void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function, in __btrfs_panic() argument
321 if (fs_info) in __btrfs_panic()
322 s_id = fs_info->sb->s_id; in __btrfs_panic()
328 if (fs_info && (btrfs_test_opt(fs_info, PANIC_ON_FATAL_ERROR))) in __btrfs_panic()
332 btrfs_crit(fs_info, "panic in %s:%d: %pV (errno=%d %s)", in __btrfs_panic()
488 static bool check_ro_option(struct btrfs_fs_info *fs_info, unsigned long opt, in check_ro_option() argument
491 if (fs_info->mount_opt & opt) { in check_ro_option()
492 btrfs_err(fs_info, "%s must be used with ro mount option", in check_ro_option()
1167 char *btrfs_get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info, in btrfs_get_subvol_name_from_objectid() argument
1170 struct btrfs_root *root = fs_info->tree_root; in btrfs_get_subvol_name_from_objectid()
1228 fs_root = btrfs_get_fs_root(fs_info, subvol_objectid, true); in btrfs_get_subvol_name_from_objectid()
1289 static int get_default_subvol_objectid(struct btrfs_fs_info *fs_info, u64 *objectid) in get_default_subvol_objectid() argument
1291 struct btrfs_root *root = fs_info->tree_root; in get_default_subvol_objectid()
1306 dir_id = btrfs_super_root_dir(fs_info->super_copy); in get_default_subvol_objectid()
1334 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_fill_super() local
1355 btrfs_err(fs_info, "super_setup_bdi failed"); in btrfs_fill_super()
1361 btrfs_err(fs_info, "open_ctree failed"); in btrfs_fill_super()
1365 inode = btrfs_iget(sb, BTRFS_FIRST_FREE_OBJECTID, fs_info->fs_root); in btrfs_fill_super()
1382 close_ctree(fs_info); in btrfs_fill_super()
1389 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_sync_fs() local
1390 struct btrfs_root *root = fs_info->tree_root; in btrfs_sync_fs()
1392 trace_btrfs_sync_fs(fs_info, wait); in btrfs_sync_fs()
1395 filemap_flush(fs_info->btree_inode->i_mapping); in btrfs_sync_fs()
1399 btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1); in btrfs_sync_fs()
1409 if (fs_info->pending_changes == 0) in btrfs_sync_fs()
1544 struct btrfs_fs_info *fs_info = btrfs_sb(s); in btrfs_test_super() local
1546 return fs_info->fs_devices == p->fs_devices; in btrfs_test_super()
1598 struct btrfs_fs_info *fs_info = btrfs_sb(s); in mount_subvol() local
1604 btrfs_err(fs_info, "'%s' is not a valid subvolume", in mount_subvol()
1614 btrfs_err(fs_info, in mount_subvol()
1645 struct btrfs_fs_info *fs_info = NULL; in btrfs_mount_root() local
1667 fs_info = kvzalloc(sizeof(struct btrfs_fs_info), GFP_KERNEL); in btrfs_mount_root()
1668 if (!fs_info) { in btrfs_mount_root()
1672 btrfs_init_fs_info(fs_info); in btrfs_mount_root()
1674 fs_info->super_copy = kzalloc(BTRFS_SUPER_INFO_SIZE, GFP_KERNEL); in btrfs_mount_root()
1675 fs_info->super_for_commit = kzalloc(BTRFS_SUPER_INFO_SIZE, GFP_KERNEL); in btrfs_mount_root()
1676 if (!fs_info->super_copy || !fs_info->super_for_commit) { in btrfs_mount_root()
1696 fs_info->fs_devices = fs_devices; in btrfs_mount_root()
1710 fs_info); in btrfs_mount_root()
1718 btrfs_free_fs_info(fs_info); in btrfs_mount_root()
1725 set_bit(BTRFS_FS_CSUM_IMPL_FAST, &fs_info->flags); in btrfs_mount_root()
1741 btrfs_free_fs_info(fs_info); in btrfs_mount_root()
1824 static void btrfs_resize_thread_pool(struct btrfs_fs_info *fs_info, in btrfs_resize_thread_pool() argument
1830 fs_info->thread_pool_size = new_pool_size; in btrfs_resize_thread_pool()
1832 btrfs_info(fs_info, "resize thread pool %d -> %d", in btrfs_resize_thread_pool()
1835 btrfs_workqueue_set_max(fs_info->workers, new_pool_size); in btrfs_resize_thread_pool()
1836 btrfs_workqueue_set_max(fs_info->delalloc_workers, new_pool_size); in btrfs_resize_thread_pool()
1837 btrfs_workqueue_set_max(fs_info->caching_workers, new_pool_size); in btrfs_resize_thread_pool()
1838 btrfs_workqueue_set_max(fs_info->endio_workers, new_pool_size); in btrfs_resize_thread_pool()
1839 btrfs_workqueue_set_max(fs_info->endio_meta_workers, new_pool_size); in btrfs_resize_thread_pool()
1840 btrfs_workqueue_set_max(fs_info->endio_meta_write_workers, in btrfs_resize_thread_pool()
1842 btrfs_workqueue_set_max(fs_info->endio_write_workers, new_pool_size); in btrfs_resize_thread_pool()
1843 btrfs_workqueue_set_max(fs_info->endio_freespace_worker, new_pool_size); in btrfs_resize_thread_pool()
1844 btrfs_workqueue_set_max(fs_info->delayed_workers, new_pool_size); in btrfs_resize_thread_pool()
1845 btrfs_workqueue_set_max(fs_info->readahead_workers, new_pool_size); in btrfs_resize_thread_pool()
1846 btrfs_workqueue_set_max(fs_info->scrub_wr_completion_workers, in btrfs_resize_thread_pool()
1850 static inline void btrfs_remount_begin(struct btrfs_fs_info *fs_info, in btrfs_remount_begin() argument
1854 (!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) || in btrfs_remount_begin()
1857 wait_event(fs_info->transaction_wait, in btrfs_remount_begin()
1858 (atomic_read(&fs_info->defrag_running) == 0)); in btrfs_remount_begin()
1860 sync_filesystem(fs_info->sb); in btrfs_remount_begin()
1864 static inline void btrfs_remount_cleanup(struct btrfs_fs_info *fs_info, in btrfs_remount_cleanup() argument
1867 const bool cache_opt = btrfs_test_opt(fs_info, SPACE_CACHE); in btrfs_remount_cleanup()
1874 (!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) || sb_rdonly(fs_info->sb))) { in btrfs_remount_cleanup()
1875 btrfs_cleanup_defrag_inodes(fs_info); in btrfs_remount_cleanup()
1880 btrfs_test_opt(fs_info, DISCARD_ASYNC)) in btrfs_remount_cleanup()
1881 btrfs_discard_resume(fs_info); in btrfs_remount_cleanup()
1883 !btrfs_test_opt(fs_info, DISCARD_ASYNC)) in btrfs_remount_cleanup()
1884 btrfs_discard_cleanup(fs_info); in btrfs_remount_cleanup()
1887 if (cache_opt != btrfs_free_space_cache_v1_active(fs_info)) in btrfs_remount_cleanup()
1888 btrfs_set_free_space_cache_v1_active(fs_info, cache_opt); in btrfs_remount_cleanup()
1893 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_remount() local
1895 unsigned long old_opts = fs_info->mount_opt; in btrfs_remount()
1896 unsigned long old_compress_type = fs_info->compress_type; in btrfs_remount()
1897 u64 old_max_inline = fs_info->max_inline; in btrfs_remount()
1898 u32 old_thread_pool_size = fs_info->thread_pool_size; in btrfs_remount()
1899 u32 old_metadata_ratio = fs_info->metadata_ratio; in btrfs_remount()
1903 set_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state); in btrfs_remount()
1916 ret = btrfs_parse_options(fs_info, data, *flags); in btrfs_remount()
1920 btrfs_remount_begin(fs_info, old_opts, *flags); in btrfs_remount()
1921 btrfs_resize_thread_pool(fs_info, in btrfs_remount()
1922 fs_info->thread_pool_size, old_thread_pool_size); in btrfs_remount()
1924 if ((bool)btrfs_test_opt(fs_info, FREE_SPACE_TREE) != in btrfs_remount()
1925 (bool)btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE) && in btrfs_remount()
1927 btrfs_warn(fs_info, in btrfs_remount()
1930 if (btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE)) { in btrfs_remount()
1931 btrfs_set_opt(fs_info->mount_opt, FREE_SPACE_TREE); in btrfs_remount()
1932 btrfs_clear_opt(fs_info->mount_opt, SPACE_CACHE); in btrfs_remount()
1934 if (btrfs_free_space_cache_v1_active(fs_info)) { in btrfs_remount()
1935 btrfs_clear_opt(fs_info->mount_opt, FREE_SPACE_TREE); in btrfs_remount()
1936 btrfs_set_opt(fs_info->mount_opt, SPACE_CACHE); in btrfs_remount()
1948 cancel_work_sync(&fs_info->async_reclaim_work); in btrfs_remount()
1949 cancel_work_sync(&fs_info->async_data_reclaim_work); in btrfs_remount()
1951 btrfs_discard_cleanup(fs_info); in btrfs_remount()
1954 down(&fs_info->uuid_tree_rescan_sem); in btrfs_remount()
1956 up(&fs_info->uuid_tree_rescan_sem); in btrfs_remount()
1967 btrfs_delete_unused_bgs(fs_info); in btrfs_remount()
1980 wait_on_bit(&fs_info->flags, BTRFS_FS_CLEANER_RUNNING, in btrfs_remount()
1991 btrfs_run_delayed_iputs(fs_info); in btrfs_remount()
1993 btrfs_dev_replace_suspend_for_unmount(fs_info); in btrfs_remount()
1994 btrfs_scrub_cancel(fs_info); in btrfs_remount()
1995 btrfs_pause_balance(fs_info); in btrfs_remount()
2003 btrfs_qgroup_wait_for_completion(fs_info, false); in btrfs_remount()
2005 ret = btrfs_commit_super(fs_info); in btrfs_remount()
2009 if (BTRFS_FS_ERROR(fs_info)) { in btrfs_remount()
2010 btrfs_err(fs_info, in btrfs_remount()
2015 if (fs_info->fs_devices->rw_devices == 0) { in btrfs_remount()
2020 if (!btrfs_check_rw_degradable(fs_info, NULL)) { in btrfs_remount()
2021 btrfs_warn(fs_info, in btrfs_remount()
2027 if (btrfs_super_log_root(fs_info->super_copy) != 0) { in btrfs_remount()
2028 btrfs_warn(fs_info, in btrfs_remount()
2039 ret = btrfs_start_pre_rw_mount(fs_info); in btrfs_remount()
2045 set_bit(BTRFS_FS_OPEN, &fs_info->flags); in btrfs_remount()
2054 wake_up_process(fs_info->transaction_kthread); in btrfs_remount()
2055 btrfs_remount_cleanup(fs_info, old_opts); in btrfs_remount()
2056 btrfs_clear_oneshot_options(fs_info); in btrfs_remount()
2057 clear_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state); in btrfs_remount()
2066 clear_bit(BTRFS_FS_STATE_RO, &fs_info->fs_state); in btrfs_remount()
2068 fs_info->mount_opt = old_opts; in btrfs_remount()
2069 fs_info->compress_type = old_compress_type; in btrfs_remount()
2070 fs_info->max_inline = old_max_inline; in btrfs_remount()
2071 btrfs_resize_thread_pool(fs_info, in btrfs_remount()
2072 old_thread_pool_size, fs_info->thread_pool_size); in btrfs_remount()
2073 fs_info->metadata_ratio = old_metadata_ratio; in btrfs_remount()
2074 btrfs_remount_cleanup(fs_info, old_opts); in btrfs_remount()
2075 clear_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state); in btrfs_remount()
2109 static inline int btrfs_calc_avail_data_space(struct btrfs_fs_info *fs_info, in btrfs_calc_avail_data_space() argument
2113 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; in btrfs_calc_avail_data_space()
2126 nr_devices = fs_info->fs_devices->open_devices; in btrfs_calc_avail_data_space()
2129 nr_devices = fs_info->fs_devices->open_devices; in btrfs_calc_avail_data_space()
2143 type = btrfs_data_alloc_profile(fs_info); in btrfs_calc_avail_data_space()
2238 struct btrfs_fs_info *fs_info = btrfs_sb(dentry->d_sb); in btrfs_statfs() local
2239 struct btrfs_super_block *disk_super = fs_info->super_copy; in btrfs_statfs()
2244 u32 bits = fs_info->sectorsize_bits; in btrfs_statfs()
2245 __be32 *fsid = (__be32 *)fs_info->fs_devices->fsid; in btrfs_statfs()
2247 struct btrfs_block_rsv *block_rsv = &fs_info->global_block_rsv; in btrfs_statfs()
2252 list_for_each_entry(found, &fs_info->space_info, list) { in btrfs_statfs()
2295 ret = btrfs_calc_avail_data_space(fs_info, &total_free_data); in btrfs_statfs()
2347 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_kill_super() local
2349 btrfs_free_fs_info(fs_info); in btrfs_kill_super()
2435 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_freeze() local
2436 struct btrfs_root *root = fs_info->tree_root; in btrfs_freeze()
2438 set_bit(BTRFS_FS_FROZEN, &fs_info->flags); in btrfs_freeze()
2457 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_unfreeze() local
2459 clear_bit(BTRFS_FS_FROZEN, &fs_info->flags); in btrfs_unfreeze()
2465 struct btrfs_fs_info *fs_info = btrfs_sb(root->d_sb); in btrfs_show_devname() local
2473 seq_escape(m, rcu_str_deref(fs_info->fs_devices->latest_dev->name), " \t\n\\"); in btrfs_show_devname()