Skip to content

Commit 5047940

Browse files
author
Kent Overstreet
committed
bcachefs: Replace bare EEXIST with private error codes
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent f648b6c commit 5047940

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

fs/bcachefs/alloc_background.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,7 @@ static int discard_in_flight_add(struct bch_fs *c, struct bpos bucket)
16431643
mutex_lock(&c->discard_buckets_in_flight_lock);
16441644
darray_for_each(c->discard_buckets_in_flight, i)
16451645
if (bkey_eq(*i, bucket)) {
1646-
ret = -EEXIST;
1646+
ret = -BCH_ERR_EEXIST_discard_in_flight_add;
16471647
goto out;
16481648
}
16491649

fs/bcachefs/errcode.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@
116116
x(ENOENT, ENOENT_dev_idx_not_found) \
117117
x(ENOTEMPTY, ENOTEMPTY_dir_not_empty) \
118118
x(ENOTEMPTY, ENOTEMPTY_subvol_not_empty) \
119+
x(EEXIST, EEXIST_str_hash_set) \
120+
x(EEXIST, EEXIST_discard_in_flight_add) \
121+
x(EEXIST, EEXIST_subvolume_create) \
119122
x(0, open_buckets_empty) \
120123
x(0, freelist_empty) \
121124
x(BCH_ERR_freelist_empty, no_buckets_found) \

fs/bcachefs/fs-ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ static long bch2_ioctl_subvolume_create(struct bch_fs *c, struct file *filp,
373373
}
374374

375375
if (dst_dentry->d_inode) {
376-
error = -EEXIST;
376+
error = -BCH_ERR_EEXIST_subvolume_create;
377377
goto err3;
378378
}
379379

fs/bcachefs/str_hash.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ int bch2_hash_set_in_snapshot(struct btree_trans *trans,
300300
if (!found && (flags & STR_HASH_must_replace)) {
301301
ret = -BCH_ERR_ENOENT_str_hash_set_must_replace;
302302
} else if (found && (flags & STR_HASH_must_create)) {
303-
ret = -EEXIST;
303+
ret = -BCH_ERR_EEXIST_str_hash_set;
304304
} else {
305305
if (!found && slot.path)
306306
swap(iter, slot);

fs/bcachefs/super.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -931,12 +931,13 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
931931
if (ret)
932932
goto err;
933933

934-
for (i = 0; i < c->sb.nr_devices; i++)
935-
if (bch2_member_exists(c->disk_sb.sb, i) &&
936-
bch2_dev_alloc(c, i)) {
937-
ret = -EEXIST;
934+
for (i = 0; i < c->sb.nr_devices; i++) {
935+
if (!bch2_member_exists(c->disk_sb.sb, i))
936+
continue;
937+
ret = bch2_dev_alloc(c, i);
938+
if (ret)
938939
goto err;
939-
}
940+
}
940941

941942
bch2_journal_entry_res_resize(&c->journal,
942943
&c->btree_root_journal_res,

0 commit comments

Comments
 (0)