diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-11-17 06:35:29 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-01-01 19:47:37 +0300 |
commit | 1ae8a0904a6a7b16ee2ffa30153d4e5c38719321 (patch) | |
tree | 87d3fe839acb723caa27d6d7aa996e888820b371 | |
parent | ae0e61175e22b77267c2c59d0061925a0a604074 (diff) | |
download | linux-1ae8a0904a6a7b16ee2ffa30153d4e5c38719321.tar.xz |
bcachefs: Kill memset() in bch2_btree_iter_init()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/bcachefs_format.h | 7 | ||||
-rw-r--r-- | fs/bcachefs/btree_iter.h | 19 | ||||
-rw-r--r-- | fs/bcachefs/btree_types.h | 3 |
3 files changed, 19 insertions, 10 deletions
diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h index fe78e87603fc..60b2264e019e 100644 --- a/fs/bcachefs/bcachefs_format.h +++ b/fs/bcachefs/bcachefs_format.h @@ -307,6 +307,13 @@ struct bkey_i { struct bch_val v; }; +#define POS_KEY(_pos) \ +((struct bkey) { \ + .u64s = BKEY_U64s, \ + .format = KEY_FORMAT_CURRENT, \ + .p = _pos, \ +}) + #define KEY(_inode, _offset, _size) \ ((struct bkey) { \ .u64s = BKEY_U64s, \ diff --git a/fs/bcachefs/btree_iter.h b/fs/bcachefs/btree_iter.h index 7286f92b1974..064720171551 100644 --- a/fs/bcachefs/btree_iter.h +++ b/fs/bcachefs/btree_iter.h @@ -445,14 +445,17 @@ static inline void bch2_trans_iter_init_common(struct btree_trans *trans, unsigned flags, unsigned long ip) { - memset(iter, 0, sizeof(*iter)); - iter->trans = trans; - iter->btree_id = btree_id; - iter->flags = flags; - iter->snapshot = pos.snapshot; - iter->pos = pos; - iter->k.p = pos; - + iter->trans = trans; + iter->update_path = NULL; + iter->key_cache_path = NULL; + iter->btree_id = btree_id; + iter->min_depth = 0; + iter->flags = flags; + iter->snapshot = pos.snapshot; + iter->pos = pos; + iter->k = POS_KEY(pos); + iter->journal_idx = 0; + iter->journal_pos = POS_MIN; #ifdef CONFIG_BCACHEFS_DEBUG iter->ip_allocated = ip; #endif diff --git a/fs/bcachefs/btree_types.h b/fs/bcachefs/btree_types.h index 7f17c23326c7..662852b1e12f 100644 --- a/fs/bcachefs/btree_types.h +++ b/fs/bcachefs/btree_types.h @@ -287,8 +287,7 @@ struct btree_iter { struct btree_path *key_cache_path; enum btree_id btree_id:8; - unsigned min_depth:3; - unsigned advanced:1; + u8 min_depth; /* btree_iter_copy starts here: */ u16 flags; |