@@ -499,9 +499,8 @@ static int run_one_trans_trigger(struct btree_trans *trans, struct btree_insert_
499
499
}
500
500
501
501
static int run_btree_triggers (struct btree_trans * trans , enum btree_id btree_id ,
502
- struct btree_insert_entry * btree_id_start )
502
+ unsigned btree_id_start )
503
503
{
504
- struct btree_insert_entry * i ;
505
504
bool trans_trigger_run ;
506
505
int ret , overwrite ;
507
506
@@ -514,13 +513,13 @@ static int run_btree_triggers(struct btree_trans *trans, enum btree_id btree_id,
514
513
do {
515
514
trans_trigger_run = false;
516
515
517
- for (i = btree_id_start ;
518
- i < trans -> updates + trans -> nr_updates && i -> btree_id <= btree_id ;
516
+ for (unsigned i = btree_id_start ;
517
+ i < trans -> nr_updates && trans -> updates [ i ]. btree_id <= btree_id ;
519
518
i ++ ) {
520
- if (i -> btree_id != btree_id )
519
+ if (trans -> updates [ i ]. btree_id != btree_id )
521
520
continue ;
522
521
523
- ret = run_one_trans_trigger (trans , i , overwrite );
522
+ ret = run_one_trans_trigger (trans , trans -> updates + i , overwrite );
524
523
if (ret < 0 )
525
524
return ret ;
526
525
if (ret )
@@ -534,8 +533,7 @@ static int run_btree_triggers(struct btree_trans *trans, enum btree_id btree_id,
534
533
535
534
static int bch2_trans_commit_run_triggers (struct btree_trans * trans )
536
535
{
537
- struct btree_insert_entry * btree_id_start = trans -> updates ;
538
- unsigned btree_id = 0 ;
536
+ unsigned btree_id = 0 , btree_id_start = 0 ;
539
537
int ret = 0 ;
540
538
541
539
/*
@@ -549,20 +547,22 @@ static int bch2_trans_commit_run_triggers(struct btree_trans *trans)
549
547
if (btree_id == BTREE_ID_alloc )
550
548
continue ;
551
549
552
- while (btree_id_start < trans -> updates + trans -> nr_updates &&
553
- btree_id_start -> btree_id < btree_id )
550
+ while (btree_id_start < trans -> nr_updates &&
551
+ trans -> updates [ btree_id_start ]. btree_id < btree_id )
554
552
btree_id_start ++ ;
555
553
556
554
ret = run_btree_triggers (trans , btree_id , btree_id_start );
557
555
if (ret )
558
556
return ret ;
559
557
}
560
558
561
- trans_for_each_update (trans , i ) {
559
+ for (unsigned idx = 0 ; idx < trans -> nr_updates ; idx ++ ) {
560
+ struct btree_insert_entry * i = trans -> updates + idx ;
561
+
562
562
if (i -> btree_id > BTREE_ID_alloc )
563
563
break ;
564
564
if (i -> btree_id == BTREE_ID_alloc ) {
565
- ret = run_btree_triggers (trans , BTREE_ID_alloc , i );
565
+ ret = run_btree_triggers (trans , BTREE_ID_alloc , idx );
566
566
if (ret )
567
567
return ret ;
568
568
break ;
@@ -826,7 +826,8 @@ static inline int do_bch2_trans_commit(struct btree_trans *trans, unsigned flags
826
826
struct bch_fs * c = trans -> c ;
827
827
int ret = 0 , u64s_delta = 0 ;
828
828
829
- trans_for_each_update (trans , i ) {
829
+ for (unsigned idx = 0 ; idx < trans -> nr_updates ; idx ++ ) {
830
+ struct btree_insert_entry * i = trans -> updates + idx ;
830
831
if (i -> cached )
831
832
continue ;
832
833
0 commit comments