Commit 35a8a72f authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Alex Elder

xfs: stop passing opaque handles to xfs_log.c routines

Currenly we pass opaque xfs_log_ticket_t handles instead of
struct xlog_ticket pointers, and void pointers instead of
struct xlog_in_core pointers to various log manager functions.
Instead pass properly typed pointers after adding forward
declarations for them to xfs_log.h, and adjust the touched
function prototypes to the standard XFS style while at it.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <david@fromorbit.com>
Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
parent c467c049
...@@ -60,7 +60,7 @@ STATIC int xlog_space_left(xlog_t *log, int cycle, int bytes); ...@@ -60,7 +60,7 @@ STATIC int xlog_space_left(xlog_t *log, int cycle, int bytes);
STATIC int xlog_sync(xlog_t *log, xlog_in_core_t *iclog); STATIC int xlog_sync(xlog_t *log, xlog_in_core_t *iclog);
STATIC void xlog_dealloc_log(xlog_t *log); STATIC void xlog_dealloc_log(xlog_t *log);
STATIC int xlog_write(xfs_mount_t *mp, xfs_log_iovec_t region[], STATIC int xlog_write(xfs_mount_t *mp, xfs_log_iovec_t region[],
int nentries, xfs_log_ticket_t tic, int nentries, struct xlog_ticket *tic,
xfs_lsn_t *start_lsn, xfs_lsn_t *start_lsn,
xlog_in_core_t **commit_iclog, xlog_in_core_t **commit_iclog,
uint flags); uint flags);
...@@ -243,14 +243,14 @@ xlog_tic_add_region(xlog_ticket_t *tic, uint len, uint type) ...@@ -243,14 +243,14 @@ xlog_tic_add_region(xlog_ticket_t *tic, uint len, uint type)
* out when the next write occurs. * out when the next write occurs.
*/ */
xfs_lsn_t xfs_lsn_t
xfs_log_done(xfs_mount_t *mp, xfs_log_done(
xfs_log_ticket_t xtic, struct xfs_mount *mp,
void **iclog, struct xlog_ticket *ticket,
uint flags) struct xlog_in_core **iclog,
uint flags)
{ {
xlog_t *log = mp->m_log; struct log *log = mp->m_log;
xlog_ticket_t *ticket = (xfs_log_ticket_t) xtic; xfs_lsn_t lsn = 0;
xfs_lsn_t lsn = 0;
if (XLOG_FORCED_SHUTDOWN(log) || if (XLOG_FORCED_SHUTDOWN(log) ||
/* /*
...@@ -258,8 +258,7 @@ xfs_log_done(xfs_mount_t *mp, ...@@ -258,8 +258,7 @@ xfs_log_done(xfs_mount_t *mp,
* If we get an error, just continue and give back the log ticket. * If we get an error, just continue and give back the log ticket.
*/ */
(((ticket->t_flags & XLOG_TIC_INITED) == 0) && (((ticket->t_flags & XLOG_TIC_INITED) == 0) &&
(xlog_commit_record(mp, ticket, (xlog_commit_record(mp, ticket, iclog, &lsn)))) {
(xlog_in_core_t **)iclog, &lsn)))) {
lsn = (xfs_lsn_t) -1; lsn = (xfs_lsn_t) -1;
if (ticket->t_flags & XLOG_TIC_PERM_RESERV) { if (ticket->t_flags & XLOG_TIC_PERM_RESERV) {
flags |= XFS_LOG_REL_PERM_RESERV; flags |= XFS_LOG_REL_PERM_RESERV;
...@@ -289,7 +288,7 @@ xfs_log_done(xfs_mount_t *mp, ...@@ -289,7 +288,7 @@ xfs_log_done(xfs_mount_t *mp,
} }
return lsn; return lsn;
} /* xfs_log_done */ }
/* /*
* Attaches a new iclog I/O completion callback routine during * Attaches a new iclog I/O completion callback routine during
...@@ -298,11 +297,11 @@ xfs_log_done(xfs_mount_t *mp, ...@@ -298,11 +297,11 @@ xfs_log_done(xfs_mount_t *mp,
* executing the callback at an appropriate time. * executing the callback at an appropriate time.
*/ */
int int
xfs_log_notify(xfs_mount_t *mp, /* mount of partition */ xfs_log_notify(
void *iclog_hndl, /* iclog to hang callback off */ struct xfs_mount *mp,
xfs_log_callback_t *cb) struct xlog_in_core *iclog,
xfs_log_callback_t *cb)
{ {
xlog_in_core_t *iclog = (xlog_in_core_t *)iclog_hndl;
int abortflg; int abortflg;
spin_lock(&iclog->ic_callback_lock); spin_lock(&iclog->ic_callback_lock);
...@@ -316,16 +315,14 @@ xfs_log_notify(xfs_mount_t *mp, /* mount of partition */ ...@@ -316,16 +315,14 @@ xfs_log_notify(xfs_mount_t *mp, /* mount of partition */
} }
spin_unlock(&iclog->ic_callback_lock); spin_unlock(&iclog->ic_callback_lock);
return abortflg; return abortflg;
} /* xfs_log_notify */ }
int int
xfs_log_release_iclog(xfs_mount_t *mp, xfs_log_release_iclog(
void *iclog_hndl) struct xfs_mount *mp,
struct xlog_in_core *iclog)
{ {
xlog_t *log = mp->m_log; if (xlog_state_release_iclog(mp->m_log, iclog)) {
xlog_in_core_t *iclog = (xlog_in_core_t *)iclog_hndl;
if (xlog_state_release_iclog(log, iclog)) {
xfs_force_shutdown(mp, SHUTDOWN_LOG_IO_ERROR); xfs_force_shutdown(mp, SHUTDOWN_LOG_IO_ERROR);
return EIO; return EIO;
} }
...@@ -344,17 +341,18 @@ xfs_log_release_iclog(xfs_mount_t *mp, ...@@ -344,17 +341,18 @@ xfs_log_release_iclog(xfs_mount_t *mp,
* reservation, we prevent over allocation problems. * reservation, we prevent over allocation problems.
*/ */
int int
xfs_log_reserve(xfs_mount_t *mp, xfs_log_reserve(
int unit_bytes, struct xfs_mount *mp,
int cnt, int unit_bytes,
xfs_log_ticket_t *ticket, int cnt,
__uint8_t client, struct xlog_ticket **ticket,
uint flags, __uint8_t client,
uint t_type) uint flags,
uint t_type)
{ {
xlog_t *log = mp->m_log; struct log *log = mp->m_log;
xlog_ticket_t *internal_ticket; struct xlog_ticket *internal_ticket;
int retval = 0; int retval = 0;
ASSERT(client == XFS_TRANSACTION || client == XFS_LOG); ASSERT(client == XFS_TRANSACTION || client == XFS_LOG);
ASSERT((flags & XFS_LOG_NOSLEEP) == 0); ASSERT((flags & XFS_LOG_NOSLEEP) == 0);
...@@ -367,7 +365,7 @@ xfs_log_reserve(xfs_mount_t *mp, ...@@ -367,7 +365,7 @@ xfs_log_reserve(xfs_mount_t *mp,
if (*ticket != NULL) { if (*ticket != NULL) {
ASSERT(flags & XFS_LOG_PERM_RESERV); ASSERT(flags & XFS_LOG_PERM_RESERV);
internal_ticket = (xlog_ticket_t *)*ticket; internal_ticket = *ticket;
trace_xfs_log_reserve(log, internal_ticket); trace_xfs_log_reserve(log, internal_ticket);
...@@ -519,7 +517,7 @@ xfs_log_unmount_write(xfs_mount_t *mp) ...@@ -519,7 +517,7 @@ xfs_log_unmount_write(xfs_mount_t *mp)
xlog_in_core_t *first_iclog; xlog_in_core_t *first_iclog;
#endif #endif
xfs_log_iovec_t reg[1]; xfs_log_iovec_t reg[1];
xfs_log_ticket_t tic = NULL; xlog_ticket_t *tic = NULL;
xfs_lsn_t lsn; xfs_lsn_t lsn;
int error; int error;
...@@ -656,24 +654,24 @@ xfs_log_unmount(xfs_mount_t *mp) ...@@ -656,24 +654,24 @@ xfs_log_unmount(xfs_mount_t *mp)
* transaction occur with one call to xfs_log_write(). * transaction occur with one call to xfs_log_write().
*/ */
int int
xfs_log_write(xfs_mount_t * mp, xfs_log_write(
xfs_log_iovec_t reg[], struct xfs_mount *mp,
int nentries, struct xfs_log_iovec reg[],
xfs_log_ticket_t tic, int nentries,
xfs_lsn_t *start_lsn) struct xlog_ticket *tic,
xfs_lsn_t *start_lsn)
{ {
int error; struct log *log = mp->m_log;
xlog_t *log = mp->m_log; int error;
if (XLOG_FORCED_SHUTDOWN(log)) if (XLOG_FORCED_SHUTDOWN(log))
return XFS_ERROR(EIO); return XFS_ERROR(EIO);
if ((error = xlog_write(mp, reg, nentries, tic, start_lsn, NULL, 0))) { error = xlog_write(mp, reg, nentries, tic, start_lsn, NULL, 0);
if (error)
xfs_force_shutdown(mp, SHUTDOWN_LOG_IO_ERROR); xfs_force_shutdown(mp, SHUTDOWN_LOG_IO_ERROR);
}
return error; return error;
} /* xfs_log_write */ }
void void
xfs_log_move_tail(xfs_mount_t *mp, xfs_log_move_tail(xfs_mount_t *mp,
...@@ -1642,16 +1640,16 @@ xlog_print_tic_res(xfs_mount_t *mp, xlog_ticket_t *ticket) ...@@ -1642,16 +1640,16 @@ xlog_print_tic_res(xfs_mount_t *mp, xlog_ticket_t *ticket)
* bytes have been written out. * bytes have been written out.
*/ */
STATIC int STATIC int
xlog_write(xfs_mount_t * mp, xlog_write(
xfs_log_iovec_t reg[], struct xfs_mount *mp,
int nentries, struct xfs_log_iovec reg[],
xfs_log_ticket_t tic, int nentries,
xfs_lsn_t *start_lsn, struct xlog_ticket *ticket,
xlog_in_core_t **commit_iclog, xfs_lsn_t *start_lsn,
uint flags) struct xlog_in_core **commit_iclog,
uint flags)
{ {
xlog_t *log = mp->m_log; xlog_t *log = mp->m_log;
xlog_ticket_t *ticket = (xlog_ticket_t *)tic;
xlog_in_core_t *iclog = NULL; /* ptr to current in-core log */ xlog_in_core_t *iclog = NULL; /* ptr to current in-core log */
xlog_op_header_t *logop_head; /* ptr to log operation header */ xlog_op_header_t *logop_head; /* ptr to log operation header */
__psint_t ptr; /* copy address into data region */ __psint_t ptr; /* copy address into data region */
...@@ -1765,7 +1763,7 @@ xlog_write(xfs_mount_t * mp, ...@@ -1765,7 +1763,7 @@ xlog_write(xfs_mount_t * mp,
default: default:
xfs_fs_cmn_err(CE_WARN, mp, xfs_fs_cmn_err(CE_WARN, mp,
"Bad XFS transaction clientid 0x%x in ticket 0x%p", "Bad XFS transaction clientid 0x%x in ticket 0x%p",
logop_head->oh_clientid, tic); logop_head->oh_clientid, ticket);
return XFS_ERROR(EIO); return XFS_ERROR(EIO);
} }
......
...@@ -110,8 +110,6 @@ typedef struct xfs_log_iovec { ...@@ -110,8 +110,6 @@ typedef struct xfs_log_iovec {
uint i_type; /* type of region */ uint i_type; /* type of region */
} xfs_log_iovec_t; } xfs_log_iovec_t;
typedef void* xfs_log_ticket_t;
/* /*
* Structure used to pass callback function and the function's argument * Structure used to pass callback function and the function's argument
* to the log manager. * to the log manager.
...@@ -126,10 +124,12 @@ typedef struct xfs_log_callback { ...@@ -126,10 +124,12 @@ typedef struct xfs_log_callback {
#ifdef __KERNEL__ #ifdef __KERNEL__
/* Log manager interfaces */ /* Log manager interfaces */
struct xfs_mount; struct xfs_mount;
struct xlog_in_core;
struct xlog_ticket; struct xlog_ticket;
xfs_lsn_t xfs_log_done(struct xfs_mount *mp, xfs_lsn_t xfs_log_done(struct xfs_mount *mp,
xfs_log_ticket_t ticket, struct xlog_ticket *ticket,
void **iclog, struct xlog_in_core **iclog,
uint flags); uint flags);
int _xfs_log_force(struct xfs_mount *mp, int _xfs_log_force(struct xfs_mount *mp,
uint flags, uint flags,
...@@ -151,21 +151,21 @@ int xfs_log_mount_finish(struct xfs_mount *mp); ...@@ -151,21 +151,21 @@ int xfs_log_mount_finish(struct xfs_mount *mp);
void xfs_log_move_tail(struct xfs_mount *mp, void xfs_log_move_tail(struct xfs_mount *mp,
xfs_lsn_t tail_lsn); xfs_lsn_t tail_lsn);
int xfs_log_notify(struct xfs_mount *mp, int xfs_log_notify(struct xfs_mount *mp,
void *iclog, struct xlog_in_core *iclog,
xfs_log_callback_t *callback_entry); xfs_log_callback_t *callback_entry);
int xfs_log_release_iclog(struct xfs_mount *mp, int xfs_log_release_iclog(struct xfs_mount *mp,
void *iclog_hndl); struct xlog_in_core *iclog);
int xfs_log_reserve(struct xfs_mount *mp, int xfs_log_reserve(struct xfs_mount *mp,
int length, int length,
int count, int count,
xfs_log_ticket_t *ticket, struct xlog_ticket **ticket,
__uint8_t clientid, __uint8_t clientid,
uint flags, uint flags,
uint t_type); uint t_type);
int xfs_log_write(struct xfs_mount *mp, int xfs_log_write(struct xfs_mount *mp,
xfs_log_iovec_t region[], xfs_log_iovec_t region[],
int nentries, int nentries,
xfs_log_ticket_t ticket, struct xlog_ticket *ticket,
xfs_lsn_t *start_lsn); xfs_lsn_t *start_lsn);
int xfs_log_unmount_write(struct xfs_mount *mp); int xfs_log_unmount_write(struct xfs_mount *mp);
void xfs_log_unmount(struct xfs_mount *mp); void xfs_log_unmount(struct xfs_mount *mp);
......
...@@ -796,7 +796,7 @@ _xfs_trans_commit( ...@@ -796,7 +796,7 @@ _xfs_trans_commit(
int sync; int sync;
#define XFS_TRANS_LOGVEC_COUNT 16 #define XFS_TRANS_LOGVEC_COUNT 16
xfs_log_iovec_t log_vector_fast[XFS_TRANS_LOGVEC_COUNT]; xfs_log_iovec_t log_vector_fast[XFS_TRANS_LOGVEC_COUNT];
void *commit_iclog; struct xlog_in_core *commit_iclog;
int shutdown; int shutdown;
commit_lsn = -1; commit_lsn = -1;
......
...@@ -910,7 +910,7 @@ typedef struct xfs_trans { ...@@ -910,7 +910,7 @@ typedef struct xfs_trans {
unsigned int t_blk_res_used; /* # of resvd blocks used */ unsigned int t_blk_res_used; /* # of resvd blocks used */
unsigned int t_rtx_res; /* # of rt extents resvd */ unsigned int t_rtx_res; /* # of rt extents resvd */
unsigned int t_rtx_res_used; /* # of resvd rt extents used */ unsigned int t_rtx_res_used; /* # of resvd rt extents used */
xfs_log_ticket_t t_ticket; /* log mgr ticket */ struct xlog_ticket *t_ticket; /* log mgr ticket */
xfs_lsn_t t_lsn; /* log seq num of start of xfs_lsn_t t_lsn; /* log seq num of start of
* transaction. */ * transaction. */
xfs_lsn_t t_commit_lsn; /* log seq num of end of xfs_lsn_t t_commit_lsn; /* log seq num of end of
......
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