Commit 15ac08a8 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Lachlan McIlroy

[XFS] replace b_fspriv with b_mount

Replace the b_fspriv pointer and it's ugly accessors with a properly types
xfs_mount pointer.  Also switch log reocvery over to it instead of using
b_fspriv for the mount pointer.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <david@fromorbit.com>
Signed-off-by: default avatarLachlan McIlroy <lachlan@sgi.com>
parent e055f13a
...@@ -1085,7 +1085,7 @@ xfs_bawrite( ...@@ -1085,7 +1085,7 @@ xfs_bawrite(
bp->b_flags &= ~(XBF_READ | XBF_DELWRI | XBF_READ_AHEAD); bp->b_flags &= ~(XBF_READ | XBF_DELWRI | XBF_READ_AHEAD);
bp->b_flags |= (XBF_WRITE | XBF_ASYNC | _XBF_RUN_QUEUES); bp->b_flags |= (XBF_WRITE | XBF_ASYNC | _XBF_RUN_QUEUES);
bp->b_fspriv3 = mp; bp->b_mount = mp;
bp->b_strat = xfs_bdstrat_cb; bp->b_strat = xfs_bdstrat_cb;
return xfs_bdstrat_cb(bp); return xfs_bdstrat_cb(bp);
} }
...@@ -1098,7 +1098,7 @@ xfs_bdwrite( ...@@ -1098,7 +1098,7 @@ xfs_bdwrite(
XB_TRACE(bp, "bdwrite", 0); XB_TRACE(bp, "bdwrite", 0);
bp->b_strat = xfs_bdstrat_cb; bp->b_strat = xfs_bdstrat_cb;
bp->b_fspriv3 = mp; bp->b_mount = mp;
bp->b_flags &= ~XBF_READ; bp->b_flags &= ~XBF_READ;
bp->b_flags |= (XBF_DELWRI | XBF_ASYNC); bp->b_flags |= (XBF_DELWRI | XBF_ASYNC);
......
...@@ -168,7 +168,7 @@ typedef struct xfs_buf { ...@@ -168,7 +168,7 @@ typedef struct xfs_buf {
struct completion b_iowait; /* queue for I/O waiters */ struct completion b_iowait; /* queue for I/O waiters */
void *b_fspriv; void *b_fspriv;
void *b_fspriv2; void *b_fspriv2;
void *b_fspriv3; struct xfs_mount *b_mount;
unsigned short b_error; /* error code on I/O */ unsigned short b_error; /* error code on I/O */
unsigned int b_page_count; /* size of page array */ unsigned int b_page_count; /* size of page array */
unsigned int b_offset; /* page offset in first page */ unsigned int b_offset; /* page offset in first page */
...@@ -335,8 +335,6 @@ extern void xfs_buf_trace(xfs_buf_t *, char *, void *, void *); ...@@ -335,8 +335,6 @@ extern void xfs_buf_trace(xfs_buf_t *, char *, void *, void *);
#define XFS_BUF_SET_FSPRIVATE(bp, val) ((bp)->b_fspriv = (void*)(val)) #define XFS_BUF_SET_FSPRIVATE(bp, val) ((bp)->b_fspriv = (void*)(val))
#define XFS_BUF_FSPRIVATE2(bp, type) ((type)(bp)->b_fspriv2) #define XFS_BUF_FSPRIVATE2(bp, type) ((type)(bp)->b_fspriv2)
#define XFS_BUF_SET_FSPRIVATE2(bp, val) ((bp)->b_fspriv2 = (void*)(val)) #define XFS_BUF_SET_FSPRIVATE2(bp, val) ((bp)->b_fspriv2 = (void*)(val))
#define XFS_BUF_FSPRIVATE3(bp, type) ((type)(bp)->b_fspriv3)
#define XFS_BUF_SET_FSPRIVATE3(bp, val) ((bp)->b_fspriv3 = (void*)(val))
#define XFS_BUF_SET_START(bp) do { } while (0) #define XFS_BUF_SET_START(bp) do { } while (0)
#define XFS_BUF_SET_BRELSE_FUNC(bp, func) ((bp)->b_relse = (func)) #define XFS_BUF_SET_BRELSE_FUNC(bp, func) ((bp)->b_relse = (func))
......
...@@ -847,13 +847,7 @@ retry: ...@@ -847,13 +847,7 @@ retry:
int int
xfs_bdstrat_cb(struct xfs_buf *bp) xfs_bdstrat_cb(struct xfs_buf *bp)
{ {
xfs_mount_t *mp; if (XFS_FORCED_SHUTDOWN(bp->b_mount)) {
mp = XFS_BUF_FSPRIVATE3(bp, xfs_mount_t *);
if (!XFS_FORCED_SHUTDOWN(mp)) {
xfs_buf_iorequest(bp);
return 0;
} else {
xfs_buftrace("XFS__BDSTRAT IOERROR", bp); xfs_buftrace("XFS__BDSTRAT IOERROR", bp);
/* /*
* Metadata write that didn't get logged but * Metadata write that didn't get logged but
...@@ -866,6 +860,9 @@ xfs_bdstrat_cb(struct xfs_buf *bp) ...@@ -866,6 +860,9 @@ xfs_bdstrat_cb(struct xfs_buf *bp)
else else
return (xfs_bioerror(bp)); return (xfs_bioerror(bp));
} }
xfs_buf_iorequest(bp);
return 0;
} }
/* /*
......
...@@ -707,8 +707,8 @@ xfs_buf_item_init( ...@@ -707,8 +707,8 @@ xfs_buf_item_init(
* the first. If we do already have one, there is * the first. If we do already have one, there is
* nothing to do here so return. * nothing to do here so return.
*/ */
if (XFS_BUF_FSPRIVATE3(bp, xfs_mount_t *) != mp) if (bp->b_mount != mp)
XFS_BUF_SET_FSPRIVATE3(bp, mp); bp->b_mount = mp;
XFS_BUF_SET_BDSTRAT_FUNC(bp, xfs_bdstrat_cb); XFS_BUF_SET_BDSTRAT_FUNC(bp, xfs_bdstrat_cb);
if (XFS_BUF_FSPRIVATE(bp, void *) != NULL) { if (XFS_BUF_FSPRIVATE(bp, void *) != NULL) {
lip = XFS_BUF_FSPRIVATE(bp, xfs_log_item_t *); lip = XFS_BUF_FSPRIVATE(bp, xfs_log_item_t *);
......
...@@ -267,21 +267,16 @@ STATIC void ...@@ -267,21 +267,16 @@ STATIC void
xlog_recover_iodone( xlog_recover_iodone(
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
xfs_mount_t *mp;
ASSERT(XFS_BUF_FSPRIVATE(bp, void *));
if (XFS_BUF_GETERROR(bp)) { if (XFS_BUF_GETERROR(bp)) {
/* /*
* We're not going to bother about retrying * We're not going to bother about retrying
* this during recovery. One strike! * this during recovery. One strike!
*/ */
mp = XFS_BUF_FSPRIVATE(bp, xfs_mount_t *);
xfs_ioerror_alert("xlog_recover_iodone", xfs_ioerror_alert("xlog_recover_iodone",
mp, bp, XFS_BUF_ADDR(bp)); bp->b_mount, bp, XFS_BUF_ADDR(bp));
xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR); xfs_force_shutdown(bp->b_mount, SHUTDOWN_META_IO_ERROR);
} }
XFS_BUF_SET_FSPRIVATE(bp, NULL); bp->b_mount = NULL;
XFS_BUF_CLR_IODONE_FUNC(bp); XFS_BUF_CLR_IODONE_FUNC(bp);
xfs_biodone(bp); xfs_biodone(bp);
} }
...@@ -2225,9 +2220,8 @@ xlog_recover_do_buffer_trans( ...@@ -2225,9 +2220,8 @@ xlog_recover_do_buffer_trans(
XFS_BUF_STALE(bp); XFS_BUF_STALE(bp);
error = xfs_bwrite(mp, bp); error = xfs_bwrite(mp, bp);
} else { } else {
ASSERT(XFS_BUF_FSPRIVATE(bp, void *) == NULL || ASSERT(bp->b_mount == NULL || bp->b_mount == mp);
XFS_BUF_FSPRIVATE(bp, xfs_mount_t *) == mp); bp->b_mount = mp;
XFS_BUF_SET_FSPRIVATE(bp, mp);
XFS_BUF_SET_IODONE_FUNC(bp, xlog_recover_iodone); XFS_BUF_SET_IODONE_FUNC(bp, xlog_recover_iodone);
xfs_bdwrite(mp, bp); xfs_bdwrite(mp, bp);
} }
...@@ -2490,9 +2484,8 @@ xlog_recover_do_inode_trans( ...@@ -2490,9 +2484,8 @@ xlog_recover_do_inode_trans(
write_inode_buffer: write_inode_buffer:
if (ITEM_TYPE(item) == XFS_LI_INODE) { if (ITEM_TYPE(item) == XFS_LI_INODE) {
ASSERT(XFS_BUF_FSPRIVATE(bp, void *) == NULL || ASSERT(bp->b_mount == NULL || bp->b_mount == mp);
XFS_BUF_FSPRIVATE(bp, xfs_mount_t *) == mp); bp->b_mount = mp;
XFS_BUF_SET_FSPRIVATE(bp, mp);
XFS_BUF_SET_IODONE_FUNC(bp, xlog_recover_iodone); XFS_BUF_SET_IODONE_FUNC(bp, xlog_recover_iodone);
xfs_bdwrite(mp, bp); xfs_bdwrite(mp, bp);
} else { } else {
...@@ -2623,9 +2616,8 @@ xlog_recover_do_dquot_trans( ...@@ -2623,9 +2616,8 @@ xlog_recover_do_dquot_trans(
memcpy(ddq, recddq, item->ri_buf[1].i_len); memcpy(ddq, recddq, item->ri_buf[1].i_len);
ASSERT(dq_f->qlf_size == 2); ASSERT(dq_f->qlf_size == 2);
ASSERT(XFS_BUF_FSPRIVATE(bp, void *) == NULL || ASSERT(bp->b_mount == NULL || bp->b_mount == mp);
XFS_BUF_FSPRIVATE(bp, xfs_mount_t *) == mp); bp->b_mount = mp;
XFS_BUF_SET_FSPRIVATE(bp, mp);
XFS_BUF_SET_IODONE_FUNC(bp, xlog_recover_iodone); XFS_BUF_SET_IODONE_FUNC(bp, xlog_recover_iodone);
xfs_bdwrite(mp, bp); xfs_bdwrite(mp, bp);
......
...@@ -406,7 +406,7 @@ xfs_bwrite( ...@@ -406,7 +406,7 @@ xfs_bwrite(
* XXXsup how does this work for quotas. * XXXsup how does this work for quotas.
*/ */
XFS_BUF_SET_BDSTRAT_FUNC(bp, xfs_bdstrat_cb); XFS_BUF_SET_BDSTRAT_FUNC(bp, xfs_bdstrat_cb);
XFS_BUF_SET_FSPRIVATE3(bp, mp); bp->b_mount = mp;
XFS_BUF_WRITE(bp); XFS_BUF_WRITE(bp);
if ((error = XFS_bwrite(bp))) { if ((error = XFS_bwrite(bp))) {
......
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