diff options
author | Christoph Hellwig <hch@infradead.org> | 2007-08-27 23:58:06 -0400 |
---|---|---|
committer | Tim Shimmin <tes@chook.melbourne.sgi.com> | 2007-10-15 02:49:09 -0400 |
commit | 2bdf7cd0baa67608ada1517a281af359faf4c58c (patch) | |
tree | 645d283fd4938a9b21b4b9e2585224ed4eeb4adb /fs/xfs/xfs_trans.c | |
parent | 347d1c01956d567c18afef0cc253eb235cafacd8 (diff) |
[XFS] superblock endianess annotations
Creates a new xfs_dsb_t that is __be annotated and keeps xfs_sb_t for the
incore one. xfs_xlatesb is renamed to xfs_sb_to_disk and only handles the
incore -> disk conversion. A new helper xfs_sb_from_disk handles the other
direction and doesn't need the slightly hacky table-driven approach
because we only ever read the full sb from disk.
The handling of shared r/o filesystems has been buggy on little endian
system and fixing this required shuffling around of some code in that
area.
SGI-PV: 968563
SGI-Modid: xfs-linux-melb:xfs-kern:29477a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_trans.c')
-rw-r--r-- | fs/xfs/xfs_trans.c | 72 |
1 files changed, 33 insertions, 39 deletions
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c index 356d6627f581..668996aae36d 100644 --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c | |||
@@ -548,7 +548,7 @@ STATIC void | |||
548 | xfs_trans_apply_sb_deltas( | 548 | xfs_trans_apply_sb_deltas( |
549 | xfs_trans_t *tp) | 549 | xfs_trans_t *tp) |
550 | { | 550 | { |
551 | xfs_sb_t *sbp; | 551 | xfs_dsb_t *sbp; |
552 | xfs_buf_t *bp; | 552 | xfs_buf_t *bp; |
553 | int whole = 0; | 553 | int whole = 0; |
554 | 554 | ||
@@ -566,57 +566,51 @@ xfs_trans_apply_sb_deltas( | |||
566 | * Only update the superblock counters if we are logging them | 566 | * Only update the superblock counters if we are logging them |
567 | */ | 567 | */ |
568 | if (!xfs_sb_version_haslazysbcount(&(tp->t_mountp->m_sb))) { | 568 | if (!xfs_sb_version_haslazysbcount(&(tp->t_mountp->m_sb))) { |
569 | if (tp->t_icount_delta != 0) { | 569 | if (tp->t_icount_delta) |
570 | INT_MOD(sbp->sb_icount, ARCH_CONVERT, tp->t_icount_delta); | 570 | be64_add(&sbp->sb_icount, tp->t_icount_delta); |
571 | } | 571 | if (tp->t_ifree_delta) |
572 | if (tp->t_ifree_delta != 0) { | 572 | be64_add(&sbp->sb_ifree, tp->t_ifree_delta); |
573 | INT_MOD(sbp->sb_ifree, ARCH_CONVERT, tp->t_ifree_delta); | 573 | if (tp->t_fdblocks_delta) |
574 | } | 574 | be64_add(&sbp->sb_fdblocks, tp->t_fdblocks_delta); |
575 | 575 | if (tp->t_res_fdblocks_delta) | |
576 | if (tp->t_fdblocks_delta != 0) { | 576 | be64_add(&sbp->sb_fdblocks, tp->t_res_fdblocks_delta); |
577 | INT_MOD(sbp->sb_fdblocks, ARCH_CONVERT, tp->t_fdblocks_delta); | ||
578 | } | ||
579 | if (tp->t_res_fdblocks_delta != 0) { | ||
580 | INT_MOD(sbp->sb_fdblocks, ARCH_CONVERT, tp->t_res_fdblocks_delta); | ||
581 | } | ||
582 | } | 577 | } |
583 | 578 | ||
584 | if (tp->t_frextents_delta != 0) { | 579 | if (tp->t_frextents_delta) |
585 | INT_MOD(sbp->sb_frextents, ARCH_CONVERT, tp->t_frextents_delta); | 580 | be64_add(&sbp->sb_frextents, tp->t_frextents_delta); |
586 | } | 581 | if (tp->t_res_frextents_delta) |
587 | if (tp->t_res_frextents_delta != 0) { | 582 | be64_add(&sbp->sb_frextents, tp->t_res_frextents_delta); |
588 | INT_MOD(sbp->sb_frextents, ARCH_CONVERT, tp->t_res_frextents_delta); | 583 | |
589 | } | 584 | if (tp->t_dblocks_delta) { |
590 | if (tp->t_dblocks_delta != 0) { | 585 | be64_add(&sbp->sb_dblocks, tp->t_dblocks_delta); |
591 | INT_MOD(sbp->sb_dblocks, ARCH_CONVERT, tp->t_dblocks_delta); | ||
592 | whole = 1; | 586 | whole = 1; |
593 | } | 587 | } |
594 | if (tp->t_agcount_delta != 0) { | 588 | if (tp->t_agcount_delta) { |
595 | INT_MOD(sbp->sb_agcount, ARCH_CONVERT, tp->t_agcount_delta); | 589 | be32_add(&sbp->sb_agcount, tp->t_agcount_delta); |
596 | whole = 1; | 590 | whole = 1; |
597 | } | 591 | } |
598 | if (tp->t_imaxpct_delta != 0) { | 592 | if (tp->t_imaxpct_delta) { |
599 | INT_MOD(sbp->sb_imax_pct, ARCH_CONVERT, tp->t_imaxpct_delta); | 593 | sbp->sb_imax_pct += tp->t_imaxpct_delta; |
600 | whole = 1; | 594 | whole = 1; |
601 | } | 595 | } |
602 | if (tp->t_rextsize_delta != 0) { | 596 | if (tp->t_rextsize_delta) { |
603 | INT_MOD(sbp->sb_rextsize, ARCH_CONVERT, tp->t_rextsize_delta); | 597 | be32_add(&sbp->sb_rextsize, tp->t_rextsize_delta); |
604 | whole = 1; | 598 | whole = 1; |
605 | } | 599 | } |
606 | if (tp->t_rbmblocks_delta != 0) { | 600 | if (tp->t_rbmblocks_delta) { |
607 | INT_MOD(sbp->sb_rbmblocks, ARCH_CONVERT, tp->t_rbmblocks_delta); | 601 | be32_add(&sbp->sb_rbmblocks, tp->t_rbmblocks_delta); |
608 | whole = 1; | 602 | whole = 1; |
609 | } | 603 | } |
610 | if (tp->t_rblocks_delta != 0) { | 604 | if (tp->t_rblocks_delta) { |
611 | INT_MOD(sbp->sb_rblocks, ARCH_CONVERT, tp->t_rblocks_delta); | 605 | be64_add(&sbp->sb_rblocks, tp->t_rblocks_delta); |
612 | whole = 1; | 606 | whole = 1; |
613 | } | 607 | } |
614 | if (tp->t_rextents_delta != 0) { | 608 | if (tp->t_rextents_delta) { |
615 | INT_MOD(sbp->sb_rextents, ARCH_CONVERT, tp->t_rextents_delta); | 609 | be64_add(&sbp->sb_rextents, tp->t_rextents_delta); |
616 | whole = 1; | 610 | whole = 1; |
617 | } | 611 | } |
618 | if (tp->t_rextslog_delta != 0) { | 612 | if (tp->t_rextslog_delta) { |
619 | INT_MOD(sbp->sb_rextslog, ARCH_CONVERT, tp->t_rextslog_delta); | 613 | sbp->sb_rextslog += tp->t_rextslog_delta; |
620 | whole = 1; | 614 | whole = 1; |
621 | } | 615 | } |
622 | 616 | ||
@@ -624,14 +618,14 @@ xfs_trans_apply_sb_deltas( | |||
624 | /* | 618 | /* |
625 | * Log the whole thing, the fields are noncontiguous. | 619 | * Log the whole thing, the fields are noncontiguous. |
626 | */ | 620 | */ |
627 | xfs_trans_log_buf(tp, bp, 0, sizeof(xfs_sb_t) - 1); | 621 | xfs_trans_log_buf(tp, bp, 0, sizeof(xfs_dsb_t) - 1); |
628 | else | 622 | else |
629 | /* | 623 | /* |
630 | * Since all the modifiable fields are contiguous, we | 624 | * Since all the modifiable fields are contiguous, we |
631 | * can get away with this. | 625 | * can get away with this. |
632 | */ | 626 | */ |
633 | xfs_trans_log_buf(tp, bp, offsetof(xfs_sb_t, sb_icount), | 627 | xfs_trans_log_buf(tp, bp, offsetof(xfs_dsb_t, sb_icount), |
634 | offsetof(xfs_sb_t, sb_frextents) + | 628 | offsetof(xfs_dsb_t, sb_frextents) + |
635 | sizeof(sbp->sb_frextents) - 1); | 629 | sizeof(sbp->sb_frextents) - 1); |
636 | 630 | ||
637 | XFS_MTOVFS(tp->t_mountp)->vfs_super->s_dirt = 1; | 631 | XFS_MTOVFS(tp->t_mountp)->vfs_super->s_dirt = 1; |