bcachefs: Fix bch2_trans_reset_updates()

This should have been resetting trans->fs_usage_deltas as well.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2023-02-05 14:07:34 -05:00
parent 4e3d18991a
commit 464b415539
6 changed files with 25 additions and 32 deletions

View File

@ -2792,14 +2792,6 @@ u32 bch2_trans_begin(struct btree_trans *trans)
trans->restart_count++;
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) {
path->should_be_locked = false;

View File

@ -9,6 +9,7 @@
#include "buckets_types.h"
#include "darray.h"
#include "journal_types.h"
#include "replicas_types.h"
#include "six.h"
struct open_bucket;

View File

@ -154,6 +154,14 @@ static inline void bch2_trans_reset_updates(struct btree_trans *trans)
trans->nr_updates = 0;
trans->hooks = NULL;
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 */

View File

@ -1118,14 +1118,6 @@ out:
out_reset:
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;
err:
ret = bch2_trans_commit_error(trans, i, ret, _RET_IP_);

View File

@ -27,22 +27,6 @@ bool bch2_replicas_marked(struct bch_fs *, struct bch_replicas_entry *);
int bch2_mark_replicas(struct bch_fs *,
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 *
replicas_delta_next(struct replicas_delta *d)
{

View File

@ -8,4 +8,20 @@ struct bch_replicas_cpu {
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 */