Lines Matching refs:fs_info

100 static void save_error_info(struct btrfs_fs_info *fs_info)  in save_error_info()  argument
106 set_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state); in save_error_info()
110 static void btrfs_handle_error(struct btrfs_fs_info *fs_info) in btrfs_handle_error() argument
112 struct super_block *sb = fs_info->sb; in btrfs_handle_error()
117 if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) { in btrfs_handle_error()
119 btrfs_info(fs_info, "forced readonly"); in btrfs_handle_error()
138 void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function, in __btrfs_std_error() argument
141 struct super_block *sb = fs_info->sb; in __btrfs_std_error()
170 save_error_info(fs_info); in __btrfs_std_error()
172 btrfs_handle_error(fs_info); in __btrfs_std_error()
186 void btrfs_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...) in btrfs_printk() argument
188 struct super_block *sb = fs_info->sb; in btrfs_printk()
217 void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function, in __btrfs_std_error() argument
220 struct super_block *sb = fs_info->sb; in __btrfs_std_error()
231 save_error_info(fs_info); in __btrfs_std_error()
232 btrfs_handle_error(fs_info); in __btrfs_std_error()
258 &root->fs_info->fs_state)) { in __btrfs_abort_transaction()
269 btrfs_warn(root->fs_info, in __btrfs_abort_transaction()
276 wake_up(&root->fs_info->transaction_wait); in __btrfs_abort_transaction()
277 wake_up(&root->fs_info->transaction_blocked_wait); in __btrfs_abort_transaction()
278 __btrfs_std_error(root->fs_info, function, line, errno, NULL); in __btrfs_abort_transaction()
284 void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function, in __btrfs_panic() argument
292 if (fs_info) in __btrfs_panic()
293 s_id = fs_info->sb->s_id; in __btrfs_panic()
299 if (fs_info && (fs_info->mount_opt & BTRFS_MOUNT_PANIC_ON_FATAL_ERROR)) in __btrfs_panic()
303 btrfs_crit(fs_info, "panic in %s:%d: %pV (errno=%d %s)", in __btrfs_panic()
390 struct btrfs_fs_info *info = root->fs_info; in btrfs_parse_options()
399 cache_gen = btrfs_super_cache_generation(root->fs_info->super_copy); in btrfs_parse_options()
424 btrfs_info(root->fs_info, "allowing degraded mounts"); in btrfs_parse_options()
443 btrfs_info(root->fs_info, "setting datasum, datacow enabled"); in btrfs_parse_options()
445 btrfs_info(root->fs_info, "setting datasum"); in btrfs_parse_options()
454 btrfs_info(root->fs_info, in btrfs_parse_options()
457 btrfs_info(root->fs_info, "setting nodatacow"); in btrfs_parse_options()
506 btrfs_info(root->fs_info, in btrfs_parse_options()
562 btrfs_info(root->fs_info, "max_inline at %llu", in btrfs_parse_options()
576 btrfs_info(root->fs_info, "allocations start at %llu", in btrfs_parse_options()
585 root->fs_info->sb->s_flags |= MS_POSIXACL; in btrfs_parse_options()
588 btrfs_err(root->fs_info, in btrfs_parse_options()
594 root->fs_info->sb->s_flags &= ~MS_POSIXACL; in btrfs_parse_options()
618 btrfs_info(root->fs_info, "metadata ratio %d", in btrfs_parse_options()
674 btrfs_info(root->fs_info, "enabling auto recovery"); in btrfs_parse_options()
682 btrfs_info(root->fs_info, in btrfs_parse_options()
689 btrfs_info(root->fs_info, "enabling check integrity"); in btrfs_parse_options()
698 btrfs_info(root->fs_info, "check_integrity_print_mask 0x%x", in btrfs_parse_options()
709 btrfs_err(root->fs_info, in btrfs_parse_options()
730 btrfs_err(root->fs_info, "invalid commit interval"); in btrfs_parse_options()
736 btrfs_warn(root->fs_info, "excessive commit interval %d", in btrfs_parse_options()
741 btrfs_info(root->fs_info, "using default commit interval %ds", in btrfs_parse_options()
747 btrfs_info(root->fs_info, "unrecognized mount option '%s'", p); in btrfs_parse_options()
756 btrfs_info(root->fs_info, "disk space caching is enabled"); in btrfs_parse_options()
847 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in get_default_root() local
848 struct btrfs_root *root = fs_info->tree_root; in get_default_root()
878 dir_id = btrfs_super_root_dir(fs_info->super_copy); in get_default_root()
892 new_root = fs_info->fs_root; in get_default_root()
900 new_root = btrfs_read_fs_root_no_name(fs_info, &location); in get_default_root()
906 down_read(&fs_info->cleanup_work_sem); in get_default_root()
908 up_read(&fs_info->cleanup_work_sem); in get_default_root()
941 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_fill_super() local
965 inode = btrfs_iget(sb, &key, fs_info->fs_root, NULL); in btrfs_fill_super()
983 close_ctree(fs_info->tree_root); in btrfs_fill_super()
990 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_sync_fs() local
991 struct btrfs_root *root = fs_info->tree_root; in btrfs_sync_fs()
996 filemap_flush(fs_info->btree_inode->i_mapping); in btrfs_sync_fs()
1000 btrfs_wait_ordered_roots(fs_info, -1); in btrfs_sync_fs()
1010 if (fs_info->pending_changes == 0) in btrfs_sync_fs()
1073 if (!(root->fs_info->sb->s_flags & MS_POSIXACL)) in btrfs_show_options()
1117 struct btrfs_fs_info *fs_info = btrfs_sb(s); in btrfs_test_super() local
1119 return fs_info->fs_devices == p->fs_devices; in btrfs_test_super()
1264 static int setup_security_options(struct btrfs_fs_info *fs_info, in setup_security_options() argument
1279 if (!fs_info->security_opts.num_mnt_opts) { in setup_security_options()
1281 memcpy(&fs_info->security_opts, sec_opts, sizeof(*sec_opts)); in setup_security_options()
1308 struct btrfs_fs_info *fs_info = NULL; in btrfs_mount() local
1349 fs_info = kzalloc(sizeof(struct btrfs_fs_info), GFP_NOFS); in btrfs_mount()
1350 if (!fs_info) { in btrfs_mount()
1355 fs_info->fs_devices = fs_devices; in btrfs_mount()
1357 fs_info->super_copy = kzalloc(BTRFS_SUPER_INFO_SIZE, GFP_NOFS); in btrfs_mount()
1358 fs_info->super_for_commit = kzalloc(BTRFS_SUPER_INFO_SIZE, GFP_NOFS); in btrfs_mount()
1359 security_init_mnt_opts(&fs_info->security_opts); in btrfs_mount()
1360 if (!fs_info->super_copy || !fs_info->super_for_commit) { in btrfs_mount()
1376 fs_info); in btrfs_mount()
1384 free_fs_info(fs_info); in btrfs_mount()
1403 fs_info = btrfs_sb(s); in btrfs_mount()
1404 error = setup_security_options(fs_info, s, &new_sec_opts); in btrfs_mount()
1416 free_fs_info(fs_info); in btrfs_mount()
1422 static void btrfs_resize_thread_pool(struct btrfs_fs_info *fs_info, in btrfs_resize_thread_pool() argument
1428 fs_info->thread_pool_size = new_pool_size; in btrfs_resize_thread_pool()
1430 btrfs_info(fs_info, "resize thread pool %d -> %d", in btrfs_resize_thread_pool()
1433 btrfs_workqueue_set_max(fs_info->workers, new_pool_size); in btrfs_resize_thread_pool()
1434 btrfs_workqueue_set_max(fs_info->delalloc_workers, new_pool_size); in btrfs_resize_thread_pool()
1435 btrfs_workqueue_set_max(fs_info->submit_workers, new_pool_size); in btrfs_resize_thread_pool()
1436 btrfs_workqueue_set_max(fs_info->caching_workers, new_pool_size); in btrfs_resize_thread_pool()
1437 btrfs_workqueue_set_max(fs_info->endio_workers, new_pool_size); in btrfs_resize_thread_pool()
1438 btrfs_workqueue_set_max(fs_info->endio_meta_workers, new_pool_size); in btrfs_resize_thread_pool()
1439 btrfs_workqueue_set_max(fs_info->endio_meta_write_workers, in btrfs_resize_thread_pool()
1441 btrfs_workqueue_set_max(fs_info->endio_write_workers, new_pool_size); in btrfs_resize_thread_pool()
1442 btrfs_workqueue_set_max(fs_info->endio_freespace_worker, new_pool_size); in btrfs_resize_thread_pool()
1443 btrfs_workqueue_set_max(fs_info->delayed_workers, new_pool_size); in btrfs_resize_thread_pool()
1444 btrfs_workqueue_set_max(fs_info->readahead_workers, new_pool_size); in btrfs_resize_thread_pool()
1445 btrfs_workqueue_set_max(fs_info->scrub_wr_completion_workers, in btrfs_resize_thread_pool()
1449 static inline void btrfs_remount_prepare(struct btrfs_fs_info *fs_info) in btrfs_remount_prepare() argument
1451 set_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state); in btrfs_remount_prepare()
1454 static inline void btrfs_remount_begin(struct btrfs_fs_info *fs_info, in btrfs_remount_begin() argument
1458 (!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) || in btrfs_remount_begin()
1461 wait_event(fs_info->transaction_wait, in btrfs_remount_begin()
1462 (atomic_read(&fs_info->defrag_running) == 0)); in btrfs_remount_begin()
1464 sync_filesystem(fs_info->sb); in btrfs_remount_begin()
1468 static inline void btrfs_remount_cleanup(struct btrfs_fs_info *fs_info, in btrfs_remount_cleanup() argument
1476 (!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) || in btrfs_remount_cleanup()
1477 (fs_info->sb->s_flags & MS_RDONLY))) { in btrfs_remount_cleanup()
1478 btrfs_cleanup_defrag_inodes(fs_info); in btrfs_remount_cleanup()
1481 clear_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state); in btrfs_remount_cleanup()
1486 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_remount() local
1487 struct btrfs_root *root = fs_info->tree_root; in btrfs_remount()
1489 unsigned long old_opts = fs_info->mount_opt; in btrfs_remount()
1490 unsigned long old_compress_type = fs_info->compress_type; in btrfs_remount()
1491 u64 old_max_inline = fs_info->max_inline; in btrfs_remount()
1492 u64 old_alloc_start = fs_info->alloc_start; in btrfs_remount()
1493 int old_thread_pool_size = fs_info->thread_pool_size; in btrfs_remount()
1494 unsigned int old_metadata_ratio = fs_info->metadata_ratio; in btrfs_remount()
1498 btrfs_remount_prepare(fs_info); in btrfs_remount()
1507 ret = setup_security_options(fs_info, sb, in btrfs_remount()
1521 btrfs_remount_begin(fs_info, old_opts, *flags); in btrfs_remount()
1522 btrfs_resize_thread_pool(fs_info, in btrfs_remount()
1523 fs_info->thread_pool_size, old_thread_pool_size); in btrfs_remount()
1533 cancel_work_sync(&fs_info->async_reclaim_work); in btrfs_remount()
1536 down(&fs_info->uuid_tree_rescan_sem); in btrfs_remount()
1538 up(&fs_info->uuid_tree_rescan_sem); in btrfs_remount()
1542 btrfs_dev_replace_suspend_for_unmount(fs_info); in btrfs_remount()
1543 btrfs_scrub_cancel(fs_info); in btrfs_remount()
1544 btrfs_pause_balance(fs_info); in btrfs_remount()
1550 if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) { in btrfs_remount()
1551 btrfs_err(fs_info, in btrfs_remount()
1556 if (fs_info->fs_devices->rw_devices == 0) { in btrfs_remount()
1561 if (fs_info->fs_devices->missing_devices > in btrfs_remount()
1562 fs_info->num_tolerated_disk_barrier_failures && in btrfs_remount()
1564 btrfs_warn(fs_info, in btrfs_remount()
1570 if (btrfs_super_log_root(fs_info->super_copy) != 0) { in btrfs_remount()
1575 ret = btrfs_cleanup_fs_roots(fs_info); in btrfs_remount()
1580 mutex_lock(&fs_info->cleaner_mutex); in btrfs_remount()
1582 mutex_unlock(&fs_info->cleaner_mutex); in btrfs_remount()
1586 ret = btrfs_resume_balance_async(fs_info); in btrfs_remount()
1590 ret = btrfs_resume_dev_replace_async(fs_info); in btrfs_remount()
1592 btrfs_warn(fs_info, "failed to resume dev_replace"); in btrfs_remount()
1596 if (!fs_info->uuid_root) { in btrfs_remount()
1597 btrfs_info(fs_info, "creating UUID tree"); in btrfs_remount()
1598 ret = btrfs_create_uuid_tree(fs_info); in btrfs_remount()
1600 btrfs_warn(fs_info, "failed to create the UUID tree %d", ret); in btrfs_remount()
1607 wake_up_process(fs_info->transaction_kthread); in btrfs_remount()
1608 btrfs_remount_cleanup(fs_info, old_opts); in btrfs_remount()
1616 fs_info->mount_opt = old_opts; in btrfs_remount()
1617 fs_info->compress_type = old_compress_type; in btrfs_remount()
1618 fs_info->max_inline = old_max_inline; in btrfs_remount()
1619 mutex_lock(&fs_info->chunk_mutex); in btrfs_remount()
1620 fs_info->alloc_start = old_alloc_start; in btrfs_remount()
1621 mutex_unlock(&fs_info->chunk_mutex); in btrfs_remount()
1622 btrfs_resize_thread_pool(fs_info, in btrfs_remount()
1623 old_thread_pool_size, fs_info->thread_pool_size); in btrfs_remount()
1624 fs_info->metadata_ratio = old_metadata_ratio; in btrfs_remount()
1625 btrfs_remount_cleanup(fs_info, old_opts); in btrfs_remount()
1661 struct btrfs_fs_info *fs_info = root->fs_info; in btrfs_calc_avail_data_space() local
1663 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; in btrfs_calc_avail_data_space()
1678 nr_devices = fs_info->fs_devices->open_devices; in btrfs_calc_avail_data_space()
1681 nr_devices = fs_info->fs_devices->open_devices; in btrfs_calc_avail_data_space()
1712 if (fs_info->alloc_start) in btrfs_calc_avail_data_space()
1737 if (fs_info->alloc_start && in btrfs_calc_avail_data_space()
1738 fs_info->alloc_start + BTRFS_STRIPE_LEN <= in btrfs_calc_avail_data_space()
1741 skip_space = max(fs_info->alloc_start, skip_space); in btrfs_calc_avail_data_space()
1782 if (fs_info->alloc_start) in btrfs_calc_avail_data_space()
1832 struct btrfs_fs_info *fs_info = btrfs_sb(dentry->d_sb); in btrfs_statfs() local
1833 struct btrfs_super_block *disk_super = fs_info->super_copy; in btrfs_statfs()
1834 struct list_head *head = &fs_info->space_info; in btrfs_statfs()
1840 __be32 *fsid = (__be32 *)fs_info->fsid; in btrfs_statfs()
1842 struct btrfs_block_rsv *block_rsv = &fs_info->global_block_rsv; in btrfs_statfs()
1888 ret = btrfs_calc_avail_data_space(fs_info->tree_root, &total_free_data); in btrfs_statfs()
1930 struct btrfs_fs_info *fs_info = btrfs_sb(sb); in btrfs_kill_super() local
1932 free_fs_info(fs_info); in btrfs_kill_super()
2007 struct btrfs_fs_info *fs_info = btrfs_sb(root->d_sb); in btrfs_show_devname() local
2013 mutex_lock(&fs_info->fs_devices->device_list_mutex); in btrfs_show_devname()
2014 cur_devices = fs_info->fs_devices; in btrfs_show_devname()
2036 mutex_unlock(&fs_info->fs_devices->device_list_mutex); in btrfs_show_devname()