Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bcachefs: vstruct_for_each() now declares loop iter

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>

+9 -19
-2
fs/bcachefs/journal.h
··· 238 238 239 239 static inline bool journal_entry_empty(struct jset *j) 240 240 { 241 - struct jset_entry *i; 242 - 243 241 if (j->seq != j->last_seq) 244 242 return false; 245 243
+1 -2
fs/bcachefs/journal_io.c
··· 783 783 static int jset_validate_entries(struct bch_fs *c, struct jset *jset, 784 784 enum bkey_invalid_flags flags) 785 785 { 786 - struct jset_entry *entry; 787 786 unsigned version = le32_to_cpu(jset->version); 788 787 int ret = 0; 789 788 ··· 1722 1723 static int bch2_journal_write_prep(struct journal *j, struct journal_buf *w) 1723 1724 { 1724 1725 struct bch_fs *c = container_of(j, struct bch_fs, journal); 1725 - struct jset_entry *start, *end, *i; 1726 + struct jset_entry *start, *end; 1726 1727 struct jset *jset = w->data; 1727 1728 struct journal_keys_to_wb wb = { NULL }; 1728 1729 unsigned sectors, bytes, u64s;
+3 -6
fs/bcachefs/recovery.c
··· 344 344 static int journal_replay_early(struct bch_fs *c, 345 345 struct bch_sb_field_clean *clean) 346 346 { 347 - struct jset_entry *entry; 348 - int ret; 349 - 350 347 if (clean) { 351 - for (entry = clean->start; 348 + for (struct jset_entry *entry = clean->start; 352 349 entry != vstruct_end(&clean->field); 353 350 entry = vstruct_next(entry)) { 354 - ret = journal_replay_entry_early(c, entry); 351 + int ret = journal_replay_entry_early(c, entry); 355 352 if (ret) 356 353 return ret; 357 354 } ··· 363 366 continue; 364 367 365 368 vstruct_for_each(&i->j, entry) { 366 - ret = journal_replay_entry_early(c, entry); 369 + int ret = journal_replay_entry_early(c, entry); 367 370 if (ret) 368 371 return ret; 369 372 }
-4
fs/bcachefs/super-io.c
··· 101 101 struct bch_sb_field *bch2_sb_field_get_id(struct bch_sb *sb, 102 102 enum bch_sb_field_type type) 103 103 { 104 - struct bch_sb_field *f; 105 - 106 104 /* XXX: need locking around superblock to access optional fields */ 107 105 108 106 vstruct_for_each(sb, f) ··· 364 366 int rw) 365 367 { 366 368 struct bch_sb *sb = disk_sb->sb; 367 - struct bch_sb_field *f; 368 369 struct bch_sb_field_members_v1 *mi; 369 370 enum bch_opt_id opt_id; 370 371 u16 block_size; ··· 1247 1250 void bch2_sb_to_text(struct printbuf *out, struct bch_sb *sb, 1248 1251 bool print_layout, unsigned fields) 1249 1252 { 1250 - struct bch_sb_field *f; 1251 1253 u64 fields_have = 0; 1252 1254 unsigned nr_devices = 0; 1253 1255
+5 -5
fs/bcachefs/vstructs.h
··· 48 48 ((void *) ((u64 *) (_s)->_data + __vstruct_u64s(_s))) 49 49 50 50 #define vstruct_for_each(_s, _i) \ 51 - for (_i = (_s)->start; \ 51 + for (typeof(&(_s)->start[0]) _i = (_s)->start; \ 52 52 _i < vstruct_last(_s); \ 53 53 _i = vstruct_next(_i)) 54 54 55 - #define vstruct_for_each_safe(_s, _i, _t) \ 56 - for (_i = (_s)->start; \ 57 - _i < vstruct_last(_s) && (_t = vstruct_next(_i), true); \ 58 - _i = _t) 55 + #define vstruct_for_each_safe(_s, _i) \ 56 + for (typeof(&(_s)->start[0]) _next, _i = (_s)->start; \ 57 + _i < vstruct_last(_s) && (_next = vstruct_next(_i), true); \ 58 + _i = _next) 59 59 60 60 #define vstruct_idx(_s, _idx) \ 61 61 ((typeof(&(_s)->start[0])) ((_s)->_data + (_idx)))