Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 326f7842 authored by Chris Mason's avatar Chris Mason
Browse files

Merge branch 'misc-for-4.5' of...

Merge branch 'misc-for-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux into for-linus-4.5
parents acc30855 546bed63
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -1583,8 +1583,23 @@ int btrfs_init_fs_root(struct btrfs_root *root)
	ret = get_anon_bdev(&root->anon_dev);
	if (ret)
		goto free_writers;

	mutex_lock(&root->objectid_mutex);
	ret = btrfs_find_highest_objectid(root,
					&root->highest_objectid);
	if (ret) {
		mutex_unlock(&root->objectid_mutex);
		goto free_root_dev;
	}

	ASSERT(root->highest_objectid <= BTRFS_LAST_FREE_OBJECTID);

	mutex_unlock(&root->objectid_mutex);

	return 0;

free_root_dev:
	free_anon_bdev(root->anon_dev);
free_writers:
	btrfs_free_subvolume_writers(root->subv_writers);
fail:
@@ -2915,6 +2930,18 @@ int open_ctree(struct super_block *sb,
	tree_root->commit_root = btrfs_root_node(tree_root);
	btrfs_set_root_refs(&tree_root->root_item, 1);

	mutex_lock(&tree_root->objectid_mutex);
	ret = btrfs_find_highest_objectid(tree_root,
					&tree_root->highest_objectid);
	if (ret) {
		mutex_unlock(&tree_root->objectid_mutex);
		goto recovery_tree_root;
	}

	ASSERT(tree_root->highest_objectid <= BTRFS_LAST_FREE_OBJECTID);

	mutex_unlock(&tree_root->objectid_mutex);

	ret = btrfs_read_roots(fs_info, tree_root);
	if (ret)
		goto recovery_tree_root;
+1 −8
Original line number Diff line number Diff line
@@ -515,7 +515,7 @@ int btrfs_save_ino_cache(struct btrfs_root *root,
	return ret;
}

static int btrfs_find_highest_objectid(struct btrfs_root *root, u64 *objectid)
int btrfs_find_highest_objectid(struct btrfs_root *root, u64 *objectid)
{
	struct btrfs_path *path;
	int ret;
@@ -555,13 +555,6 @@ int btrfs_find_free_objectid(struct btrfs_root *root, u64 *objectid)
	int ret;
	mutex_lock(&root->objectid_mutex);

	if (unlikely(root->highest_objectid < BTRFS_FIRST_FREE_OBJECTID)) {
		ret = btrfs_find_highest_objectid(root,
						  &root->highest_objectid);
		if (ret)
			goto out;
	}

	if (unlikely(root->highest_objectid >= BTRFS_LAST_FREE_OBJECTID)) {
		ret = -ENOSPC;
		goto out;
+1 −0
Original line number Diff line number Diff line
@@ -9,5 +9,6 @@ int btrfs_save_ino_cache(struct btrfs_root *root,
			 struct btrfs_trans_handle *trans);

int btrfs_find_free_objectid(struct btrfs_root *root, u64 *objectid);
int btrfs_find_highest_objectid(struct btrfs_root *root, u64 *objectid);

#endif
+4 −0
Original line number Diff line number Diff line
@@ -568,6 +568,10 @@ static noinline int create_subvol(struct inode *dir,
		goto fail;
	}

	mutex_lock(&new_root->objectid_mutex);
	new_root->highest_objectid = new_dirid;
	mutex_unlock(&new_root->objectid_mutex);

	/*
	 * insert the directory item
	 */
+22 −7
Original line number Diff line number Diff line
@@ -383,6 +383,9 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
	int ret = 0;
	char *compress_type;
	bool compress_force = false;
	enum btrfs_compression_type saved_compress_type;
	bool saved_compress_force;
	int no_compress = 0;

	cache_gen = btrfs_super_cache_generation(root->fs_info->super_copy);
	if (btrfs_fs_compat_ro(root->fs_info, FREE_SPACE_TREE))
@@ -462,6 +465,10 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
			/* Fallthrough */
		case Opt_compress:
		case Opt_compress_type:
			saved_compress_type = btrfs_test_opt(root, COMPRESS) ?
				info->compress_type : BTRFS_COMPRESS_NONE;
			saved_compress_force =
				btrfs_test_opt(root, FORCE_COMPRESS);
			if (token == Opt_compress ||
			    token == Opt_compress_force ||
			    strcmp(args[0].from, "zlib") == 0) {
@@ -470,6 +477,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
				btrfs_set_opt(info->mount_opt, COMPRESS);
				btrfs_clear_opt(info->mount_opt, NODATACOW);
				btrfs_clear_opt(info->mount_opt, NODATASUM);
				no_compress = 0;
			} else if (strcmp(args[0].from, "lzo") == 0) {
				compress_type = "lzo";
				info->compress_type = BTRFS_COMPRESS_LZO;
@@ -477,25 +485,21 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
				btrfs_clear_opt(info->mount_opt, NODATACOW);
				btrfs_clear_opt(info->mount_opt, NODATASUM);
				btrfs_set_fs_incompat(info, COMPRESS_LZO);
				no_compress = 0;
			} else if (strncmp(args[0].from, "no", 2) == 0) {
				compress_type = "no";
				btrfs_clear_opt(info->mount_opt, COMPRESS);
				btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS);
				compress_force = false;
				no_compress++;
			} else {
				ret = -EINVAL;
				goto out;
			}

			if (compress_force) {
				btrfs_set_and_info(root, FORCE_COMPRESS,
						   "force %s compression",
						   compress_type);
				btrfs_set_opt(info->mount_opt, FORCE_COMPRESS);
			} else {
				if (!btrfs_test_opt(root, COMPRESS))
					btrfs_info(root->fs_info,
						   "btrfs: use %s compression",
						   compress_type);
				/*
				 * If we remount from compress-force=xxx to
				 * compress=xxx, we need clear FORCE_COMPRESS
@@ -504,6 +508,17 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
				 */
				btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS);
			}
			if ((btrfs_test_opt(root, COMPRESS) &&
			     (info->compress_type != saved_compress_type ||
			      compress_force != saved_compress_force)) ||
			    (!btrfs_test_opt(root, COMPRESS) &&
			     no_compress == 1)) {
				btrfs_info(root->fs_info,
					   "%s %s compression",
					   (compress_force) ? "force" : "use",
					   compress_type);
			}
			compress_force = false;
			break;
		case Opt_ssd:
			btrfs_set_and_info(root, SSD,
Loading