Commit 50479406 authored by Kent Overstreet's avatar Kent Overstreet
Browse files

bcachefs: Replace bare EEXIST with private error codes

parent f648b6c1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1643,7 +1643,7 @@ static int discard_in_flight_add(struct bch_fs *c, struct bpos bucket)
	mutex_lock(&c->discard_buckets_in_flight_lock);
	darray_for_each(c->discard_buckets_in_flight, i)
		if (bkey_eq(*i, bucket)) {
			ret = -EEXIST;
			ret = -BCH_ERR_EEXIST_discard_in_flight_add;
			goto out;
		}

+3 −0
Original line number Diff line number Diff line
@@ -116,6 +116,9 @@
	x(ENOENT,			ENOENT_dev_idx_not_found)		\
	x(ENOTEMPTY,			ENOTEMPTY_dir_not_empty)		\
	x(ENOTEMPTY,			ENOTEMPTY_subvol_not_empty)		\
	x(EEXIST,			EEXIST_str_hash_set)			\
	x(EEXIST,			EEXIST_discard_in_flight_add)		\
	x(EEXIST,			EEXIST_subvolume_create)		\
	x(0,				open_buckets_empty)			\
	x(0,				freelist_empty)				\
	x(BCH_ERR_freelist_empty,	no_buckets_found)			\
+1 −1
Original line number Diff line number Diff line
@@ -373,7 +373,7 @@ static long bch2_ioctl_subvolume_create(struct bch_fs *c, struct file *filp,
	}

	if (dst_dentry->d_inode) {
		error = -EEXIST;
		error = -BCH_ERR_EEXIST_subvolume_create;
		goto err3;
	}

+1 −1
Original line number Diff line number Diff line
@@ -300,7 +300,7 @@ int bch2_hash_set_in_snapshot(struct btree_trans *trans,
	if (!found && (flags & STR_HASH_must_replace)) {
		ret = -BCH_ERR_ENOENT_str_hash_set_must_replace;
	} else if (found && (flags & STR_HASH_must_create)) {
		ret = -EEXIST;
		ret = -BCH_ERR_EEXIST_str_hash_set;
	} else {
		if (!found && slot.path)
			swap(iter, slot);
+6 −5
Original line number Diff line number Diff line
@@ -931,10 +931,11 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
	if (ret)
		goto err;

	for (i = 0; i < c->sb.nr_devices; i++)
		if (bch2_member_exists(c->disk_sb.sb, i) &&
		    bch2_dev_alloc(c, i)) {
			ret = -EEXIST;
	for (i = 0; i < c->sb.nr_devices; i++) {
		if (!bch2_member_exists(c->disk_sb.sb, i))
			continue;
		ret = bch2_dev_alloc(c, i);
		if (ret)
			goto err;
	}