Btrfs: add tests for btrfs_get_extent
[platform/adaptation/renesas_rcar/renesas_kernel.git] / fs / btrfs / super.c
index 58cb83f..1f62c1c 100644 (file)
@@ -921,7 +921,7 @@ int btrfs_sync_fs(struct super_block *sb, int wait)
                return 0;
        }
 
-       btrfs_wait_all_ordered_extents(fs_info, 1);
+       btrfs_wait_all_ordered_extents(fs_info);
 
        trans = btrfs_attach_transaction_barrier(root);
        if (IS_ERR(trans)) {
@@ -1340,6 +1340,12 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
                if (ret)
                        goto restore;
        } else {
+               if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) {
+                       btrfs_err(fs_info,
+                               "Remounting read-write after error is not allowed\n");
+                       ret = -EINVAL;
+                       goto restore;
+               }
                if (fs_info->fs_devices->rw_devices == 0) {
                        ret = -EACCES;
                        goto restore;
@@ -1377,6 +1383,16 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
                        pr_warn("btrfs: failed to resume dev_replace\n");
                        goto restore;
                }
+
+               if (!fs_info->uuid_root) {
+                       pr_info("btrfs: creating UUID tree\n");
+                       ret = btrfs_create_uuid_tree(fs_info);
+                       if (ret) {
+                               pr_warn("btrfs: failed to create the uuid tree"
+                                       "%d\n", ret);
+                               goto restore;
+                       }
+               }
                sb->s_flags &= ~MS_RDONLY;
        }
 out:
@@ -1773,7 +1789,25 @@ static void btrfs_print_info(void)
 
 static int btrfs_run_sanity_tests(void)
 {
-       return btrfs_test_free_space_cache();
+       int ret;
+
+       ret = btrfs_init_test_fs();
+       if (ret)
+               return ret;
+
+       ret = btrfs_test_free_space_cache();
+       if (ret)
+               goto out;
+       ret = btrfs_test_extent_buffer_operations();
+       if (ret)
+               goto out;
+       ret = btrfs_test_extent_io();
+       if (ret)
+               goto out;
+       ret = btrfs_test_inodes();
+out:
+       btrfs_destroy_test_fs();
+       return ret;
 }
 
 static int __init init_btrfs_fs(void)