summaryrefslogtreecommitdiff
path: root/libbcachefs/subvolume.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-08-01 20:18:33 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-08-01 22:13:03 -0400
commit87179c7a6e2a210ea57951d444a3055e883d08fa (patch)
tree3445e8b5d6724518cbc6f659f9d0b0ff59b08bfa /libbcachefs/subvolume.c
parent2d7982de784b24e24baa20eee0a97dea451b8fa7 (diff)
Update bcachefs sources to 33a60d9b05 bcachefs: Assorted fixes for clang
Diffstat (limited to 'libbcachefs/subvolume.c')
-rw-r--r--libbcachefs/subvolume.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libbcachefs/subvolume.c b/libbcachefs/subvolume.c
index 811a6f42..736afb62 100644
--- a/libbcachefs/subvolume.c
+++ b/libbcachefs/subvolume.c
@@ -83,7 +83,7 @@ static noinline struct snapshot_t *__snapshot_t_mut(struct bch_fs *c, u32 id)
if (!new)
return NULL;
- old = c->snapshots;
+ old = rcu_dereference_protected(c->snapshots, true);
if (old)
memcpy(new->s,
rcu_dereference_protected(c->snapshots, true)->s,
@@ -698,6 +698,11 @@ err:
return ret;
}
+static int cmp_le32(__le32 l, __le32 r)
+{
+ return cmp_int(le32_to_cpu(l), le32_to_cpu(r));
+}
+
static int check_snapshot(struct btree_trans *trans,
struct btree_iter *iter,
struct bkey_s_c k)
@@ -830,7 +835,7 @@ static int check_snapshot(struct btree_trans *trans,
for (i = 0; i < ARRAY_SIZE(u->v.skip); i++)
u->v.skip[i] = cpu_to_le32(snapshot_skiplist_get(c, parent_id));
- bubble_sort(u->v.skip, ARRAY_SIZE(u->v.skip), cmp_int);
+ bubble_sort(u->v.skip, ARRAY_SIZE(u->v.skip), cmp_le32);
s = u->v;
}
ret = 0;
@@ -946,7 +951,7 @@ int bch2_check_subvols(struct bch_fs *c)
void bch2_fs_snapshots_exit(struct bch_fs *c)
{
- kfree(c->snapshots);
+ kfree(rcu_dereference_protected(c->snapshots, true));
}
int bch2_snapshots_read(struct bch_fs *c)
@@ -1123,7 +1128,7 @@ static int create_snapids(struct btree_trans *trans, u32 parent, u32 tree,
for (j = 0; j < ARRAY_SIZE(n->v.skip); j++)
n->v.skip[j] = cpu_to_le32(snapshot_skiplist_get(c, parent));
- bubble_sort(n->v.skip, ARRAY_SIZE(n->v.skip), cmp_int);
+ bubble_sort(n->v.skip, ARRAY_SIZE(n->v.skip), cmp_le32);
SET_BCH_SNAPSHOT_SUBVOL(&n->v, true);
ret = bch2_mark_snapshot(trans, BTREE_ID_snapshots, 0,