diff options
| author | Jens Axboe <axboe@kernel.dk> | 2012-07-30 03:03:10 -0400 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2012-07-30 03:03:10 -0400 |
| commit | 72ea1f74fcdf874cca6d2c0962379523bbd99e2c (patch) | |
| tree | 4c67be6c73356086ff44ef1b8b1c9479702689ca /fs/xfs/xfs_log.c | |
| parent | b1af9be5ef77898c05667bb9dbf3b180d91d3292 (diff) | |
| parent | a73ff3231df59a4b92ccd0dd4e73897c5822489b (diff) | |
Merge branch 'for-jens' of git://git.drbd.org/linux-drbd into for-3.6/drivers
Diffstat (limited to 'fs/xfs/xfs_log.c')
| -rw-r--r-- | fs/xfs/xfs_log.c | 77 |
1 files changed, 45 insertions, 32 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index f30d9807dc48..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) || |
| @@ -810,6 +822,7 @@ xfs_log_unmount_write(xfs_mount_t *mp) | |||
| 810 | void | 822 | void |
| 811 | xfs_log_unmount(xfs_mount_t *mp) | 823 | xfs_log_unmount(xfs_mount_t *mp) |
| 812 | { | 824 | { |
| 825 | cancel_delayed_work_sync(&mp->m_sync_work); | ||
| 813 | xfs_trans_ail_destroy(mp); | 826 | xfs_trans_ail_destroy(mp); |
| 814 | xlog_dealloc_log(mp->m_log); | 827 | xlog_dealloc_log(mp->m_log); |
| 815 | } | 828 | } |
| @@ -838,7 +851,7 @@ void | |||
| 838 | xfs_log_space_wake( | 851 | xfs_log_space_wake( |
| 839 | struct xfs_mount *mp) | 852 | struct xfs_mount *mp) |
| 840 | { | 853 | { |
| 841 | struct log *log = mp->m_log; | 854 | struct xlog *log = mp->m_log; |
| 842 | int free_bytes; | 855 | int free_bytes; |
| 843 | 856 | ||
| 844 | if (XLOG_FORCED_SHUTDOWN(log)) | 857 | if (XLOG_FORCED_SHUTDOWN(log)) |
| @@ -916,7 +929,7 @@ xfs_lsn_t | |||
| 916 | xlog_assign_tail_lsn_locked( | 929 | xlog_assign_tail_lsn_locked( |
| 917 | struct xfs_mount *mp) | 930 | struct xfs_mount *mp) |
| 918 | { | 931 | { |
| 919 | struct log *log = mp->m_log; | 932 | struct xlog *log = mp->m_log; |
| 920 | struct xfs_log_item *lip; | 933 | struct xfs_log_item *lip; |
| 921 | xfs_lsn_t tail_lsn; | 934 | xfs_lsn_t tail_lsn; |
| 922 | 935 | ||
| @@ -965,7 +978,7 @@ xlog_assign_tail_lsn( | |||
| 965 | */ | 978 | */ |
| 966 | STATIC int | 979 | STATIC int |
| 967 | xlog_space_left( | 980 | xlog_space_left( |
| 968 | struct log *log, | 981 | struct xlog *log, |
| 969 | atomic64_t *head) | 982 | atomic64_t *head) |
| 970 | { | 983 | { |
| 971 | int free_bytes; | 984 | int free_bytes; |
| @@ -1277,7 +1290,7 @@ out: | |||
| 1277 | */ | 1290 | */ |
| 1278 | STATIC int | 1291 | STATIC int |
| 1279 | xlog_commit_record( | 1292 | xlog_commit_record( |
| 1280 | struct log *log, | 1293 | struct xlog *log, |
| 1281 | struct xlog_ticket *ticket, | 1294 | struct xlog_ticket *ticket, |
| 1282 | struct xlog_in_core **iclog, | 1295 | struct xlog_in_core **iclog, |
| 1283 | xfs_lsn_t *commitlsnp) | 1296 | xfs_lsn_t *commitlsnp) |
| @@ -1311,7 +1324,7 @@ xlog_commit_record( | |||
| 1311 | */ | 1324 | */ |
| 1312 | STATIC void | 1325 | STATIC void |
| 1313 | xlog_grant_push_ail( | 1326 | xlog_grant_push_ail( |
| 1314 | struct log *log, | 1327 | struct xlog *log, |
| 1315 | int need_bytes) | 1328 | int need_bytes) |
| 1316 | { | 1329 | { |
| 1317 | xfs_lsn_t threshold_lsn = 0; | 1330 | xfs_lsn_t threshold_lsn = 0; |
| @@ -1790,7 +1803,7 @@ xlog_write_start_rec( | |||
| 1790 | 1803 | ||
| 1791 | static xlog_op_header_t * | 1804 | static xlog_op_header_t * |
| 1792 | xlog_write_setup_ophdr( | 1805 | xlog_write_setup_ophdr( |
| 1793 | struct log *log, | 1806 | struct xlog *log, |
| 1794 | struct xlog_op_header *ophdr, | 1807 | struct xlog_op_header *ophdr, |
| 1795 | struct xlog_ticket *ticket, | 1808 | struct xlog_ticket *ticket, |
| 1796 | uint flags) | 1809 | uint flags) |
| @@ -1873,7 +1886,7 @@ xlog_write_setup_copy( | |||
| 1873 | 1886 | ||
| 1874 | static int | 1887 | static int |
| 1875 | xlog_write_copy_finish( | 1888 | xlog_write_copy_finish( |
| 1876 | struct log *log, | 1889 | struct xlog *log, |
| 1877 | struct xlog_in_core *iclog, | 1890 | struct xlog_in_core *iclog, |
| 1878 | uint flags, | 1891 | uint flags, |
| 1879 | int *record_cnt, | 1892 | int *record_cnt, |
| @@ -1958,7 +1971,7 @@ xlog_write_copy_finish( | |||
| 1958 | */ | 1971 | */ |
| 1959 | int | 1972 | int |
| 1960 | xlog_write( | 1973 | xlog_write( |
| 1961 | struct log *log, | 1974 | struct xlog *log, |
| 1962 | struct xfs_log_vec *log_vector, | 1975 | struct xfs_log_vec *log_vector, |
| 1963 | struct xlog_ticket *ticket, | 1976 | struct xlog_ticket *ticket, |
| 1964 | xfs_lsn_t *start_lsn, | 1977 | xfs_lsn_t *start_lsn, |
| @@ -2821,7 +2834,7 @@ _xfs_log_force( | |||
| 2821 | uint flags, | 2834 | uint flags, |
| 2822 | int *log_flushed) | 2835 | int *log_flushed) |
| 2823 | { | 2836 | { |
| 2824 | struct log *log = mp->m_log; | 2837 | struct xlog *log = mp->m_log; |
| 2825 | struct xlog_in_core *iclog; | 2838 | struct xlog_in_core *iclog; |
| 2826 | xfs_lsn_t lsn; | 2839 | xfs_lsn_t lsn; |
| 2827 | 2840 | ||
| @@ -2969,7 +2982,7 @@ _xfs_log_force_lsn( | |||
| 2969 | uint flags, | 2982 | uint flags, |
| 2970 | int *log_flushed) | 2983 | int *log_flushed) |
| 2971 | { | 2984 | { |
| 2972 | struct log *log = mp->m_log; | 2985 | struct xlog *log = mp->m_log; |
| 2973 | struct xlog_in_core *iclog; | 2986 | struct xlog_in_core *iclog; |
| 2974 | int already_slept = 0; | 2987 | int already_slept = 0; |
| 2975 | 2988 | ||
| @@ -3147,7 +3160,7 @@ xfs_log_ticket_get( | |||
| 3147 | */ | 3160 | */ |
| 3148 | xlog_ticket_t * | 3161 | xlog_ticket_t * |
| 3149 | xlog_ticket_alloc( | 3162 | xlog_ticket_alloc( |
| 3150 | struct log *log, | 3163 | struct xlog *log, |
| 3151 | int unit_bytes, | 3164 | int unit_bytes, |
| 3152 | int cnt, | 3165 | int cnt, |
| 3153 | char client, | 3166 | char client, |
| @@ -3278,7 +3291,7 @@ xlog_ticket_alloc( | |||
| 3278 | */ | 3291 | */ |
| 3279 | void | 3292 | void |
| 3280 | xlog_verify_dest_ptr( | 3293 | xlog_verify_dest_ptr( |
| 3281 | struct log *log, | 3294 | struct xlog *log, |
| 3282 | char *ptr) | 3295 | char *ptr) |
| 3283 | { | 3296 | { |
| 3284 | int i; | 3297 | int i; |
| @@ -3307,7 +3320,7 @@ xlog_verify_dest_ptr( | |||
| 3307 | */ | 3320 | */ |
| 3308 | STATIC void | 3321 | STATIC void |
| 3309 | xlog_verify_grant_tail( | 3322 | xlog_verify_grant_tail( |
| 3310 | struct log *log) | 3323 | struct xlog *log) |
| 3311 | { | 3324 | { |
| 3312 | int tail_cycle, tail_blocks; | 3325 | int tail_cycle, tail_blocks; |
| 3313 | int cycle, space; | 3326 | int cycle, space; |
