summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-06-05 10:53:01 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2024-06-05 10:53:01 -0400
commit0d570e822b350320a2787033b0b92c49e579e2a8 (patch)
treebc1b311cbae412017ad3a71180e4cdb8db9136a8
parent0916d3866454cc6f67cf4ea52cb79e9455138f7a (diff)
Update bcachefs sources to 4f69e2d39ad3 bcachefs: bch2_btree_insert() - add btree iter flags
-rw-r--r--.bcachefs_revision2
-rw-r--r--libbcachefs/btree_journal_iter.h2
-rw-r--r--libbcachefs/disk_accounting.c22
3 files changed, 24 insertions, 2 deletions
diff --git a/.bcachefs_revision b/.bcachefs_revision
index a9d4e51a..ee1ada75 100644
--- a/.bcachefs_revision
+++ b/.bcachefs_revision
@@ -1 +1 @@
-f81dc88f0c80be08f1703852be83a9b75e626228
+4f69e2d39ad3d12f724e00fafb910f85af79a7cc
diff --git a/libbcachefs/btree_journal_iter.h b/libbcachefs/btree_journal_iter.h
index 5b66c8f8..1653de9d 100644
--- a/libbcachefs/btree_journal_iter.h
+++ b/libbcachefs/btree_journal_iter.h
@@ -2,6 +2,8 @@
#ifndef _BCACHEFS_BTREE_JOURNAL_ITER_H
#define _BCACHEFS_BTREE_JOURNAL_ITER_H
+#include "bkey.h"
+
struct journal_iter {
struct list_head list;
enum btree_id btree_id;
diff --git a/libbcachefs/disk_accounting.c b/libbcachefs/disk_accounting.c
index 48d68db2..b9296195 100644
--- a/libbcachefs/disk_accounting.c
+++ b/libbcachefs/disk_accounting.c
@@ -3,6 +3,7 @@
#include "bcachefs.h"
#include "bcachefs_ioctl.h"
#include "btree_cache.h"
+#include "btree_journal_iter.h"
#include "btree_update.h"
#include "btree_write_buffer.h"
#include "buckets.h"
@@ -182,7 +183,9 @@ static inline bool accounting_to_replicas(struct bch_replicas_entry_v1 *r, struc
switch (acc_k.type) {
case BCH_DISK_ACCOUNTING_replicas:
- memcpy(r, &acc_k.replicas, replicas_entry_bytes(&acc_k.replicas));
+ unsafe_memcpy(r, &acc_k.replicas,
+ replicas_entry_bytes(&acc_k.replicas),
+ "variable length struct");
return true;
default:
return false;
@@ -546,7 +549,9 @@ int bch2_accounting_read(struct bch_fs *c)
goto err;
struct journal_keys *keys = &c->journal_keys;
+ struct journal_key *dst = keys->data;
move_gap(keys, keys->nr);
+
darray_for_each(*keys, i) {
if (i->k->k.type == KEY_TYPE_accounting) {
struct bkey_s_c k = bkey_i_to_s_c(i->k);
@@ -560,11 +565,26 @@ int bch2_accounting_read(struct bch_fs *c)
if (applied)
continue;
+ if (i + 1 < &darray_top(*keys) &&
+ i[1].k->k.type == KEY_TYPE_accounting &&
+ !journal_key_cmp(i, i + 1)) {
+ BUG_ON(bversion_cmp(i[0].k->k.version, i[1].k->k.version) >= 0);
+
+ i[1].journal_seq = i[0].journal_seq;
+
+ bch2_accounting_accumulate(bkey_i_to_accounting(i[1].k),
+ bkey_s_c_to_accounting(k));
+ continue;
+ }
+
ret = accounting_read_key(c, NULL, k);
if (ret)
goto err;
}
+
+ *dst++ = *i;
}
+ keys->gap = keys->nr = dst - keys->data;
percpu_down_read(&c->mark_lock);
preempt_disable();