diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-02-05 22:07:34 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:50 +0300 |
commit | 464b415539cc543addb45b85e76c44da145b114c (patch) | |
tree | d24baa17293d6b4494df07c60731190e3fc4eb7c | |
parent | 4e3d18991a7d1138604f0975e7849d9a2d82c524 (diff) | |
download | linux-464b415539cc543addb45b85e76c44da145b114c.tar.xz |
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>
-rw-r--r-- | fs/bcachefs/btree_iter.c | 8 | ||||
-rw-r--r-- | fs/bcachefs/btree_types.h | 1 | ||||
-rw-r--r-- | fs/bcachefs/btree_update.h | 8 | ||||
-rw-r--r-- | fs/bcachefs/btree_update_leaf.c | 8 | ||||
-rw-r--r-- | fs/bcachefs/replicas.h | 16 | ||||
-rw-r--r-- | fs/bcachefs/replicas_types.h | 16 |
6 files changed, 25 insertions, 32 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c index 3774ee8577a9..1a71e8af52d0 100644 --- a/fs/bcachefs/btree_iter.c +++ b/fs/bcachefs/btree_iter.c @@ -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; diff --git a/fs/bcachefs/btree_types.h b/fs/bcachefs/btree_types.h index 7c664186f3c3..5cf03ec52051 100644 --- a/fs/bcachefs/btree_types.h +++ b/fs/bcachefs/btree_types.h @@ -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; diff --git a/fs/bcachefs/btree_update.h b/fs/bcachefs/btree_update.h index 7e9f1f170d5f..9a3c859ea572 100644 --- a/fs/bcachefs/btree_update.h +++ b/fs/bcachefs/btree_update.h @@ -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 */ diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c index 61b61acef7a8..1dc86ac6f837 100644 --- a/fs/bcachefs/btree_update_leaf.c +++ b/fs/bcachefs/btree_update_leaf.c @@ -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_); diff --git a/fs/bcachefs/replicas.h b/fs/bcachefs/replicas.h index cc34b3809206..4887675a86f0 100644 --- a/fs/bcachefs/replicas.h +++ b/fs/bcachefs/replicas.h @@ -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) { diff --git a/fs/bcachefs/replicas_types.h b/fs/bcachefs/replicas_types.h index f12a35b3dbcf..5cfff489bbc3 100644 --- a/fs/bcachefs/replicas_types.h +++ b/fs/bcachefs/replicas_types.h @@ -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 */ |