@@ -534,57 +534,9 @@ xfs_trans_apply_sb_deltas(
534
534
sizeof (sbp -> sb_frextents ) - 1 );
535
535
}
536
536
537
- STATIC int
538
- xfs_sb_mod8 (
539
- uint8_t * field ,
540
- int8_t delta )
541
- {
542
- int8_t counter = * field ;
543
-
544
- counter += delta ;
545
- if (counter < 0 ) {
546
- ASSERT (0 );
547
- return - EINVAL ;
548
- }
549
- * field = counter ;
550
- return 0 ;
551
- }
552
-
553
- STATIC int
554
- xfs_sb_mod32 (
555
- uint32_t * field ,
556
- int32_t delta )
557
- {
558
- int32_t counter = * field ;
559
-
560
- counter += delta ;
561
- if (counter < 0 ) {
562
- ASSERT (0 );
563
- return - EINVAL ;
564
- }
565
- * field = counter ;
566
- return 0 ;
567
- }
568
-
569
- STATIC int
570
- xfs_sb_mod64 (
571
- uint64_t * field ,
572
- int64_t delta )
573
- {
574
- int64_t counter = * field ;
575
-
576
- counter += delta ;
577
- if (counter < 0 ) {
578
- ASSERT (0 );
579
- return - EINVAL ;
580
- }
581
- * field = counter ;
582
- return 0 ;
583
- }
584
-
585
537
/*
586
- * xfs_trans_unreserve_and_mod_sb() is called to release unused reservations
587
- * and apply superblock counter changes to the in-core superblock. The
538
+ * xfs_trans_unreserve_and_mod_sb() is called to release unused reservations and
539
+ * apply superblock counter changes to the in-core superblock. The
588
540
* t_res_fdblocks_delta and t_res_frextents_delta fields are explicitly NOT
589
541
* applied to the in-core superblock. The idea is that that has already been
590
542
* done.
@@ -629,116 +581,41 @@ xfs_trans_unreserve_and_mod_sb(
629
581
/* apply the per-cpu counters */
630
582
if (blkdelta ) {
631
583
error = xfs_mod_fdblocks (mp , blkdelta , rsvd );
632
- if (error )
633
- goto out ;
584
+ ASSERT (!error );
634
585
}
635
586
636
587
if (idelta ) {
637
588
error = xfs_mod_icount (mp , idelta );
638
- if (error )
639
- goto out_undo_fdblocks ;
589
+ ASSERT (!error );
640
590
}
641
591
642
592
if (ifreedelta ) {
643
593
error = xfs_mod_ifree (mp , ifreedelta );
644
- if (error )
645
- goto out_undo_icount ;
594
+ ASSERT (!error );
646
595
}
647
596
648
597
if (rtxdelta == 0 && !(tp -> t_flags & XFS_TRANS_SB_DIRTY ))
649
598
return ;
650
599
651
600
/* apply remaining deltas */
652
601
spin_lock (& mp -> m_sb_lock );
653
- if (rtxdelta ) {
654
- error = xfs_sb_mod64 (& mp -> m_sb .sb_frextents , rtxdelta );
655
- if (error )
656
- goto out_undo_ifree ;
657
- }
658
-
659
- if (tp -> t_dblocks_delta != 0 ) {
660
- error = xfs_sb_mod64 (& mp -> m_sb .sb_dblocks , tp -> t_dblocks_delta );
661
- if (error )
662
- goto out_undo_frextents ;
663
- }
664
- if (tp -> t_agcount_delta != 0 ) {
665
- error = xfs_sb_mod32 (& mp -> m_sb .sb_agcount , tp -> t_agcount_delta );
666
- if (error )
667
- goto out_undo_dblocks ;
668
- }
669
- if (tp -> t_imaxpct_delta != 0 ) {
670
- error = xfs_sb_mod8 (& mp -> m_sb .sb_imax_pct , tp -> t_imaxpct_delta );
671
- if (error )
672
- goto out_undo_agcount ;
673
- }
674
- if (tp -> t_rextsize_delta != 0 ) {
675
- error = xfs_sb_mod32 (& mp -> m_sb .sb_rextsize ,
676
- tp -> t_rextsize_delta );
677
- if (error )
678
- goto out_undo_imaxpct ;
679
- }
680
- if (tp -> t_rbmblocks_delta != 0 ) {
681
- error = xfs_sb_mod32 (& mp -> m_sb .sb_rbmblocks ,
682
- tp -> t_rbmblocks_delta );
683
- if (error )
684
- goto out_undo_rextsize ;
685
- }
686
- if (tp -> t_rblocks_delta != 0 ) {
687
- error = xfs_sb_mod64 (& mp -> m_sb .sb_rblocks , tp -> t_rblocks_delta );
688
- if (error )
689
- goto out_undo_rbmblocks ;
690
- }
691
- if (tp -> t_rextents_delta != 0 ) {
692
- error = xfs_sb_mod64 (& mp -> m_sb .sb_rextents ,
693
- tp -> t_rextents_delta );
694
- if (error )
695
- goto out_undo_rblocks ;
696
- }
697
- if (tp -> t_rextslog_delta != 0 ) {
698
- error = xfs_sb_mod8 (& mp -> m_sb .sb_rextslog ,
699
- tp -> t_rextslog_delta );
700
- if (error )
701
- goto out_undo_rextents ;
702
- }
602
+ mp -> m_sb .sb_frextents += rtxdelta ;
603
+ mp -> m_sb .sb_dblocks += tp -> t_dblocks_delta ;
604
+ mp -> m_sb .sb_agcount += tp -> t_agcount_delta ;
605
+ mp -> m_sb .sb_imax_pct += tp -> t_imaxpct_delta ;
606
+ mp -> m_sb .sb_rextsize += tp -> t_rextsize_delta ;
607
+ mp -> m_sb .sb_rbmblocks += tp -> t_rbmblocks_delta ;
608
+ mp -> m_sb .sb_rblocks += tp -> t_rblocks_delta ;
609
+ mp -> m_sb .sb_rextents += tp -> t_rextents_delta ;
610
+ mp -> m_sb .sb_rextslog += tp -> t_rextslog_delta ;
703
611
spin_unlock (& mp -> m_sb_lock );
704
- return ;
705
612
706
- out_undo_rextents :
707
- if (tp -> t_rextents_delta )
708
- xfs_sb_mod64 (& mp -> m_sb .sb_rextents , - tp -> t_rextents_delta );
709
- out_undo_rblocks :
710
- if (tp -> t_rblocks_delta )
711
- xfs_sb_mod64 (& mp -> m_sb .sb_rblocks , - tp -> t_rblocks_delta );
712
- out_undo_rbmblocks :
713
- if (tp -> t_rbmblocks_delta )
714
- xfs_sb_mod32 (& mp -> m_sb .sb_rbmblocks , - tp -> t_rbmblocks_delta );
715
- out_undo_rextsize :
716
- if (tp -> t_rextsize_delta )
717
- xfs_sb_mod32 (& mp -> m_sb .sb_rextsize , - tp -> t_rextsize_delta );
718
- out_undo_imaxpct :
719
- if (tp -> t_rextsize_delta )
720
- xfs_sb_mod8 (& mp -> m_sb .sb_imax_pct , - tp -> t_imaxpct_delta );
721
- out_undo_agcount :
722
- if (tp -> t_agcount_delta )
723
- xfs_sb_mod32 (& mp -> m_sb .sb_agcount , - tp -> t_agcount_delta );
724
- out_undo_dblocks :
725
- if (tp -> t_dblocks_delta )
726
- xfs_sb_mod64 (& mp -> m_sb .sb_dblocks , - tp -> t_dblocks_delta );
727
- out_undo_frextents :
728
- if (rtxdelta )
729
- xfs_sb_mod64 (& mp -> m_sb .sb_frextents , - rtxdelta );
730
- out_undo_ifree :
731
- spin_unlock (& mp -> m_sb_lock );
732
- if (ifreedelta )
733
- xfs_mod_ifree (mp , - ifreedelta );
734
- out_undo_icount :
735
- if (idelta )
736
- xfs_mod_icount (mp , - idelta );
737
- out_undo_fdblocks :
738
- if (blkdelta )
739
- xfs_mod_fdblocks (mp , - blkdelta , rsvd );
740
- out :
741
- ASSERT (error == 0 );
613
+ /*
614
+ * Debug checks outside of the spinlock so they don't lock up the
615
+ * machine if they fail.
616
+ */
617
+ ASSERT (mp -> m_sb .sb_imax_pct >= 0 );
618
+ ASSERT (mp -> m_sb .sb_rextslog >= 0 );
742
619
return ;
743
620
}
744
621
0 commit comments