aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_log.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_log.c')
-rw-r--r--fs/xfs/xfs_log.c76
1 files changed, 44 insertions, 32 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 0e1a64f0439c..d90d4a388609 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -38,13 +38,21 @@
38kmem_zone_t *xfs_log_ticket_zone; 38kmem_zone_t *xfs_log_ticket_zone;
39 39
40/* Local miscellaneous function prototypes */ 40/* Local miscellaneous function prototypes */
41STATIC int xlog_commit_record(struct log *log, struct xlog_ticket *ticket, 41STATIC int
42 xlog_in_core_t **, xfs_lsn_t *); 42xlog_commit_record(
43 struct xlog *log,
44 struct xlog_ticket *ticket,
45 struct xlog_in_core **iclog,
46 xfs_lsn_t *commitlsnp);
47
43STATIC xlog_t * xlog_alloc_log(xfs_mount_t *mp, 48STATIC xlog_t * xlog_alloc_log(xfs_mount_t *mp,
44 xfs_buftarg_t *log_target, 49 xfs_buftarg_t *log_target,
45 xfs_daddr_t blk_offset, 50 xfs_daddr_t blk_offset,
46 int num_bblks); 51 int num_bblks);
47STATIC int xlog_space_left(struct log *log, atomic64_t *head); 52STATIC int
53xlog_space_left(
54 struct xlog *log,
55 atomic64_t *head);
48STATIC int xlog_sync(xlog_t *log, xlog_in_core_t *iclog); 56STATIC int xlog_sync(xlog_t *log, xlog_in_core_t *iclog);
49STATIC void xlog_dealloc_log(xlog_t *log); 57STATIC void xlog_dealloc_log(xlog_t *log);
50 58
@@ -64,8 +72,10 @@ STATIC void xlog_state_switch_iclogs(xlog_t *log,
64 int eventual_size); 72 int eventual_size);
65STATIC void xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog); 73STATIC void xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog);
66 74
67STATIC void xlog_grant_push_ail(struct log *log, 75STATIC void
68 int need_bytes); 76xlog_grant_push_ail(
77 struct xlog *log,
78 int need_bytes);
69STATIC void xlog_regrant_reserve_log_space(xlog_t *log, 79STATIC void xlog_regrant_reserve_log_space(xlog_t *log,
70 xlog_ticket_t *ticket); 80 xlog_ticket_t *ticket);
71STATIC void xlog_ungrant_log_space(xlog_t *log, 81STATIC void xlog_ungrant_log_space(xlog_t *log,
@@ -73,7 +83,9 @@ STATIC void xlog_ungrant_log_space(xlog_t *log,
73 83
74#if defined(DEBUG) 84#if defined(DEBUG)
75STATIC void xlog_verify_dest_ptr(xlog_t *log, char *ptr); 85STATIC void xlog_verify_dest_ptr(xlog_t *log, char *ptr);
76STATIC void xlog_verify_grant_tail(struct log *log); 86STATIC void
87xlog_verify_grant_tail(
88 struct xlog *log);
77STATIC void xlog_verify_iclog(xlog_t *log, xlog_in_core_t *iclog, 89STATIC void xlog_verify_iclog(xlog_t *log, xlog_in_core_t *iclog,
78 int count, boolean_t syncing); 90 int count, boolean_t syncing);
79STATIC void xlog_verify_tail_lsn(xlog_t *log, xlog_in_core_t *iclog, 91STATIC void xlog_verify_tail_lsn(xlog_t *log, xlog_in_core_t *iclog,
@@ -89,9 +101,9 @@ STATIC int xlog_iclogs_empty(xlog_t *log);
89 101
90static void 102static void
91xlog_grant_sub_space( 103xlog_grant_sub_space(
92 struct log *log, 104 struct xlog *log,
93 atomic64_t *head, 105 atomic64_t *head,
94 int bytes) 106 int bytes)
95{ 107{
96 int64_t head_val = atomic64_read(head); 108 int64_t head_val = atomic64_read(head);
97 int64_t new, old; 109 int64_t new, old;
@@ -115,9 +127,9 @@ xlog_grant_sub_space(
115 127
116static void 128static void
117xlog_grant_add_space( 129xlog_grant_add_space(
118 struct log *log, 130 struct xlog *log,
119 atomic64_t *head, 131 atomic64_t *head,
120 int bytes) 132 int bytes)
121{ 133{
122 int64_t head_val = atomic64_read(head); 134 int64_t head_val = atomic64_read(head);
123 int64_t new, old; 135 int64_t new, old;
@@ -165,7 +177,7 @@ xlog_grant_head_wake_all(
165 177
166static inline int 178static inline int
167xlog_ticket_reservation( 179xlog_ticket_reservation(
168 struct log *log, 180 struct xlog *log,
169 struct xlog_grant_head *head, 181 struct xlog_grant_head *head,
170 struct xlog_ticket *tic) 182 struct xlog_ticket *tic)
171{ 183{
@@ -182,7 +194,7 @@ xlog_ticket_reservation(
182 194
183STATIC bool 195STATIC bool
184xlog_grant_head_wake( 196xlog_grant_head_wake(
185 struct log *log, 197 struct xlog *log,
186 struct xlog_grant_head *head, 198 struct xlog_grant_head *head,
187 int *free_bytes) 199 int *free_bytes)
188{ 200{
@@ -204,7 +216,7 @@ xlog_grant_head_wake(
204 216
205STATIC int 217STATIC int
206xlog_grant_head_wait( 218xlog_grant_head_wait(
207 struct log *log, 219 struct xlog *log,
208 struct xlog_grant_head *head, 220 struct xlog_grant_head *head,
209 struct xlog_ticket *tic, 221 struct xlog_ticket *tic,
210 int need_bytes) 222 int need_bytes)
@@ -256,7 +268,7 @@ shutdown:
256 */ 268 */
257STATIC int 269STATIC int
258xlog_grant_head_check( 270xlog_grant_head_check(
259 struct log *log, 271 struct xlog *log,
260 struct xlog_grant_head *head, 272 struct xlog_grant_head *head,
261 struct xlog_ticket *tic, 273 struct xlog_ticket *tic,
262 int *need_bytes) 274 int *need_bytes)
@@ -323,7 +335,7 @@ xfs_log_regrant(
323 struct xfs_mount *mp, 335 struct xfs_mount *mp,
324 struct xlog_ticket *tic) 336 struct xlog_ticket *tic)
325{ 337{
326 struct log *log = mp->m_log; 338 struct xlog *log = mp->m_log;
327 int need_bytes; 339 int need_bytes;
328 int error = 0; 340 int error = 0;
329 341
@@ -389,7 +401,7 @@ xfs_log_reserve(
389 bool permanent, 401 bool permanent,
390 uint t_type) 402 uint t_type)
391{ 403{
392 struct log *log = mp->m_log; 404 struct xlog *log = mp->m_log;
393 struct xlog_ticket *tic; 405 struct xlog_ticket *tic;
394 int need_bytes; 406 int need_bytes;
395 int error = 0; 407 int error = 0;
@@ -465,7 +477,7 @@ xfs_log_done(
465 struct xlog_in_core **iclog, 477 struct xlog_in_core **iclog,
466 uint flags) 478 uint flags)
467{ 479{
468 struct log *log = mp->m_log; 480 struct xlog *log = mp->m_log;
469 xfs_lsn_t lsn = 0; 481 xfs_lsn_t lsn = 0;
470 482
471 if (XLOG_FORCED_SHUTDOWN(log) || 483 if (XLOG_FORCED_SHUTDOWN(log) ||
@@ -839,7 +851,7 @@ void
839xfs_log_space_wake( 851xfs_log_space_wake(
840 struct xfs_mount *mp) 852 struct xfs_mount *mp)
841{ 853{
842 struct log *log = mp->m_log; 854 struct xlog *log = mp->m_log;
843 int free_bytes; 855 int free_bytes;
844 856
845 if (XLOG_FORCED_SHUTDOWN(log)) 857 if (XLOG_FORCED_SHUTDOWN(log))
@@ -917,7 +929,7 @@ xfs_lsn_t
917xlog_assign_tail_lsn_locked( 929xlog_assign_tail_lsn_locked(
918 struct xfs_mount *mp) 930 struct xfs_mount *mp)
919{ 931{
920 struct log *log = mp->m_log; 932 struct xlog *log = mp->m_log;
921 struct xfs_log_item *lip; 933 struct xfs_log_item *lip;
922 xfs_lsn_t tail_lsn; 934 xfs_lsn_t tail_lsn;
923 935
@@ -966,7 +978,7 @@ xlog_assign_tail_lsn(
966 */ 978 */
967STATIC int 979STATIC int
968xlog_space_left( 980xlog_space_left(
969 struct log *log, 981 struct xlog *log,
970 atomic64_t *head) 982 atomic64_t *head)
971{ 983{
972 int free_bytes; 984 int free_bytes;
@@ -1278,7 +1290,7 @@ out:
1278 */ 1290 */
1279STATIC int 1291STATIC int
1280xlog_commit_record( 1292xlog_commit_record(
1281 struct log *log, 1293 struct xlog *log,
1282 struct xlog_ticket *ticket, 1294 struct xlog_ticket *ticket,
1283 struct xlog_in_core **iclog, 1295 struct xlog_in_core **iclog,
1284 xfs_lsn_t *commitlsnp) 1296 xfs_lsn_t *commitlsnp)
@@ -1312,7 +1324,7 @@ xlog_commit_record(
1312 */ 1324 */
1313STATIC void 1325STATIC void
1314xlog_grant_push_ail( 1326xlog_grant_push_ail(
1315 struct log *log, 1327 struct xlog *log,
1316 int need_bytes) 1328 int need_bytes)
1317{ 1329{
1318 xfs_lsn_t threshold_lsn = 0; 1330 xfs_lsn_t threshold_lsn = 0;
@@ -1791,7 +1803,7 @@ xlog_write_start_rec(
1791 1803
1792static xlog_op_header_t * 1804static xlog_op_header_t *
1793xlog_write_setup_ophdr( 1805xlog_write_setup_ophdr(
1794 struct log *log, 1806 struct xlog *log,
1795 struct xlog_op_header *ophdr, 1807 struct xlog_op_header *ophdr,
1796 struct xlog_ticket *ticket, 1808 struct xlog_ticket *ticket,
1797 uint flags) 1809 uint flags)
@@ -1874,7 +1886,7 @@ xlog_write_setup_copy(
1874 1886
1875static int 1887static int
1876xlog_write_copy_finish( 1888xlog_write_copy_finish(
1877 struct log *log, 1889 struct xlog *log,
1878 struct xlog_in_core *iclog, 1890 struct xlog_in_core *iclog,
1879 uint flags, 1891 uint flags,
1880 int *record_cnt, 1892 int *record_cnt,
@@ -1959,7 +1971,7 @@ xlog_write_copy_finish(
1959 */ 1971 */
1960int 1972int
1961xlog_write( 1973xlog_write(
1962 struct log *log, 1974 struct xlog *log,
1963 struct xfs_log_vec *log_vector, 1975 struct xfs_log_vec *log_vector,
1964 struct xlog_ticket *ticket, 1976 struct xlog_ticket *ticket,
1965 xfs_lsn_t *start_lsn, 1977 xfs_lsn_t *start_lsn,
@@ -2822,7 +2834,7 @@ _xfs_log_force(
2822 uint flags, 2834 uint flags,
2823 int *log_flushed) 2835 int *log_flushed)
2824{ 2836{
2825 struct log *log = mp->m_log; 2837 struct xlog *log = mp->m_log;
2826 struct xlog_in_core *iclog; 2838 struct xlog_in_core *iclog;
2827 xfs_lsn_t lsn; 2839 xfs_lsn_t lsn;
2828 2840
@@ -2970,7 +2982,7 @@ _xfs_log_force_lsn(
2970 uint flags, 2982 uint flags,
2971 int *log_flushed) 2983 int *log_flushed)
2972{ 2984{
2973 struct log *log = mp->m_log; 2985 struct xlog *log = mp->m_log;
2974 struct xlog_in_core *iclog; 2986 struct xlog_in_core *iclog;
2975 int already_slept = 0; 2987 int already_slept = 0;
2976 2988
@@ -3148,7 +3160,7 @@ xfs_log_ticket_get(
3148 */ 3160 */
3149xlog_ticket_t * 3161xlog_ticket_t *
3150xlog_ticket_alloc( 3162xlog_ticket_alloc(
3151 struct log *log, 3163 struct xlog *log,
3152 int unit_bytes, 3164 int unit_bytes,
3153 int cnt, 3165 int cnt,
3154 char client, 3166 char client,
@@ -3279,7 +3291,7 @@ xlog_ticket_alloc(
3279 */ 3291 */
3280void 3292void
3281xlog_verify_dest_ptr( 3293xlog_verify_dest_ptr(
3282 struct log *log, 3294 struct xlog *log,
3283 char *ptr) 3295 char *ptr)
3284{ 3296{
3285 int i; 3297 int i;
@@ -3308,7 +3320,7 @@ xlog_verify_dest_ptr(
3308 */ 3320 */
3309STATIC void 3321STATIC void
3310xlog_verify_grant_tail( 3322xlog_verify_grant_tail(
3311 struct log *log) 3323 struct xlog *log)
3312{ 3324{
3313 int tail_cycle, tail_blocks; 3325 int tail_cycle, tail_blocks;
3314 int cycle, space; 3326 int cycle, space;