aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_log.c
diff options
context:
space:
mode:
authorMark Tinguely <tinguely@sgi.com>2012-06-14 10:22:16 -0400
committerBen Myers <bpm@sgi.com>2012-06-21 15:22:27 -0400
commit9a8d2fdbb47aaa1eaa136b89da5e5e6b60015c78 (patch)
tree32feb9af749ef07606189c93c751585efab09150 /fs/xfs/xfs_log.c
parentad223e6030be017470e46f153de27a43979759e0 (diff)
xfs: remove xlog_t typedef
Remove the xlog_t type definitions. Signed-off-by: Mark Tinguely <tinguely@sgi.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_log.c')
-rw-r--r--fs/xfs/xfs_log.c223
1 files changed, 137 insertions, 86 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index d90d4a388609..7f4f9370d0e7 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -45,51 +45,85 @@ xlog_commit_record(
45 struct xlog_in_core **iclog, 45 struct xlog_in_core **iclog,
46 xfs_lsn_t *commitlsnp); 46 xfs_lsn_t *commitlsnp);
47 47
48STATIC xlog_t * xlog_alloc_log(xfs_mount_t *mp, 48STATIC struct xlog *
49 xfs_buftarg_t *log_target, 49xlog_alloc_log(
50 xfs_daddr_t blk_offset, 50 struct xfs_mount *mp,
51 int num_bblks); 51 struct xfs_buftarg *log_target,
52 xfs_daddr_t blk_offset,
53 int num_bblks);
52STATIC int 54STATIC int
53xlog_space_left( 55xlog_space_left(
54 struct xlog *log, 56 struct xlog *log,
55 atomic64_t *head); 57 atomic64_t *head);
56STATIC int xlog_sync(xlog_t *log, xlog_in_core_t *iclog); 58STATIC int
57STATIC void xlog_dealloc_log(xlog_t *log); 59xlog_sync(
60 struct xlog *log,
61 struct xlog_in_core *iclog);
62STATIC void
63xlog_dealloc_log(
64 struct xlog *log);
58 65
59/* local state machine functions */ 66/* local state machine functions */
60STATIC void xlog_state_done_syncing(xlog_in_core_t *iclog, int); 67STATIC void xlog_state_done_syncing(xlog_in_core_t *iclog, int);
61STATIC void xlog_state_do_callback(xlog_t *log,int aborted, xlog_in_core_t *iclog); 68STATIC void
62STATIC int xlog_state_get_iclog_space(xlog_t *log, 69xlog_state_do_callback(
63 int len, 70 struct xlog *log,
64 xlog_in_core_t **iclog, 71 int aborted,
65 xlog_ticket_t *ticket, 72 struct xlog_in_core *iclog);
66 int *continued_write, 73STATIC int
67 int *logoffsetp); 74xlog_state_get_iclog_space(
68STATIC int xlog_state_release_iclog(xlog_t *log, 75 struct xlog *log,
69 xlog_in_core_t *iclog); 76 int len,
70STATIC void xlog_state_switch_iclogs(xlog_t *log, 77 struct xlog_in_core **iclog,
71 xlog_in_core_t *iclog, 78 struct xlog_ticket *ticket,
72 int eventual_size); 79 int *continued_write,
73STATIC void xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog); 80 int *logoffsetp);
81STATIC int
82xlog_state_release_iclog(
83 struct xlog *log,
84 struct xlog_in_core *iclog);
85STATIC void
86xlog_state_switch_iclogs(
87 struct xlog *log,
88 struct xlog_in_core *iclog,
89 int eventual_size);
90STATIC void
91xlog_state_want_sync(
92 struct xlog *log,
93 struct xlog_in_core *iclog);
74 94
75STATIC void 95STATIC void
76xlog_grant_push_ail( 96xlog_grant_push_ail(
77 struct xlog *log, 97 struct xlog *log,
78 int need_bytes); 98 int need_bytes);
79STATIC void xlog_regrant_reserve_log_space(xlog_t *log, 99STATIC void
80 xlog_ticket_t *ticket); 100xlog_regrant_reserve_log_space(
81STATIC void xlog_ungrant_log_space(xlog_t *log, 101 struct xlog *log,
82 xlog_ticket_t *ticket); 102 struct xlog_ticket *ticket);
103STATIC void
104xlog_ungrant_log_space(
105 struct xlog *log,
106 struct xlog_ticket *ticket);
83 107
84#if defined(DEBUG) 108#if defined(DEBUG)
85STATIC void xlog_verify_dest_ptr(xlog_t *log, char *ptr); 109STATIC void
110xlog_verify_dest_ptr(
111 struct xlog *log,
112 char *ptr);
86STATIC void 113STATIC void
87xlog_verify_grant_tail( 114xlog_verify_grant_tail(
88 struct xlog *log); 115 struct xlog *log);
89STATIC void xlog_verify_iclog(xlog_t *log, xlog_in_core_t *iclog, 116STATIC void
90 int count, boolean_t syncing); 117xlog_verify_iclog(
91STATIC void xlog_verify_tail_lsn(xlog_t *log, xlog_in_core_t *iclog, 118 struct xlog *log,
92 xfs_lsn_t tail_lsn); 119 struct xlog_in_core *iclog,
120 int count,
121 boolean_t syncing);
122STATIC void
123xlog_verify_tail_lsn(
124 struct xlog *log,
125 struct xlog_in_core *iclog,
126 xfs_lsn_t tail_lsn);
93#else 127#else
94#define xlog_verify_dest_ptr(a,b) 128#define xlog_verify_dest_ptr(a,b)
95#define xlog_verify_grant_tail(a) 129#define xlog_verify_grant_tail(a)
@@ -97,7 +131,9 @@ STATIC void xlog_verify_tail_lsn(xlog_t *log, xlog_in_core_t *iclog,
97#define xlog_verify_tail_lsn(a,b,c) 131#define xlog_verify_tail_lsn(a,b,c)
98#endif 132#endif
99 133
100STATIC int xlog_iclogs_empty(xlog_t *log); 134STATIC int
135xlog_iclogs_empty(
136 struct xlog *log);
101 137
102static void 138static void
103xlog_grant_sub_space( 139xlog_grant_sub_space(
@@ -684,7 +720,7 @@ xfs_log_mount_finish(xfs_mount_t *mp)
684int 720int
685xfs_log_unmount_write(xfs_mount_t *mp) 721xfs_log_unmount_write(xfs_mount_t *mp)
686{ 722{
687 xlog_t *log = mp->m_log; 723 struct xlog *log = mp->m_log;
688 xlog_in_core_t *iclog; 724 xlog_in_core_t *iclog;
689#ifdef DEBUG 725#ifdef DEBUG
690 xlog_in_core_t *first_iclog; 726 xlog_in_core_t *first_iclog;
@@ -893,7 +929,7 @@ int
893xfs_log_need_covered(xfs_mount_t *mp) 929xfs_log_need_covered(xfs_mount_t *mp)
894{ 930{
895 int needed = 0; 931 int needed = 0;
896 xlog_t *log = mp->m_log; 932 struct xlog *log = mp->m_log;
897 933
898 if (!xfs_fs_writable(mp)) 934 if (!xfs_fs_writable(mp))
899 return 0; 935 return 0;
@@ -1024,9 +1060,9 @@ xlog_space_left(
1024void 1060void
1025xlog_iodone(xfs_buf_t *bp) 1061xlog_iodone(xfs_buf_t *bp)
1026{ 1062{
1027 xlog_in_core_t *iclog = bp->b_fspriv; 1063 struct xlog_in_core *iclog = bp->b_fspriv;
1028 xlog_t *l = iclog->ic_log; 1064 struct xlog *l = iclog->ic_log;
1029 int aborted = 0; 1065 int aborted = 0;
1030 1066
1031 /* 1067 /*
1032 * Race to shutdown the filesystem if we see an error. 1068 * Race to shutdown the filesystem if we see an error.
@@ -1067,8 +1103,9 @@ xlog_iodone(xfs_buf_t *bp)
1067 */ 1103 */
1068 1104
1069STATIC void 1105STATIC void
1070xlog_get_iclog_buffer_size(xfs_mount_t *mp, 1106xlog_get_iclog_buffer_size(
1071 xlog_t *log) 1107 struct xfs_mount *mp,
1108 struct xlog *log)
1072{ 1109{
1073 int size; 1110 int size;
1074 int xhdrs; 1111 int xhdrs;
@@ -1129,13 +1166,14 @@ done:
1129 * Its primary purpose is to fill in enough, so recovery can occur. However, 1166 * Its primary purpose is to fill in enough, so recovery can occur. However,
1130 * some other stuff may be filled in too. 1167 * some other stuff may be filled in too.
1131 */ 1168 */
1132STATIC xlog_t * 1169STATIC struct xlog *
1133xlog_alloc_log(xfs_mount_t *mp, 1170xlog_alloc_log(
1134 xfs_buftarg_t *log_target, 1171 struct xfs_mount *mp,
1135 xfs_daddr_t blk_offset, 1172 struct xfs_buftarg *log_target,
1136 int num_bblks) 1173 xfs_daddr_t blk_offset,
1174 int num_bblks)
1137{ 1175{
1138 xlog_t *log; 1176 struct xlog *log;
1139 xlog_rec_header_t *head; 1177 xlog_rec_header_t *head;
1140 xlog_in_core_t **iclogp; 1178 xlog_in_core_t **iclogp;
1141 xlog_in_core_t *iclog, *prev_iclog=NULL; 1179 xlog_in_core_t *iclog, *prev_iclog=NULL;
@@ -1144,7 +1182,7 @@ xlog_alloc_log(xfs_mount_t *mp,
1144 int error = ENOMEM; 1182 int error = ENOMEM;
1145 uint log2_size = 0; 1183 uint log2_size = 0;
1146 1184
1147 log = kmem_zalloc(sizeof(xlog_t), KM_MAYFAIL); 1185 log = kmem_zalloc(sizeof(struct xlog), KM_MAYFAIL);
1148 if (!log) { 1186 if (!log) {
1149 xfs_warn(mp, "Log allocation failed: No memory!"); 1187 xfs_warn(mp, "Log allocation failed: No memory!");
1150 goto out; 1188 goto out;
@@ -1434,8 +1472,9 @@ xlog_bdstrat(
1434 */ 1472 */
1435 1473
1436STATIC int 1474STATIC int
1437xlog_sync(xlog_t *log, 1475xlog_sync(
1438 xlog_in_core_t *iclog) 1476 struct xlog *log,
1477 struct xlog_in_core *iclog)
1439{ 1478{
1440 xfs_caddr_t dptr; /* pointer to byte sized element */ 1479 xfs_caddr_t dptr; /* pointer to byte sized element */
1441 xfs_buf_t *bp; 1480 xfs_buf_t *bp;
@@ -1584,7 +1623,8 @@ xlog_sync(xlog_t *log,
1584 * Deallocate a log structure 1623 * Deallocate a log structure
1585 */ 1624 */
1586STATIC void 1625STATIC void
1587xlog_dealloc_log(xlog_t *log) 1626xlog_dealloc_log(
1627 struct xlog *log)
1588{ 1628{
1589 xlog_in_core_t *iclog, *next_iclog; 1629 xlog_in_core_t *iclog, *next_iclog;
1590 int i; 1630 int i;
@@ -1616,10 +1656,11 @@ xlog_dealloc_log(xlog_t *log)
1616 */ 1656 */
1617/* ARGSUSED */ 1657/* ARGSUSED */
1618static inline void 1658static inline void
1619xlog_state_finish_copy(xlog_t *log, 1659xlog_state_finish_copy(
1620 xlog_in_core_t *iclog, 1660 struct xlog *log,
1621 int record_cnt, 1661 struct xlog_in_core *iclog,
1622 int copy_bytes) 1662 int record_cnt,
1663 int copy_bytes)
1623{ 1664{
1624 spin_lock(&log->l_icloglock); 1665 spin_lock(&log->l_icloglock);
1625 1666
@@ -2142,7 +2183,8 @@ xlog_write(
2142 * State Change: DIRTY -> ACTIVE 2183 * State Change: DIRTY -> ACTIVE
2143 */ 2184 */
2144STATIC void 2185STATIC void
2145xlog_state_clean_log(xlog_t *log) 2186xlog_state_clean_log(
2187 struct xlog *log)
2146{ 2188{
2147 xlog_in_core_t *iclog; 2189 xlog_in_core_t *iclog;
2148 int changed = 0; 2190 int changed = 0;
@@ -2222,7 +2264,7 @@ xlog_state_clean_log(xlog_t *log)
2222 2264
2223STATIC xfs_lsn_t 2265STATIC xfs_lsn_t
2224xlog_get_lowest_lsn( 2266xlog_get_lowest_lsn(
2225 xlog_t *log) 2267 struct xlog *log)
2226{ 2268{
2227 xlog_in_core_t *lsn_log; 2269 xlog_in_core_t *lsn_log;
2228 xfs_lsn_t lowest_lsn, lsn; 2270 xfs_lsn_t lowest_lsn, lsn;
@@ -2245,9 +2287,9 @@ xlog_get_lowest_lsn(
2245 2287
2246STATIC void 2288STATIC void
2247xlog_state_do_callback( 2289xlog_state_do_callback(
2248 xlog_t *log, 2290 struct xlog *log,
2249 int aborted, 2291 int aborted,
2250 xlog_in_core_t *ciclog) 2292 struct xlog_in_core *ciclog)
2251{ 2293{
2252 xlog_in_core_t *iclog; 2294 xlog_in_core_t *iclog;
2253 xlog_in_core_t *first_iclog; /* used to know when we've 2295 xlog_in_core_t *first_iclog; /* used to know when we've
@@ -2467,7 +2509,7 @@ xlog_state_done_syncing(
2467 xlog_in_core_t *iclog, 2509 xlog_in_core_t *iclog,
2468 int aborted) 2510 int aborted)
2469{ 2511{
2470 xlog_t *log = iclog->ic_log; 2512 struct xlog *log = iclog->ic_log;
2471 2513
2472 spin_lock(&log->l_icloglock); 2514 spin_lock(&log->l_icloglock);
2473 2515
@@ -2521,12 +2563,13 @@ xlog_state_done_syncing(
2521 * is copied. 2563 * is copied.
2522 */ 2564 */
2523STATIC int 2565STATIC int
2524xlog_state_get_iclog_space(xlog_t *log, 2566xlog_state_get_iclog_space(
2525 int len, 2567 struct xlog *log,
2526 xlog_in_core_t **iclogp, 2568 int len,
2527 xlog_ticket_t *ticket, 2569 struct xlog_in_core **iclogp,
2528 int *continued_write, 2570 struct xlog_ticket *ticket,
2529 int *logoffsetp) 2571 int *continued_write,
2572 int *logoffsetp)
2530{ 2573{
2531 int log_offset; 2574 int log_offset;
2532 xlog_rec_header_t *head; 2575 xlog_rec_header_t *head;
@@ -2631,8 +2674,9 @@ restart:
2631 * move grant reservation head forward. 2674 * move grant reservation head forward.
2632 */ 2675 */
2633STATIC void 2676STATIC void
2634xlog_regrant_reserve_log_space(xlog_t *log, 2677xlog_regrant_reserve_log_space(
2635 xlog_ticket_t *ticket) 2678 struct xlog *log,
2679 struct xlog_ticket *ticket)
2636{ 2680{
2637 trace_xfs_log_regrant_reserve_enter(log, ticket); 2681 trace_xfs_log_regrant_reserve_enter(log, ticket);
2638 2682
@@ -2677,8 +2721,9 @@ xlog_regrant_reserve_log_space(xlog_t *log,
2677 * in the current reservation field. 2721 * in the current reservation field.
2678 */ 2722 */
2679STATIC void 2723STATIC void
2680xlog_ungrant_log_space(xlog_t *log, 2724xlog_ungrant_log_space(
2681 xlog_ticket_t *ticket) 2725 struct xlog *log,
2726 struct xlog_ticket *ticket)
2682{ 2727{
2683 int bytes; 2728 int bytes;
2684 2729
@@ -2717,8 +2762,8 @@ xlog_ungrant_log_space(xlog_t *log,
2717 */ 2762 */
2718STATIC int 2763STATIC int
2719xlog_state_release_iclog( 2764xlog_state_release_iclog(
2720 xlog_t *log, 2765 struct xlog *log,
2721 xlog_in_core_t *iclog) 2766 struct xlog_in_core *iclog)
2722{ 2767{
2723 int sync = 0; /* do we sync? */ 2768 int sync = 0; /* do we sync? */
2724 2769
@@ -2768,9 +2813,10 @@ xlog_state_release_iclog(
2768 * that every data block. We have run out of space in this log record. 2813 * that every data block. We have run out of space in this log record.
2769 */ 2814 */
2770STATIC void 2815STATIC void
2771xlog_state_switch_iclogs(xlog_t *log, 2816xlog_state_switch_iclogs(
2772 xlog_in_core_t *iclog, 2817 struct xlog *log,
2773 int eventual_size) 2818 struct xlog_in_core *iclog,
2819 int eventual_size)
2774{ 2820{
2775 ASSERT(iclog->ic_state == XLOG_STATE_ACTIVE); 2821 ASSERT(iclog->ic_state == XLOG_STATE_ACTIVE);
2776 if (!eventual_size) 2822 if (!eventual_size)
@@ -3114,7 +3160,9 @@ xfs_log_force_lsn(
3114 * disk. 3160 * disk.
3115 */ 3161 */
3116STATIC void 3162STATIC void
3117xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog) 3163xlog_state_want_sync(
3164 struct xlog *log,
3165 struct xlog_in_core *iclog)
3118{ 3166{
3119 assert_spin_locked(&log->l_icloglock); 3167 assert_spin_locked(&log->l_icloglock);
3120 3168
@@ -3158,7 +3206,7 @@ xfs_log_ticket_get(
3158/* 3206/*
3159 * Allocate and initialise a new log ticket. 3207 * Allocate and initialise a new log ticket.
3160 */ 3208 */
3161xlog_ticket_t * 3209struct xlog_ticket *
3162xlog_ticket_alloc( 3210xlog_ticket_alloc(
3163 struct xlog *log, 3211 struct xlog *log,
3164 int unit_bytes, 3212 int unit_bytes,
@@ -3346,9 +3394,10 @@ xlog_verify_grant_tail(
3346 3394
3347/* check if it will fit */ 3395/* check if it will fit */
3348STATIC void 3396STATIC void
3349xlog_verify_tail_lsn(xlog_t *log, 3397xlog_verify_tail_lsn(
3350 xlog_in_core_t *iclog, 3398 struct xlog *log,
3351 xfs_lsn_t tail_lsn) 3399 struct xlog_in_core *iclog,
3400 xfs_lsn_t tail_lsn)
3352{ 3401{
3353 int blocks; 3402 int blocks;
3354 3403
@@ -3385,10 +3434,11 @@ xlog_verify_tail_lsn(xlog_t *log,
3385 * the cycle numbers agree with the current cycle number. 3434 * the cycle numbers agree with the current cycle number.
3386 */ 3435 */
3387STATIC void 3436STATIC void
3388xlog_verify_iclog(xlog_t *log, 3437xlog_verify_iclog(
3389 xlog_in_core_t *iclog, 3438 struct xlog *log,
3390 int count, 3439 struct xlog_in_core *iclog,
3391 boolean_t syncing) 3440 int count,
3441 boolean_t syncing)
3392{ 3442{
3393 xlog_op_header_t *ophead; 3443 xlog_op_header_t *ophead;
3394 xlog_in_core_t *icptr; 3444 xlog_in_core_t *icptr;
@@ -3482,7 +3532,7 @@ xlog_verify_iclog(xlog_t *log,
3482 */ 3532 */
3483STATIC int 3533STATIC int
3484xlog_state_ioerror( 3534xlog_state_ioerror(
3485 xlog_t *log) 3535 struct xlog *log)
3486{ 3536{
3487 xlog_in_core_t *iclog, *ic; 3537 xlog_in_core_t *iclog, *ic;
3488 3538
@@ -3527,7 +3577,7 @@ xfs_log_force_umount(
3527 struct xfs_mount *mp, 3577 struct xfs_mount *mp,
3528 int logerror) 3578 int logerror)
3529{ 3579{
3530 xlog_t *log; 3580 struct xlog *log;
3531 int retval; 3581 int retval;
3532 3582
3533 log = mp->m_log; 3583 log = mp->m_log;
@@ -3634,7 +3684,8 @@ xfs_log_force_umount(
3634} 3684}
3635 3685
3636STATIC int 3686STATIC int
3637xlog_iclogs_empty(xlog_t *log) 3687xlog_iclogs_empty(
3688 struct xlog *log)
3638{ 3689{
3639 xlog_in_core_t *iclog; 3690 xlog_in_core_t *iclog;
3640 3691