diff options
Diffstat (limited to 'fs/xfs/xfs_log.c')
-rw-r--r-- | fs/xfs/xfs_log.c | 76 |
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 @@ | |||
38 | kmem_zone_t *xfs_log_ticket_zone; | 38 | kmem_zone_t *xfs_log_ticket_zone; |
39 | 39 | ||
40 | /* Local miscellaneous function prototypes */ | 40 | /* Local miscellaneous function prototypes */ |
41 | STATIC int xlog_commit_record(struct log *log, struct xlog_ticket *ticket, | 41 | STATIC int |
42 | xlog_in_core_t **, xfs_lsn_t *); | 42 | xlog_commit_record( |
43 | struct xlog *log, | ||
44 | struct xlog_ticket *ticket, | ||
45 | struct xlog_in_core **iclog, | ||
46 | xfs_lsn_t *commitlsnp); | ||
47 | |||
43 | STATIC xlog_t * xlog_alloc_log(xfs_mount_t *mp, | 48 | STATIC 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); |
47 | STATIC int xlog_space_left(struct log *log, atomic64_t *head); | 52 | STATIC int |
53 | xlog_space_left( | ||
54 | struct xlog *log, | ||
55 | atomic64_t *head); | ||
48 | STATIC int xlog_sync(xlog_t *log, xlog_in_core_t *iclog); | 56 | STATIC int xlog_sync(xlog_t *log, xlog_in_core_t *iclog); |
49 | STATIC void xlog_dealloc_log(xlog_t *log); | 57 | STATIC 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); |
65 | STATIC void xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog); | 73 | STATIC void xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog); |
66 | 74 | ||
67 | STATIC void xlog_grant_push_ail(struct log *log, | 75 | STATIC void |
68 | int need_bytes); | 76 | xlog_grant_push_ail( |
77 | struct xlog *log, | ||
78 | int need_bytes); | ||
69 | STATIC void xlog_regrant_reserve_log_space(xlog_t *log, | 79 | STATIC void xlog_regrant_reserve_log_space(xlog_t *log, |
70 | xlog_ticket_t *ticket); | 80 | xlog_ticket_t *ticket); |
71 | STATIC void xlog_ungrant_log_space(xlog_t *log, | 81 | STATIC 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) |
75 | STATIC void xlog_verify_dest_ptr(xlog_t *log, char *ptr); | 85 | STATIC void xlog_verify_dest_ptr(xlog_t *log, char *ptr); |
76 | STATIC void xlog_verify_grant_tail(struct log *log); | 86 | STATIC void |
87 | xlog_verify_grant_tail( | ||
88 | struct xlog *log); | ||
77 | STATIC void xlog_verify_iclog(xlog_t *log, xlog_in_core_t *iclog, | 89 | STATIC void xlog_verify_iclog(xlog_t *log, xlog_in_core_t *iclog, |
78 | int count, boolean_t syncing); | 90 | int count, boolean_t syncing); |
79 | STATIC void xlog_verify_tail_lsn(xlog_t *log, xlog_in_core_t *iclog, | 91 | STATIC 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 | ||
90 | static void | 102 | static void |
91 | xlog_grant_sub_space( | 103 | xlog_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 | ||
116 | static void | 128 | static void |
117 | xlog_grant_add_space( | 129 | xlog_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 | ||
166 | static inline int | 178 | static inline int |
167 | xlog_ticket_reservation( | 179 | xlog_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 | ||
183 | STATIC bool | 195 | STATIC bool |
184 | xlog_grant_head_wake( | 196 | xlog_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 | ||
205 | STATIC int | 217 | STATIC int |
206 | xlog_grant_head_wait( | 218 | xlog_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 | */ |
257 | STATIC int | 269 | STATIC int |
258 | xlog_grant_head_check( | 270 | xlog_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 | |||
839 | xfs_log_space_wake( | 851 | xfs_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 | |||
917 | xlog_assign_tail_lsn_locked( | 929 | xlog_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 | */ |
967 | STATIC int | 979 | STATIC int |
968 | xlog_space_left( | 980 | xlog_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 | */ |
1279 | STATIC int | 1291 | STATIC int |
1280 | xlog_commit_record( | 1292 | xlog_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 | */ |
1313 | STATIC void | 1325 | STATIC void |
1314 | xlog_grant_push_ail( | 1326 | xlog_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 | ||
1792 | static xlog_op_header_t * | 1804 | static xlog_op_header_t * |
1793 | xlog_write_setup_ophdr( | 1805 | xlog_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 | ||
1875 | static int | 1887 | static int |
1876 | xlog_write_copy_finish( | 1888 | xlog_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 | */ |
1960 | int | 1972 | int |
1961 | xlog_write( | 1973 | xlog_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 | */ |
3149 | xlog_ticket_t * | 3161 | xlog_ticket_t * |
3150 | xlog_ticket_alloc( | 3162 | xlog_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 | */ |
3280 | void | 3292 | void |
3281 | xlog_verify_dest_ptr( | 3293 | xlog_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 | */ |
3309 | STATIC void | 3321 | STATIC void |
3310 | xlog_verify_grant_tail( | 3322 | xlog_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; |