diff options
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_log.c | 41 | ||||
-rw-r--r-- | fs/xfs/xfs_log_priv.h | 16 |
2 files changed, 32 insertions, 25 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index d170fffd7402..77c12715a7d0 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -252,6 +252,29 @@ xlog_grant_add_space(struct log *log, int bytes) | |||
252 | xlog_grant_add_space_reserve(log, bytes); | 252 | xlog_grant_add_space_reserve(log, bytes); |
253 | } | 253 | } |
254 | 254 | ||
255 | static void | ||
256 | xlog_tic_reset_res(xlog_ticket_t *tic) | ||
257 | { | ||
258 | tic->t_res_num = 0; | ||
259 | tic->t_res_arr_sum = 0; | ||
260 | tic->t_res_num_ophdrs = 0; | ||
261 | } | ||
262 | |||
263 | static void | ||
264 | xlog_tic_add_region(xlog_ticket_t *tic, uint len, uint type) | ||
265 | { | ||
266 | if (tic->t_res_num == XLOG_TIC_LEN_MAX) { | ||
267 | /* add to overflow and start again */ | ||
268 | tic->t_res_o_flow += tic->t_res_arr_sum; | ||
269 | tic->t_res_num = 0; | ||
270 | tic->t_res_arr_sum = 0; | ||
271 | } | ||
272 | |||
273 | tic->t_res_arr[tic->t_res_num].r_len = len; | ||
274 | tic->t_res_arr[tic->t_res_num].r_type = type; | ||
275 | tic->t_res_arr_sum += len; | ||
276 | tic->t_res_num++; | ||
277 | } | ||
255 | 278 | ||
256 | /* | 279 | /* |
257 | * NOTES: | 280 | * NOTES: |
@@ -1764,14 +1787,14 @@ xlog_write(xfs_mount_t * mp, | |||
1764 | len = 0; | 1787 | len = 0; |
1765 | if (ticket->t_flags & XLOG_TIC_INITED) { /* acct for start rec of xact */ | 1788 | if (ticket->t_flags & XLOG_TIC_INITED) { /* acct for start rec of xact */ |
1766 | len += sizeof(xlog_op_header_t); | 1789 | len += sizeof(xlog_op_header_t); |
1767 | XLOG_TIC_ADD_OPHDR(ticket); | 1790 | ticket->t_res_num_ophdrs++; |
1768 | } | 1791 | } |
1769 | 1792 | ||
1770 | for (index = 0; index < nentries; index++) { | 1793 | for (index = 0; index < nentries; index++) { |
1771 | len += sizeof(xlog_op_header_t); /* each region gets >= 1 */ | 1794 | len += sizeof(xlog_op_header_t); /* each region gets >= 1 */ |
1772 | XLOG_TIC_ADD_OPHDR(ticket); | 1795 | ticket->t_res_num_ophdrs++; |
1773 | len += reg[index].i_len; | 1796 | len += reg[index].i_len; |
1774 | XLOG_TIC_ADD_REGION(ticket, reg[index].i_len, reg[index].i_type); | 1797 | xlog_tic_add_region(ticket, reg[index].i_len, reg[index].i_type); |
1775 | } | 1798 | } |
1776 | contwr = *start_lsn = 0; | 1799 | contwr = *start_lsn = 0; |
1777 | 1800 | ||
@@ -1880,7 +1903,7 @@ xlog_write(xfs_mount_t * mp, | |||
1880 | len += sizeof(xlog_op_header_t); /* from splitting of region */ | 1903 | len += sizeof(xlog_op_header_t); /* from splitting of region */ |
1881 | /* account for new log op header */ | 1904 | /* account for new log op header */ |
1882 | ticket->t_curr_res -= sizeof(xlog_op_header_t); | 1905 | ticket->t_curr_res -= sizeof(xlog_op_header_t); |
1883 | XLOG_TIC_ADD_OPHDR(ticket); | 1906 | ticket->t_res_num_ophdrs++; |
1884 | } | 1907 | } |
1885 | xlog_verify_dest_ptr(log, ptr); | 1908 | xlog_verify_dest_ptr(log, ptr); |
1886 | 1909 | ||
@@ -2378,7 +2401,7 @@ restart: | |||
2378 | */ | 2401 | */ |
2379 | if (log_offset == 0) { | 2402 | if (log_offset == 0) { |
2380 | ticket->t_curr_res -= log->l_iclog_hsize; | 2403 | ticket->t_curr_res -= log->l_iclog_hsize; |
2381 | XLOG_TIC_ADD_REGION(ticket, | 2404 | xlog_tic_add_region(ticket, |
2382 | log->l_iclog_hsize, | 2405 | log->l_iclog_hsize, |
2383 | XLOG_REG_TYPE_LRHEADER); | 2406 | XLOG_REG_TYPE_LRHEADER); |
2384 | INT_SET(head->h_cycle, ARCH_CONVERT, log->l_curr_cycle); | 2407 | INT_SET(head->h_cycle, ARCH_CONVERT, log->l_curr_cycle); |
@@ -2566,7 +2589,7 @@ xlog_regrant_write_log_space(xlog_t *log, | |||
2566 | #endif | 2589 | #endif |
2567 | 2590 | ||
2568 | tic->t_curr_res = tic->t_unit_res; | 2591 | tic->t_curr_res = tic->t_unit_res; |
2569 | XLOG_TIC_RESET_RES(tic); | 2592 | xlog_tic_reset_res(tic); |
2570 | 2593 | ||
2571 | if (tic->t_cnt > 0) | 2594 | if (tic->t_cnt > 0) |
2572 | return 0; | 2595 | return 0; |
@@ -2707,7 +2730,7 @@ xlog_regrant_reserve_log_space(xlog_t *log, | |||
2707 | s = GRANT_LOCK(log); | 2730 | s = GRANT_LOCK(log); |
2708 | xlog_grant_sub_space(log, ticket->t_curr_res); | 2731 | xlog_grant_sub_space(log, ticket->t_curr_res); |
2709 | ticket->t_curr_res = ticket->t_unit_res; | 2732 | ticket->t_curr_res = ticket->t_unit_res; |
2710 | XLOG_TIC_RESET_RES(ticket); | 2733 | xlog_tic_reset_res(ticket); |
2711 | xlog_trace_loggrant(log, ticket, | 2734 | xlog_trace_loggrant(log, ticket, |
2712 | "xlog_regrant_reserve_log_space: sub current res"); | 2735 | "xlog_regrant_reserve_log_space: sub current res"); |
2713 | xlog_verify_grant_head(log, 1); | 2736 | xlog_verify_grant_head(log, 1); |
@@ -2724,7 +2747,7 @@ xlog_regrant_reserve_log_space(xlog_t *log, | |||
2724 | xlog_verify_grant_head(log, 0); | 2747 | xlog_verify_grant_head(log, 0); |
2725 | GRANT_UNLOCK(log, s); | 2748 | GRANT_UNLOCK(log, s); |
2726 | ticket->t_curr_res = ticket->t_unit_res; | 2749 | ticket->t_curr_res = ticket->t_unit_res; |
2727 | XLOG_TIC_RESET_RES(ticket); | 2750 | xlog_tic_reset_res(ticket); |
2728 | } /* xlog_regrant_reserve_log_space */ | 2751 | } /* xlog_regrant_reserve_log_space */ |
2729 | 2752 | ||
2730 | 2753 | ||
@@ -3347,7 +3370,7 @@ xlog_ticket_get(xlog_t *log, | |||
3347 | tic->t_flags |= XLOG_TIC_PERM_RESERV; | 3370 | tic->t_flags |= XLOG_TIC_PERM_RESERV; |
3348 | sv_init(&(tic->t_sema), SV_DEFAULT, "logtick"); | 3371 | sv_init(&(tic->t_sema), SV_DEFAULT, "logtick"); |
3349 | 3372 | ||
3350 | XLOG_TIC_RESET_RES(tic); | 3373 | xlog_tic_reset_res(tic); |
3351 | 3374 | ||
3352 | return tic; | 3375 | return tic; |
3353 | } /* xlog_ticket_get */ | 3376 | } /* xlog_ticket_get */ |
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h index db0d53ffe458..752f964b3699 100644 --- a/fs/xfs/xfs_log_priv.h +++ b/fs/xfs/xfs_log_priv.h | |||
@@ -249,22 +249,6 @@ typedef __uint32_t xlog_tid_t; | |||
249 | 249 | ||
250 | /* Ticket reservation region accounting */ | 250 | /* Ticket reservation region accounting */ |
251 | #define XLOG_TIC_LEN_MAX 15 | 251 | #define XLOG_TIC_LEN_MAX 15 |
252 | #define XLOG_TIC_RESET_RES(t) ((t)->t_res_num = \ | ||
253 | (t)->t_res_arr_sum = (t)->t_res_num_ophdrs = 0) | ||
254 | #define XLOG_TIC_ADD_OPHDR(t) ((t)->t_res_num_ophdrs++) | ||
255 | #define XLOG_TIC_ADD_REGION(t, len, type) \ | ||
256 | do { \ | ||
257 | if ((t)->t_res_num == XLOG_TIC_LEN_MAX) { \ | ||
258 | /* add to overflow and start again */ \ | ||
259 | (t)->t_res_o_flow += (t)->t_res_arr_sum; \ | ||
260 | (t)->t_res_num = 0; \ | ||
261 | (t)->t_res_arr_sum = 0; \ | ||
262 | } \ | ||
263 | (t)->t_res_arr[(t)->t_res_num].r_len = (len); \ | ||
264 | (t)->t_res_arr[(t)->t_res_num].r_type = (type); \ | ||
265 | (t)->t_res_arr_sum += (len); \ | ||
266 | (t)->t_res_num++; \ | ||
267 | } while (0) | ||
268 | 252 | ||
269 | /* | 253 | /* |
270 | * Reservation region | 254 | * Reservation region |