aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-02-15 18:34:54 -0500
committerAlex Elder <aelder@sgi.com>2010-03-01 17:35:32 -0500
commit35a8a72f064105807b091a21e004893b219c9ed2 (patch)
treeb66a96b476f93f0e97b7e4c2e2bb2f91cf683fbb /fs
parentc467c049e7e6e8b8fe9f38b13b20a4cf7e03f36b (diff)
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: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <david@fromorbit.com> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_log.c106
-rw-r--r--fs/xfs/xfs_log.h16
-rw-r--r--fs/xfs/xfs_trans.c2
-rw-r--r--fs/xfs/xfs_trans.h2
4 files changed, 62 insertions, 64 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 4f16be4b6ee5..e8fba92d7cd9 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -60,7 +60,7 @@ STATIC int xlog_space_left(xlog_t *log, int cycle, int bytes);
60STATIC int xlog_sync(xlog_t *log, xlog_in_core_t *iclog); 60STATIC int xlog_sync(xlog_t *log, xlog_in_core_t *iclog);
61STATIC void xlog_dealloc_log(xlog_t *log); 61STATIC void xlog_dealloc_log(xlog_t *log);
62STATIC int xlog_write(xfs_mount_t *mp, xfs_log_iovec_t region[], 62STATIC int xlog_write(xfs_mount_t *mp, xfs_log_iovec_t region[],
63 int nentries, xfs_log_ticket_t tic, 63 int nentries, struct xlog_ticket *tic,
64 xfs_lsn_t *start_lsn, 64 xfs_lsn_t *start_lsn,
65 xlog_in_core_t **commit_iclog, 65 xlog_in_core_t **commit_iclog,
66 uint flags); 66 uint flags);
@@ -243,14 +243,14 @@ xlog_tic_add_region(xlog_ticket_t *tic, uint len, uint type)
243 * out when the next write occurs. 243 * out when the next write occurs.
244 */ 244 */
245xfs_lsn_t 245xfs_lsn_t
246xfs_log_done(xfs_mount_t *mp, 246xfs_log_done(
247 xfs_log_ticket_t xtic, 247 struct xfs_mount *mp,
248 void **iclog, 248 struct xlog_ticket *ticket,
249 uint flags) 249 struct xlog_in_core **iclog,
250 uint flags)
250{ 251{
251 xlog_t *log = mp->m_log; 252 struct log *log = mp->m_log;
252 xlog_ticket_t *ticket = (xfs_log_ticket_t) xtic; 253 xfs_lsn_t lsn = 0;
253 xfs_lsn_t lsn = 0;
254 254
255 if (XLOG_FORCED_SHUTDOWN(log) || 255 if (XLOG_FORCED_SHUTDOWN(log) ||
256 /* 256 /*
@@ -258,8 +258,7 @@ xfs_log_done(xfs_mount_t *mp,
258 * If we get an error, just continue and give back the log ticket. 258 * If we get an error, just continue and give back the log ticket.
259 */ 259 */
260 (((ticket->t_flags & XLOG_TIC_INITED) == 0) && 260 (((ticket->t_flags & XLOG_TIC_INITED) == 0) &&
261 (xlog_commit_record(mp, ticket, 261 (xlog_commit_record(mp, ticket, iclog, &lsn)))) {
262 (xlog_in_core_t **)iclog, &lsn)))) {
263 lsn = (xfs_lsn_t) -1; 262 lsn = (xfs_lsn_t) -1;
264 if (ticket->t_flags & XLOG_TIC_PERM_RESERV) { 263 if (ticket->t_flags & XLOG_TIC_PERM_RESERV) {
265 flags |= XFS_LOG_REL_PERM_RESERV; 264 flags |= XFS_LOG_REL_PERM_RESERV;
@@ -289,7 +288,7 @@ xfs_log_done(xfs_mount_t *mp,
289 } 288 }
290 289
291 return lsn; 290 return lsn;
292} /* xfs_log_done */ 291}
293 292
294/* 293/*
295 * Attaches a new iclog I/O completion callback routine during 294 * Attaches a new iclog I/O completion callback routine during
@@ -298,11 +297,11 @@ xfs_log_done(xfs_mount_t *mp,
298 * executing the callback at an appropriate time. 297 * executing the callback at an appropriate time.
299 */ 298 */
300int 299int
301xfs_log_notify(xfs_mount_t *mp, /* mount of partition */ 300xfs_log_notify(
302 void *iclog_hndl, /* iclog to hang callback off */ 301 struct xfs_mount *mp,
303 xfs_log_callback_t *cb) 302 struct xlog_in_core *iclog,
303 xfs_log_callback_t *cb)
304{ 304{
305 xlog_in_core_t *iclog = (xlog_in_core_t *)iclog_hndl;
306 int abortflg; 305 int abortflg;
307 306
308 spin_lock(&iclog->ic_callback_lock); 307 spin_lock(&iclog->ic_callback_lock);
@@ -316,16 +315,14 @@ xfs_log_notify(xfs_mount_t *mp, /* mount of partition */
316 } 315 }
317 spin_unlock(&iclog->ic_callback_lock); 316 spin_unlock(&iclog->ic_callback_lock);
318 return abortflg; 317 return abortflg;
319} /* xfs_log_notify */ 318}
320 319
321int 320int
322xfs_log_release_iclog(xfs_mount_t *mp, 321xfs_log_release_iclog(
323 void *iclog_hndl) 322 struct xfs_mount *mp,
323 struct xlog_in_core *iclog)
324{ 324{
325 xlog_t *log = mp->m_log; 325 if (xlog_state_release_iclog(mp->m_log, iclog)) {
326 xlog_in_core_t *iclog = (xlog_in_core_t *)iclog_hndl;
327
328 if (xlog_state_release_iclog(log, iclog)) {
329 xfs_force_shutdown(mp, SHUTDOWN_LOG_IO_ERROR); 326 xfs_force_shutdown(mp, SHUTDOWN_LOG_IO_ERROR);
330 return EIO; 327 return EIO;
331 } 328 }
@@ -344,17 +341,18 @@ xfs_log_release_iclog(xfs_mount_t *mp,
344 * reservation, we prevent over allocation problems. 341 * reservation, we prevent over allocation problems.
345 */ 342 */
346int 343int
347xfs_log_reserve(xfs_mount_t *mp, 344xfs_log_reserve(
348 int unit_bytes, 345 struct xfs_mount *mp,
349 int cnt, 346 int unit_bytes,
350 xfs_log_ticket_t *ticket, 347 int cnt,
351 __uint8_t client, 348 struct xlog_ticket **ticket,
352 uint flags, 349 __uint8_t client,
353 uint t_type) 350 uint flags,
351 uint t_type)
354{ 352{
355 xlog_t *log = mp->m_log; 353 struct log *log = mp->m_log;
356 xlog_ticket_t *internal_ticket; 354 struct xlog_ticket *internal_ticket;
357 int retval = 0; 355 int retval = 0;
358 356
359 ASSERT(client == XFS_TRANSACTION || client == XFS_LOG); 357 ASSERT(client == XFS_TRANSACTION || client == XFS_LOG);
360 ASSERT((flags & XFS_LOG_NOSLEEP) == 0); 358 ASSERT((flags & XFS_LOG_NOSLEEP) == 0);
@@ -367,7 +365,7 @@ xfs_log_reserve(xfs_mount_t *mp,
367 365
368 if (*ticket != NULL) { 366 if (*ticket != NULL) {
369 ASSERT(flags & XFS_LOG_PERM_RESERV); 367 ASSERT(flags & XFS_LOG_PERM_RESERV);
370 internal_ticket = (xlog_ticket_t *)*ticket; 368 internal_ticket = *ticket;
371 369
372 trace_xfs_log_reserve(log, internal_ticket); 370 trace_xfs_log_reserve(log, internal_ticket);
373 371
@@ -519,7 +517,7 @@ xfs_log_unmount_write(xfs_mount_t *mp)
519 xlog_in_core_t *first_iclog; 517 xlog_in_core_t *first_iclog;
520#endif 518#endif
521 xfs_log_iovec_t reg[1]; 519 xfs_log_iovec_t reg[1];
522 xfs_log_ticket_t tic = NULL; 520 xlog_ticket_t *tic = NULL;
523 xfs_lsn_t lsn; 521 xfs_lsn_t lsn;
524 int error; 522 int error;
525 523
@@ -656,24 +654,24 @@ xfs_log_unmount(xfs_mount_t *mp)
656 * transaction occur with one call to xfs_log_write(). 654 * transaction occur with one call to xfs_log_write().
657 */ 655 */
658int 656int
659xfs_log_write(xfs_mount_t * mp, 657xfs_log_write(
660 xfs_log_iovec_t reg[], 658 struct xfs_mount *mp,
661 int nentries, 659 struct xfs_log_iovec reg[],
662 xfs_log_ticket_t tic, 660 int nentries,
663 xfs_lsn_t *start_lsn) 661 struct xlog_ticket *tic,
662 xfs_lsn_t *start_lsn)
664{ 663{
665 int error; 664 struct log *log = mp->m_log;
666 xlog_t *log = mp->m_log; 665 int error;
667 666
668 if (XLOG_FORCED_SHUTDOWN(log)) 667 if (XLOG_FORCED_SHUTDOWN(log))
669 return XFS_ERROR(EIO); 668 return XFS_ERROR(EIO);
670 669
671 if ((error = xlog_write(mp, reg, nentries, tic, start_lsn, NULL, 0))) { 670 error = xlog_write(mp, reg, nentries, tic, start_lsn, NULL, 0);
671 if (error)
672 xfs_force_shutdown(mp, SHUTDOWN_LOG_IO_ERROR); 672 xfs_force_shutdown(mp, SHUTDOWN_LOG_IO_ERROR);
673 }
674 return error; 673 return error;
675} /* xfs_log_write */ 674}
676
677 675
678void 676void
679xfs_log_move_tail(xfs_mount_t *mp, 677xfs_log_move_tail(xfs_mount_t *mp,
@@ -1642,16 +1640,16 @@ xlog_print_tic_res(xfs_mount_t *mp, xlog_ticket_t *ticket)
1642 * bytes have been written out. 1640 * bytes have been written out.
1643 */ 1641 */
1644STATIC int 1642STATIC int
1645xlog_write(xfs_mount_t * mp, 1643xlog_write(
1646 xfs_log_iovec_t reg[], 1644 struct xfs_mount *mp,
1647 int nentries, 1645 struct xfs_log_iovec reg[],
1648 xfs_log_ticket_t tic, 1646 int nentries,
1649 xfs_lsn_t *start_lsn, 1647 struct xlog_ticket *ticket,
1650 xlog_in_core_t **commit_iclog, 1648 xfs_lsn_t *start_lsn,
1651 uint flags) 1649 struct xlog_in_core **commit_iclog,
1650 uint flags)
1652{ 1651{
1653 xlog_t *log = mp->m_log; 1652 xlog_t *log = mp->m_log;
1654 xlog_ticket_t *ticket = (xlog_ticket_t *)tic;
1655 xlog_in_core_t *iclog = NULL; /* ptr to current in-core log */ 1653 xlog_in_core_t *iclog = NULL; /* ptr to current in-core log */
1656 xlog_op_header_t *logop_head; /* ptr to log operation header */ 1654 xlog_op_header_t *logop_head; /* ptr to log operation header */
1657 __psint_t ptr; /* copy address into data region */ 1655 __psint_t ptr; /* copy address into data region */
@@ -1765,7 +1763,7 @@ xlog_write(xfs_mount_t * mp,
1765 default: 1763 default:
1766 xfs_fs_cmn_err(CE_WARN, mp, 1764 xfs_fs_cmn_err(CE_WARN, mp,
1767 "Bad XFS transaction clientid 0x%x in ticket 0x%p", 1765 "Bad XFS transaction clientid 0x%x in ticket 0x%p",
1768 logop_head->oh_clientid, tic); 1766 logop_head->oh_clientid, ticket);
1769 return XFS_ERROR(EIO); 1767 return XFS_ERROR(EIO);
1770 } 1768 }
1771 1769
diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h
index 7074be9d13e9..97a24c7795a4 100644
--- a/fs/xfs/xfs_log.h
+++ b/fs/xfs/xfs_log.h
@@ -110,8 +110,6 @@ typedef struct xfs_log_iovec {
110 uint i_type; /* type of region */ 110 uint i_type; /* type of region */
111} xfs_log_iovec_t; 111} xfs_log_iovec_t;
112 112
113typedef void* xfs_log_ticket_t;
114
115/* 113/*
116 * Structure used to pass callback function and the function's argument 114 * Structure used to pass callback function and the function's argument
117 * to the log manager. 115 * to the log manager.
@@ -126,10 +124,12 @@ typedef struct xfs_log_callback {
126#ifdef __KERNEL__ 124#ifdef __KERNEL__
127/* Log manager interfaces */ 125/* Log manager interfaces */
128struct xfs_mount; 126struct xfs_mount;
127struct xlog_in_core;
129struct xlog_ticket; 128struct xlog_ticket;
129
130xfs_lsn_t xfs_log_done(struct xfs_mount *mp, 130xfs_lsn_t xfs_log_done(struct xfs_mount *mp,
131 xfs_log_ticket_t ticket, 131 struct xlog_ticket *ticket,
132 void **iclog, 132 struct xlog_in_core **iclog,
133 uint flags); 133 uint flags);
134int _xfs_log_force(struct xfs_mount *mp, 134int _xfs_log_force(struct xfs_mount *mp,
135 uint flags, 135 uint flags,
@@ -151,21 +151,21 @@ int xfs_log_mount_finish(struct xfs_mount *mp);
151void xfs_log_move_tail(struct xfs_mount *mp, 151void xfs_log_move_tail(struct xfs_mount *mp,
152 xfs_lsn_t tail_lsn); 152 xfs_lsn_t tail_lsn);
153int xfs_log_notify(struct xfs_mount *mp, 153int xfs_log_notify(struct xfs_mount *mp,
154 void *iclog, 154 struct xlog_in_core *iclog,
155 xfs_log_callback_t *callback_entry); 155 xfs_log_callback_t *callback_entry);
156int xfs_log_release_iclog(struct xfs_mount *mp, 156int xfs_log_release_iclog(struct xfs_mount *mp,
157 void *iclog_hndl); 157 struct xlog_in_core *iclog);
158int xfs_log_reserve(struct xfs_mount *mp, 158int xfs_log_reserve(struct xfs_mount *mp,
159 int length, 159 int length,
160 int count, 160 int count,
161 xfs_log_ticket_t *ticket, 161 struct xlog_ticket **ticket,
162 __uint8_t clientid, 162 __uint8_t clientid,
163 uint flags, 163 uint flags,
164 uint t_type); 164 uint t_type);
165int xfs_log_write(struct xfs_mount *mp, 165int xfs_log_write(struct xfs_mount *mp,
166 xfs_log_iovec_t region[], 166 xfs_log_iovec_t region[],
167 int nentries, 167 int nentries,
168 xfs_log_ticket_t ticket, 168 struct xlog_ticket *ticket,
169 xfs_lsn_t *start_lsn); 169 xfs_lsn_t *start_lsn);
170int xfs_log_unmount_write(struct xfs_mount *mp); 170int xfs_log_unmount_write(struct xfs_mount *mp);
171void xfs_log_unmount(struct xfs_mount *mp); 171void xfs_log_unmount(struct xfs_mount *mp);
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index be942d4e3324..f73e358bae8d 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -796,7 +796,7 @@ _xfs_trans_commit(
796 int sync; 796 int sync;
797#define XFS_TRANS_LOGVEC_COUNT 16 797#define XFS_TRANS_LOGVEC_COUNT 16
798 xfs_log_iovec_t log_vector_fast[XFS_TRANS_LOGVEC_COUNT]; 798 xfs_log_iovec_t log_vector_fast[XFS_TRANS_LOGVEC_COUNT];
799 void *commit_iclog; 799 struct xlog_in_core *commit_iclog;
800 int shutdown; 800 int shutdown;
801 801
802 commit_lsn = -1; 802 commit_lsn = -1;
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index c93e3a102857..79c8bab9dfff 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -910,7 +910,7 @@ typedef struct xfs_trans {
910 unsigned int t_blk_res_used; /* # of resvd blocks used */ 910 unsigned int t_blk_res_used; /* # of resvd blocks used */
911 unsigned int t_rtx_res; /* # of rt extents resvd */ 911 unsigned int t_rtx_res; /* # of rt extents resvd */
912 unsigned int t_rtx_res_used; /* # of resvd rt extents used */ 912 unsigned int t_rtx_res_used; /* # of resvd rt extents used */
913 xfs_log_ticket_t t_ticket; /* log mgr ticket */ 913 struct xlog_ticket *t_ticket; /* log mgr ticket */
914 xfs_lsn_t t_lsn; /* log seq num of start of 914 xfs_lsn_t t_lsn; /* log seq num of start of
915 * transaction. */ 915 * transaction. */
916 xfs_lsn_t t_commit_lsn; /* log seq num of end of 916 xfs_lsn_t t_commit_lsn; /* log seq num of end of