Commit 464b4155 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Fix bch2_trans_reset_updates()

This should have been resetting trans->fs_usage_deltas as well.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 4e3d1899
...@@ -2792,14 +2792,6 @@ u32 bch2_trans_begin(struct btree_trans *trans) ...@@ -2792,14 +2792,6 @@ u32 bch2_trans_begin(struct btree_trans *trans)
trans->restart_count++; trans->restart_count++;
trans->mem_top = 0; trans->mem_top = 0;
if (trans->fs_usage_deltas) {
trans->fs_usage_deltas->used = 0;
memset((void *) trans->fs_usage_deltas +
offsetof(struct replicas_delta_list, memset_start), 0,
(void *) &trans->fs_usage_deltas->memset_end -
(void *) &trans->fs_usage_deltas->memset_start);
}
trans_for_each_path(trans, path) { trans_for_each_path(trans, path) {
path->should_be_locked = false; path->should_be_locked = false;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "buckets_types.h" #include "buckets_types.h"
#include "darray.h" #include "darray.h"
#include "journal_types.h" #include "journal_types.h"
#include "replicas_types.h"
#include "six.h" #include "six.h"
struct open_bucket; struct open_bucket;
......
...@@ -154,6 +154,14 @@ static inline void bch2_trans_reset_updates(struct btree_trans *trans) ...@@ -154,6 +154,14 @@ static inline void bch2_trans_reset_updates(struct btree_trans *trans)
trans->nr_updates = 0; trans->nr_updates = 0;
trans->hooks = NULL; trans->hooks = NULL;
trans->extra_journal_entries.nr = 0; trans->extra_journal_entries.nr = 0;
if (trans->fs_usage_deltas) {
trans->fs_usage_deltas->used = 0;
memset((void *) trans->fs_usage_deltas +
offsetof(struct replicas_delta_list, memset_start), 0,
(void *) &trans->fs_usage_deltas->memset_end -
(void *) &trans->fs_usage_deltas->memset_start);
}
} }
#endif /* _BCACHEFS_BTREE_UPDATE_H */ #endif /* _BCACHEFS_BTREE_UPDATE_H */
...@@ -1118,14 +1118,6 @@ int __bch2_trans_commit(struct btree_trans *trans) ...@@ -1118,14 +1118,6 @@ int __bch2_trans_commit(struct btree_trans *trans)
out_reset: out_reset:
bch2_trans_reset_updates(trans); bch2_trans_reset_updates(trans);
if (trans->fs_usage_deltas) {
trans->fs_usage_deltas->used = 0;
memset((void *) trans->fs_usage_deltas +
offsetof(struct replicas_delta_list, memset_start), 0,
(void *) &trans->fs_usage_deltas->memset_end -
(void *) &trans->fs_usage_deltas->memset_start);
}
return ret; return ret;
err: err:
ret = bch2_trans_commit_error(trans, i, ret, _RET_IP_); ret = bch2_trans_commit_error(trans, i, ret, _RET_IP_);
......
...@@ -27,22 +27,6 @@ bool bch2_replicas_marked(struct bch_fs *, struct bch_replicas_entry *); ...@@ -27,22 +27,6 @@ bool bch2_replicas_marked(struct bch_fs *, struct bch_replicas_entry *);
int bch2_mark_replicas(struct bch_fs *, int bch2_mark_replicas(struct bch_fs *,
struct bch_replicas_entry *); struct bch_replicas_entry *);
struct replicas_delta {
s64 delta;
struct bch_replicas_entry r;
} __packed;
struct replicas_delta_list {
unsigned size;
unsigned used;
struct {} memset_start;
u64 nr_inodes;
u64 persistent_reserved[BCH_REPLICAS_MAX];
struct {} memset_end;
struct replicas_delta d[0];
};
static inline struct replicas_delta * static inline struct replicas_delta *
replicas_delta_next(struct replicas_delta *d) replicas_delta_next(struct replicas_delta *d)
{ {
......
...@@ -8,4 +8,20 @@ struct bch_replicas_cpu { ...@@ -8,4 +8,20 @@ struct bch_replicas_cpu {
struct bch_replicas_entry *entries; struct bch_replicas_entry *entries;
}; };
struct replicas_delta {
s64 delta;
struct bch_replicas_entry r;
} __packed;
struct replicas_delta_list {
unsigned size;
unsigned used;
struct {} memset_start;
u64 nr_inodes;
u64 persistent_reserved[BCH_REPLICAS_MAX];
struct {} memset_end;
struct replicas_delta d[0];
};
#endif /* _BCACHEFS_REPLICAS_TYPES_H */ #endif /* _BCACHEFS_REPLICAS_TYPES_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment