Commit 89c2e711 authored by Eric Sandeen's avatar Eric Sandeen Committed by Darrick J. Wong

xfs: use xfs_trans_getsb in xfs_sync_sb_buf

Use xfs_trans_getsb rather than reaching right in for
mp->m_sb_bp; I think this is more correct, and it facilitates
building this libxfs code in userspace as well.
Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent d2e73665
...@@ -970,14 +970,16 @@ xfs_sync_sb_buf( ...@@ -970,14 +970,16 @@ xfs_sync_sb_buf(
struct xfs_mount *mp) struct xfs_mount *mp)
{ {
struct xfs_trans *tp; struct xfs_trans *tp;
struct xfs_buf *bp;
int error; int error;
error = xfs_trans_alloc(mp, &M_RES(mp)->tr_sb, 0, 0, 0, &tp); error = xfs_trans_alloc(mp, &M_RES(mp)->tr_sb, 0, 0, 0, &tp);
if (error) if (error)
return error; return error;
bp = xfs_trans_getsb(tp, mp, 0);
xfs_log_sb(tp); xfs_log_sb(tp);
xfs_trans_bhold(tp, mp->m_sb_bp); xfs_trans_bhold(tp, bp);
xfs_trans_set_sync(tp); xfs_trans_set_sync(tp);
error = xfs_trans_commit(tp); error = xfs_trans_commit(tp);
if (error) if (error)
...@@ -985,9 +987,9 @@ xfs_sync_sb_buf( ...@@ -985,9 +987,9 @@ xfs_sync_sb_buf(
/* /*
* write out the sb buffer to get the changes to disk * write out the sb buffer to get the changes to disk
*/ */
error = xfs_bwrite(mp->m_sb_bp); error = xfs_bwrite(bp);
out: out:
xfs_buf_relse(mp->m_sb_bp); xfs_buf_relse(bp);
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment