diff options
author | Christoph Hellwig <hch@infradead.org> | 2009-12-14 18:14:59 -0500 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2009-12-15 00:08:16 -0500 |
commit | 0b1b213fcf3a8486ada99a2bab84ab8c6f51b264 (patch) | |
tree | 661fd8da7487231224c77b95c33986cb7d7b41ef /fs/xfs/xfs_log.c | |
parent | 6ef3554422e2c7e7aa424ba63737da498881dff4 (diff) |
xfs: event tracing support
Convert the old xfs tracing support that could only be used with the
out of tree kdb and xfsidbg patches to use the generic event tracer.
To use it make sure CONFIG_EVENT_TRACING is enabled and then enable
all xfs trace channels by:
echo 1 > /sys/kernel/debug/tracing/events/xfs/enable
or alternatively enable single events by just doing the same in one
event subdirectory, e.g.
echo 1 > /sys/kernel/debug/tracing/events/xfs/xfs_ihold/enable
or set more complex filters, etc. In Documentation/trace/events.txt
all this is desctribed in more detail. To reads the events do a
cat /sys/kernel/debug/tracing/trace
Compared to the last posting this patch converts the tracing mostly to
the one tracepoint per callsite model that other users of the new
tracing facility also employ. This allows a very fine-grained control
of the tracing, a cleaner output of the traces and also enables the
perf tool to use each tracepoint as a virtual performance counter,
allowing us to e.g. count how often certain workloads git various
spots in XFS. Take a look at
http://lwn.net/Articles/346470/
for some examples.
Also the btree tracing isn't included at all yet, as it will require
additional core tracing features not in mainline yet, I plan to
deliver it later.
And the really nice thing about this patch is that it actually removes
many lines of code while adding this nice functionality:
fs/xfs/Makefile | 8
fs/xfs/linux-2.6/xfs_acl.c | 1
fs/xfs/linux-2.6/xfs_aops.c | 52 -
fs/xfs/linux-2.6/xfs_aops.h | 2
fs/xfs/linux-2.6/xfs_buf.c | 117 +--
fs/xfs/linux-2.6/xfs_buf.h | 33
fs/xfs/linux-2.6/xfs_fs_subr.c | 3
fs/xfs/linux-2.6/xfs_ioctl.c | 1
fs/xfs/linux-2.6/xfs_ioctl32.c | 1
fs/xfs/linux-2.6/xfs_iops.c | 1
fs/xfs/linux-2.6/xfs_linux.h | 1
fs/xfs/linux-2.6/xfs_lrw.c | 87 --
fs/xfs/linux-2.6/xfs_lrw.h | 45 -
fs/xfs/linux-2.6/xfs_super.c | 104 ---
fs/xfs/linux-2.6/xfs_super.h | 7
fs/xfs/linux-2.6/xfs_sync.c | 1
fs/xfs/linux-2.6/xfs_trace.c | 75 ++
fs/xfs/linux-2.6/xfs_trace.h | 1369 +++++++++++++++++++++++++++++++++++++++++
fs/xfs/linux-2.6/xfs_vnode.h | 4
fs/xfs/quota/xfs_dquot.c | 110 ---
fs/xfs/quota/xfs_dquot.h | 21
fs/xfs/quota/xfs_qm.c | 40 -
fs/xfs/quota/xfs_qm_syscalls.c | 4
fs/xfs/support/ktrace.c | 323 ---------
fs/xfs/support/ktrace.h | 85 --
fs/xfs/xfs.h | 16
fs/xfs/xfs_ag.h | 14
fs/xfs/xfs_alloc.c | 230 +-----
fs/xfs/xfs_alloc.h | 27
fs/xfs/xfs_alloc_btree.c | 1
fs/xfs/xfs_attr.c | 107 ---
fs/xfs/xfs_attr.h | 10
fs/xfs/xfs_attr_leaf.c | 14
fs/xfs/xfs_attr_sf.h | 40 -
fs/xfs/xfs_bmap.c | 507 +++------------
fs/xfs/xfs_bmap.h | 49 -
fs/xfs/xfs_bmap_btree.c | 6
fs/xfs/xfs_btree.c | 5
fs/xfs/xfs_btree_trace.h | 17
fs/xfs/xfs_buf_item.c | 87 --
fs/xfs/xfs_buf_item.h | 20
fs/xfs/xfs_da_btree.c | 3
fs/xfs/xfs_da_btree.h | 7
fs/xfs/xfs_dfrag.c | 2
fs/xfs/xfs_dir2.c | 8
fs/xfs/xfs_dir2_block.c | 20
fs/xfs/xfs_dir2_leaf.c | 21
fs/xfs/xfs_dir2_node.c | 27
fs/xfs/xfs_dir2_sf.c | 26
fs/xfs/xfs_dir2_trace.c | 216 ------
fs/xfs/xfs_dir2_trace.h | 72 --
fs/xfs/xfs_filestream.c | 8
fs/xfs/xfs_fsops.c | 2
fs/xfs/xfs_iget.c | 111 ---
fs/xfs/xfs_inode.c | 67 --
fs/xfs/xfs_inode.h | 76 --
fs/xfs/xfs_inode_item.c | 5
fs/xfs/xfs_iomap.c | 85 --
fs/xfs/xfs_iomap.h | 8
fs/xfs/xfs_log.c | 181 +----
fs/xfs/xfs_log_priv.h | 20
fs/xfs/xfs_log_recover.c | 1
fs/xfs/xfs_mount.c | 2
fs/xfs/xfs_quota.h | 8
fs/xfs/xfs_rename.c | 1
fs/xfs/xfs_rtalloc.c | 1
fs/xfs/xfs_rw.c | 3
fs/xfs/xfs_trans.h | 47 +
fs/xfs/xfs_trans_buf.c | 62 -
fs/xfs/xfs_vnodeops.c | 8
70 files changed, 2151 insertions(+), 2592 deletions(-)
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_log.c')
-rw-r--r-- | fs/xfs/xfs_log.c | 181 |
1 files changed, 53 insertions, 128 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 9dbdff3ea484..4cb1792040e3 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include "xfs_dinode.h" | 40 | #include "xfs_dinode.h" |
41 | #include "xfs_inode.h" | 41 | #include "xfs_inode.h" |
42 | #include "xfs_rw.h" | 42 | #include "xfs_rw.h" |
43 | #include "xfs_trace.h" | ||
43 | 44 | ||
44 | kmem_zone_t *xfs_log_ticket_zone; | 45 | kmem_zone_t *xfs_log_ticket_zone; |
45 | 46 | ||
@@ -122,85 +123,6 @@ STATIC void xlog_verify_tail_lsn(xlog_t *log, xlog_in_core_t *iclog, | |||
122 | 123 | ||
123 | STATIC int xlog_iclogs_empty(xlog_t *log); | 124 | STATIC int xlog_iclogs_empty(xlog_t *log); |
124 | 125 | ||
125 | #if defined(XFS_LOG_TRACE) | ||
126 | |||
127 | #define XLOG_TRACE_LOGGRANT_SIZE 2048 | ||
128 | #define XLOG_TRACE_ICLOG_SIZE 256 | ||
129 | |||
130 | void | ||
131 | xlog_trace_loggrant_alloc(xlog_t *log) | ||
132 | { | ||
133 | log->l_grant_trace = ktrace_alloc(XLOG_TRACE_LOGGRANT_SIZE, KM_NOFS); | ||
134 | } | ||
135 | |||
136 | void | ||
137 | xlog_trace_loggrant_dealloc(xlog_t *log) | ||
138 | { | ||
139 | ktrace_free(log->l_grant_trace); | ||
140 | } | ||
141 | |||
142 | void | ||
143 | xlog_trace_loggrant(xlog_t *log, xlog_ticket_t *tic, xfs_caddr_t string) | ||
144 | { | ||
145 | unsigned long cnts; | ||
146 | |||
147 | /* ticket counts are 1 byte each */ | ||
148 | cnts = ((unsigned long)tic->t_ocnt) | ((unsigned long)tic->t_cnt) << 8; | ||
149 | |||
150 | ktrace_enter(log->l_grant_trace, | ||
151 | (void *)tic, | ||
152 | (void *)log->l_reserve_headq, | ||
153 | (void *)log->l_write_headq, | ||
154 | (void *)((unsigned long)log->l_grant_reserve_cycle), | ||
155 | (void *)((unsigned long)log->l_grant_reserve_bytes), | ||
156 | (void *)((unsigned long)log->l_grant_write_cycle), | ||
157 | (void *)((unsigned long)log->l_grant_write_bytes), | ||
158 | (void *)((unsigned long)log->l_curr_cycle), | ||
159 | (void *)((unsigned long)log->l_curr_block), | ||
160 | (void *)((unsigned long)CYCLE_LSN(log->l_tail_lsn)), | ||
161 | (void *)((unsigned long)BLOCK_LSN(log->l_tail_lsn)), | ||
162 | (void *)string, | ||
163 | (void *)((unsigned long)tic->t_trans_type), | ||
164 | (void *)cnts, | ||
165 | (void *)((unsigned long)tic->t_curr_res), | ||
166 | (void *)((unsigned long)tic->t_unit_res)); | ||
167 | } | ||
168 | |||
169 | void | ||
170 | xlog_trace_iclog_alloc(xlog_in_core_t *iclog) | ||
171 | { | ||
172 | iclog->ic_trace = ktrace_alloc(XLOG_TRACE_ICLOG_SIZE, KM_NOFS); | ||
173 | } | ||
174 | |||
175 | void | ||
176 | xlog_trace_iclog_dealloc(xlog_in_core_t *iclog) | ||
177 | { | ||
178 | ktrace_free(iclog->ic_trace); | ||
179 | } | ||
180 | |||
181 | void | ||
182 | xlog_trace_iclog(xlog_in_core_t *iclog, uint state) | ||
183 | { | ||
184 | ktrace_enter(iclog->ic_trace, | ||
185 | (void *)((unsigned long)state), | ||
186 | (void *)((unsigned long)current_pid()), | ||
187 | (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, | ||
188 | (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, | ||
189 | (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, | ||
190 | (void *)NULL, (void *)NULL); | ||
191 | } | ||
192 | #else | ||
193 | |||
194 | #define xlog_trace_loggrant_alloc(log) | ||
195 | #define xlog_trace_loggrant_dealloc(log) | ||
196 | #define xlog_trace_loggrant(log,tic,string) | ||
197 | |||
198 | #define xlog_trace_iclog_alloc(iclog) | ||
199 | #define xlog_trace_iclog_dealloc(iclog) | ||
200 | #define xlog_trace_iclog(iclog,state) | ||
201 | |||
202 | #endif /* XFS_LOG_TRACE */ | ||
203 | |||
204 | 126 | ||
205 | static void | 127 | static void |
206 | xlog_ins_ticketq(struct xlog_ticket **qp, struct xlog_ticket *tic) | 128 | xlog_ins_ticketq(struct xlog_ticket **qp, struct xlog_ticket *tic) |
@@ -353,15 +275,17 @@ xfs_log_done(xfs_mount_t *mp, | |||
353 | 275 | ||
354 | if ((ticket->t_flags & XLOG_TIC_PERM_RESERV) == 0 || | 276 | if ((ticket->t_flags & XLOG_TIC_PERM_RESERV) == 0 || |
355 | (flags & XFS_LOG_REL_PERM_RESERV)) { | 277 | (flags & XFS_LOG_REL_PERM_RESERV)) { |
278 | trace_xfs_log_done_nonperm(log, ticket); | ||
279 | |||
356 | /* | 280 | /* |
357 | * Release ticket if not permanent reservation or a specific | 281 | * Release ticket if not permanent reservation or a specific |
358 | * request has been made to release a permanent reservation. | 282 | * request has been made to release a permanent reservation. |
359 | */ | 283 | */ |
360 | xlog_trace_loggrant(log, ticket, "xfs_log_done: (non-permanent)"); | ||
361 | xlog_ungrant_log_space(log, ticket); | 284 | xlog_ungrant_log_space(log, ticket); |
362 | xfs_log_ticket_put(ticket); | 285 | xfs_log_ticket_put(ticket); |
363 | } else { | 286 | } else { |
364 | xlog_trace_loggrant(log, ticket, "xfs_log_done: (permanent)"); | 287 | trace_xfs_log_done_perm(log, ticket); |
288 | |||
365 | xlog_regrant_reserve_log_space(log, ticket); | 289 | xlog_regrant_reserve_log_space(log, ticket); |
366 | /* If this ticket was a permanent reservation and we aren't | 290 | /* If this ticket was a permanent reservation and we aren't |
367 | * trying to release it, reset the inited flags; so next time | 291 | * trying to release it, reset the inited flags; so next time |
@@ -505,10 +429,13 @@ xfs_log_reserve(xfs_mount_t *mp, | |||
505 | 429 | ||
506 | XFS_STATS_INC(xs_try_logspace); | 430 | XFS_STATS_INC(xs_try_logspace); |
507 | 431 | ||
432 | |||
508 | if (*ticket != NULL) { | 433 | if (*ticket != NULL) { |
509 | ASSERT(flags & XFS_LOG_PERM_RESERV); | 434 | ASSERT(flags & XFS_LOG_PERM_RESERV); |
510 | internal_ticket = (xlog_ticket_t *)*ticket; | 435 | internal_ticket = (xlog_ticket_t *)*ticket; |
511 | xlog_trace_loggrant(log, internal_ticket, "xfs_log_reserve: existing ticket (permanent trans)"); | 436 | |
437 | trace_xfs_log_reserve(log, internal_ticket); | ||
438 | |||
512 | xlog_grant_push_ail(mp, internal_ticket->t_unit_res); | 439 | xlog_grant_push_ail(mp, internal_ticket->t_unit_res); |
513 | retval = xlog_regrant_write_log_space(log, internal_ticket); | 440 | retval = xlog_regrant_write_log_space(log, internal_ticket); |
514 | } else { | 441 | } else { |
@@ -519,10 +446,9 @@ xfs_log_reserve(xfs_mount_t *mp, | |||
519 | return XFS_ERROR(ENOMEM); | 446 | return XFS_ERROR(ENOMEM); |
520 | internal_ticket->t_trans_type = t_type; | 447 | internal_ticket->t_trans_type = t_type; |
521 | *ticket = internal_ticket; | 448 | *ticket = internal_ticket; |
522 | xlog_trace_loggrant(log, internal_ticket, | 449 | |
523 | (internal_ticket->t_flags & XLOG_TIC_PERM_RESERV) ? | 450 | trace_xfs_log_reserve(log, internal_ticket); |
524 | "xfs_log_reserve: create new ticket (permanent trans)" : | 451 | |
525 | "xfs_log_reserve: create new ticket"); | ||
526 | xlog_grant_push_ail(mp, | 452 | xlog_grant_push_ail(mp, |
527 | (internal_ticket->t_unit_res * | 453 | (internal_ticket->t_unit_res * |
528 | internal_ticket->t_cnt)); | 454 | internal_ticket->t_cnt)); |
@@ -734,7 +660,7 @@ xfs_log_unmount_write(xfs_mount_t *mp) | |||
734 | spin_unlock(&log->l_icloglock); | 660 | spin_unlock(&log->l_icloglock); |
735 | } | 661 | } |
736 | if (tic) { | 662 | if (tic) { |
737 | xlog_trace_loggrant(log, tic, "unmount rec"); | 663 | trace_xfs_log_umount_write(log, tic); |
738 | xlog_ungrant_log_space(log, tic); | 664 | xlog_ungrant_log_space(log, tic); |
739 | xfs_log_ticket_put(tic); | 665 | xfs_log_ticket_put(tic); |
740 | } | 666 | } |
@@ -1030,7 +956,6 @@ xlog_iodone(xfs_buf_t *bp) | |||
1030 | xfs_fs_cmn_err(CE_WARN, l->l_mp, | 956 | xfs_fs_cmn_err(CE_WARN, l->l_mp, |
1031 | "xlog_iodone: Barriers are no longer supported" | 957 | "xlog_iodone: Barriers are no longer supported" |
1032 | " by device. Disabling barriers\n"); | 958 | " by device. Disabling barriers\n"); |
1033 | xfs_buftrace("XLOG_IODONE BARRIERS OFF", bp); | ||
1034 | } | 959 | } |
1035 | 960 | ||
1036 | /* | 961 | /* |
@@ -1085,13 +1010,10 @@ xlog_bdstrat_cb(struct xfs_buf *bp) | |||
1085 | return 0; | 1010 | return 0; |
1086 | } | 1011 | } |
1087 | 1012 | ||
1088 | xfs_buftrace("XLOG__BDSTRAT IOERROR", bp); | ||
1089 | XFS_BUF_ERROR(bp, EIO); | 1013 | XFS_BUF_ERROR(bp, EIO); |
1090 | XFS_BUF_STALE(bp); | 1014 | XFS_BUF_STALE(bp); |
1091 | xfs_biodone(bp); | 1015 | xfs_biodone(bp); |
1092 | return XFS_ERROR(EIO); | 1016 | return XFS_ERROR(EIO); |
1093 | |||
1094 | |||
1095 | } | 1017 | } |
1096 | 1018 | ||
1097 | /* | 1019 | /* |
@@ -1246,7 +1168,6 @@ xlog_alloc_log(xfs_mount_t *mp, | |||
1246 | spin_lock_init(&log->l_grant_lock); | 1168 | spin_lock_init(&log->l_grant_lock); |
1247 | sv_init(&log->l_flush_wait, 0, "flush_wait"); | 1169 | sv_init(&log->l_flush_wait, 0, "flush_wait"); |
1248 | 1170 | ||
1249 | xlog_trace_loggrant_alloc(log); | ||
1250 | /* log record size must be multiple of BBSIZE; see xlog_rec_header_t */ | 1171 | /* log record size must be multiple of BBSIZE; see xlog_rec_header_t */ |
1251 | ASSERT((XFS_BUF_SIZE(bp) & BBMASK) == 0); | 1172 | ASSERT((XFS_BUF_SIZE(bp) & BBMASK) == 0); |
1252 | 1173 | ||
@@ -1305,8 +1226,6 @@ xlog_alloc_log(xfs_mount_t *mp, | |||
1305 | sv_init(&iclog->ic_force_wait, SV_DEFAULT, "iclog-force"); | 1226 | sv_init(&iclog->ic_force_wait, SV_DEFAULT, "iclog-force"); |
1306 | sv_init(&iclog->ic_write_wait, SV_DEFAULT, "iclog-write"); | 1227 | sv_init(&iclog->ic_write_wait, SV_DEFAULT, "iclog-write"); |
1307 | 1228 | ||
1308 | xlog_trace_iclog_alloc(iclog); | ||
1309 | |||
1310 | iclogp = &iclog->ic_next; | 1229 | iclogp = &iclog->ic_next; |
1311 | } | 1230 | } |
1312 | *iclogp = log->l_iclog; /* complete ring */ | 1231 | *iclogp = log->l_iclog; /* complete ring */ |
@@ -1321,13 +1240,11 @@ out_free_iclog: | |||
1321 | sv_destroy(&iclog->ic_force_wait); | 1240 | sv_destroy(&iclog->ic_force_wait); |
1322 | sv_destroy(&iclog->ic_write_wait); | 1241 | sv_destroy(&iclog->ic_write_wait); |
1323 | xfs_buf_free(iclog->ic_bp); | 1242 | xfs_buf_free(iclog->ic_bp); |
1324 | xlog_trace_iclog_dealloc(iclog); | ||
1325 | } | 1243 | } |
1326 | kmem_free(iclog); | 1244 | kmem_free(iclog); |
1327 | } | 1245 | } |
1328 | spinlock_destroy(&log->l_icloglock); | 1246 | spinlock_destroy(&log->l_icloglock); |
1329 | spinlock_destroy(&log->l_grant_lock); | 1247 | spinlock_destroy(&log->l_grant_lock); |
1330 | xlog_trace_loggrant_dealloc(log); | ||
1331 | xfs_buf_free(log->l_xbuf); | 1248 | xfs_buf_free(log->l_xbuf); |
1332 | out_free_log: | 1249 | out_free_log: |
1333 | kmem_free(log); | 1250 | kmem_free(log); |
@@ -1607,7 +1524,6 @@ xlog_dealloc_log(xlog_t *log) | |||
1607 | sv_destroy(&iclog->ic_force_wait); | 1524 | sv_destroy(&iclog->ic_force_wait); |
1608 | sv_destroy(&iclog->ic_write_wait); | 1525 | sv_destroy(&iclog->ic_write_wait); |
1609 | xfs_buf_free(iclog->ic_bp); | 1526 | xfs_buf_free(iclog->ic_bp); |
1610 | xlog_trace_iclog_dealloc(iclog); | ||
1611 | next_iclog = iclog->ic_next; | 1527 | next_iclog = iclog->ic_next; |
1612 | kmem_free(iclog); | 1528 | kmem_free(iclog); |
1613 | iclog = next_iclog; | 1529 | iclog = next_iclog; |
@@ -1616,7 +1532,6 @@ xlog_dealloc_log(xlog_t *log) | |||
1616 | spinlock_destroy(&log->l_grant_lock); | 1532 | spinlock_destroy(&log->l_grant_lock); |
1617 | 1533 | ||
1618 | xfs_buf_free(log->l_xbuf); | 1534 | xfs_buf_free(log->l_xbuf); |
1619 | xlog_trace_loggrant_dealloc(log); | ||
1620 | log->l_mp->m_log = NULL; | 1535 | log->l_mp->m_log = NULL; |
1621 | kmem_free(log); | 1536 | kmem_free(log); |
1622 | } /* xlog_dealloc_log */ | 1537 | } /* xlog_dealloc_log */ |
@@ -2414,7 +2329,6 @@ restart: | |||
2414 | 2329 | ||
2415 | iclog = log->l_iclog; | 2330 | iclog = log->l_iclog; |
2416 | if (iclog->ic_state != XLOG_STATE_ACTIVE) { | 2331 | if (iclog->ic_state != XLOG_STATE_ACTIVE) { |
2417 | xlog_trace_iclog(iclog, XLOG_TRACE_SLEEP_FLUSH); | ||
2418 | XFS_STATS_INC(xs_log_noiclogs); | 2332 | XFS_STATS_INC(xs_log_noiclogs); |
2419 | 2333 | ||
2420 | /* Wait for log writes to have flushed */ | 2334 | /* Wait for log writes to have flushed */ |
@@ -2520,13 +2434,15 @@ xlog_grant_log_space(xlog_t *log, | |||
2520 | 2434 | ||
2521 | /* Is there space or do we need to sleep? */ | 2435 | /* Is there space or do we need to sleep? */ |
2522 | spin_lock(&log->l_grant_lock); | 2436 | spin_lock(&log->l_grant_lock); |
2523 | xlog_trace_loggrant(log, tic, "xlog_grant_log_space: enter"); | 2437 | |
2438 | trace_xfs_log_grant_enter(log, tic); | ||
2524 | 2439 | ||
2525 | /* something is already sleeping; insert new transaction at end */ | 2440 | /* something is already sleeping; insert new transaction at end */ |
2526 | if (log->l_reserve_headq) { | 2441 | if (log->l_reserve_headq) { |
2527 | xlog_ins_ticketq(&log->l_reserve_headq, tic); | 2442 | xlog_ins_ticketq(&log->l_reserve_headq, tic); |
2528 | xlog_trace_loggrant(log, tic, | 2443 | |
2529 | "xlog_grant_log_space: sleep 1"); | 2444 | trace_xfs_log_grant_sleep1(log, tic); |
2445 | |||
2530 | /* | 2446 | /* |
2531 | * Gotta check this before going to sleep, while we're | 2447 | * Gotta check this before going to sleep, while we're |
2532 | * holding the grant lock. | 2448 | * holding the grant lock. |
@@ -2540,8 +2456,7 @@ xlog_grant_log_space(xlog_t *log, | |||
2540 | * If we got an error, and the filesystem is shutting down, | 2456 | * If we got an error, and the filesystem is shutting down, |
2541 | * we'll catch it down below. So just continue... | 2457 | * we'll catch it down below. So just continue... |
2542 | */ | 2458 | */ |
2543 | xlog_trace_loggrant(log, tic, | 2459 | trace_xfs_log_grant_wake1(log, tic); |
2544 | "xlog_grant_log_space: wake 1"); | ||
2545 | spin_lock(&log->l_grant_lock); | 2460 | spin_lock(&log->l_grant_lock); |
2546 | } | 2461 | } |
2547 | if (tic->t_flags & XFS_LOG_PERM_RESERV) | 2462 | if (tic->t_flags & XFS_LOG_PERM_RESERV) |
@@ -2558,8 +2473,9 @@ redo: | |||
2558 | if (free_bytes < need_bytes) { | 2473 | if (free_bytes < need_bytes) { |
2559 | if ((tic->t_flags & XLOG_TIC_IN_Q) == 0) | 2474 | if ((tic->t_flags & XLOG_TIC_IN_Q) == 0) |
2560 | xlog_ins_ticketq(&log->l_reserve_headq, tic); | 2475 | xlog_ins_ticketq(&log->l_reserve_headq, tic); |
2561 | xlog_trace_loggrant(log, tic, | 2476 | |
2562 | "xlog_grant_log_space: sleep 2"); | 2477 | trace_xfs_log_grant_sleep2(log, tic); |
2478 | |||
2563 | spin_unlock(&log->l_grant_lock); | 2479 | spin_unlock(&log->l_grant_lock); |
2564 | xlog_grant_push_ail(log->l_mp, need_bytes); | 2480 | xlog_grant_push_ail(log->l_mp, need_bytes); |
2565 | spin_lock(&log->l_grant_lock); | 2481 | spin_lock(&log->l_grant_lock); |
@@ -2571,8 +2487,8 @@ redo: | |||
2571 | if (XLOG_FORCED_SHUTDOWN(log)) | 2487 | if (XLOG_FORCED_SHUTDOWN(log)) |
2572 | goto error_return; | 2488 | goto error_return; |
2573 | 2489 | ||
2574 | xlog_trace_loggrant(log, tic, | 2490 | trace_xfs_log_grant_wake2(log, tic); |
2575 | "xlog_grant_log_space: wake 2"); | 2491 | |
2576 | goto redo; | 2492 | goto redo; |
2577 | } else if (tic->t_flags & XLOG_TIC_IN_Q) | 2493 | } else if (tic->t_flags & XLOG_TIC_IN_Q) |
2578 | xlog_del_ticketq(&log->l_reserve_headq, tic); | 2494 | xlog_del_ticketq(&log->l_reserve_headq, tic); |
@@ -2592,7 +2508,7 @@ redo: | |||
2592 | ASSERT(log->l_grant_write_bytes <= BBTOB(BLOCK_LSN(tail_lsn))); | 2508 | ASSERT(log->l_grant_write_bytes <= BBTOB(BLOCK_LSN(tail_lsn))); |
2593 | } | 2509 | } |
2594 | #endif | 2510 | #endif |
2595 | xlog_trace_loggrant(log, tic, "xlog_grant_log_space: exit"); | 2511 | trace_xfs_log_grant_exit(log, tic); |
2596 | xlog_verify_grant_head(log, 1); | 2512 | xlog_verify_grant_head(log, 1); |
2597 | spin_unlock(&log->l_grant_lock); | 2513 | spin_unlock(&log->l_grant_lock); |
2598 | return 0; | 2514 | return 0; |
@@ -2600,7 +2516,9 @@ redo: | |||
2600 | error_return: | 2516 | error_return: |
2601 | if (tic->t_flags & XLOG_TIC_IN_Q) | 2517 | if (tic->t_flags & XLOG_TIC_IN_Q) |
2602 | xlog_del_ticketq(&log->l_reserve_headq, tic); | 2518 | xlog_del_ticketq(&log->l_reserve_headq, tic); |
2603 | xlog_trace_loggrant(log, tic, "xlog_grant_log_space: err_ret"); | 2519 | |
2520 | trace_xfs_log_grant_error(log, tic); | ||
2521 | |||
2604 | /* | 2522 | /* |
2605 | * If we are failing, make sure the ticket doesn't have any | 2523 | * If we are failing, make sure the ticket doesn't have any |
2606 | * current reservations. We don't want to add this back when | 2524 | * current reservations. We don't want to add this back when |
@@ -2640,7 +2558,8 @@ xlog_regrant_write_log_space(xlog_t *log, | |||
2640 | #endif | 2558 | #endif |
2641 | 2559 | ||
2642 | spin_lock(&log->l_grant_lock); | 2560 | spin_lock(&log->l_grant_lock); |
2643 | xlog_trace_loggrant(log, tic, "xlog_regrant_write_log_space: enter"); | 2561 | |
2562 | trace_xfs_log_regrant_write_enter(log, tic); | ||
2644 | 2563 | ||
2645 | if (XLOG_FORCED_SHUTDOWN(log)) | 2564 | if (XLOG_FORCED_SHUTDOWN(log)) |
2646 | goto error_return; | 2565 | goto error_return; |
@@ -2669,8 +2588,8 @@ xlog_regrant_write_log_space(xlog_t *log, | |||
2669 | if ((tic->t_flags & XLOG_TIC_IN_Q) == 0) | 2588 | if ((tic->t_flags & XLOG_TIC_IN_Q) == 0) |
2670 | xlog_ins_ticketq(&log->l_write_headq, tic); | 2589 | xlog_ins_ticketq(&log->l_write_headq, tic); |
2671 | 2590 | ||
2672 | xlog_trace_loggrant(log, tic, | 2591 | trace_xfs_log_regrant_write_sleep1(log, tic); |
2673 | "xlog_regrant_write_log_space: sleep 1"); | 2592 | |
2674 | spin_unlock(&log->l_grant_lock); | 2593 | spin_unlock(&log->l_grant_lock); |
2675 | xlog_grant_push_ail(log->l_mp, need_bytes); | 2594 | xlog_grant_push_ail(log->l_mp, need_bytes); |
2676 | spin_lock(&log->l_grant_lock); | 2595 | spin_lock(&log->l_grant_lock); |
@@ -2685,8 +2604,7 @@ xlog_regrant_write_log_space(xlog_t *log, | |||
2685 | if (XLOG_FORCED_SHUTDOWN(log)) | 2604 | if (XLOG_FORCED_SHUTDOWN(log)) |
2686 | goto error_return; | 2605 | goto error_return; |
2687 | 2606 | ||
2688 | xlog_trace_loggrant(log, tic, | 2607 | trace_xfs_log_regrant_write_wake1(log, tic); |
2689 | "xlog_regrant_write_log_space: wake 1"); | ||
2690 | } | 2608 | } |
2691 | } | 2609 | } |
2692 | 2610 | ||
@@ -2704,6 +2622,8 @@ redo: | |||
2704 | spin_lock(&log->l_grant_lock); | 2622 | spin_lock(&log->l_grant_lock); |
2705 | 2623 | ||
2706 | XFS_STATS_INC(xs_sleep_logspace); | 2624 | XFS_STATS_INC(xs_sleep_logspace); |
2625 | trace_xfs_log_regrant_write_sleep2(log, tic); | ||
2626 | |||
2707 | sv_wait(&tic->t_wait, PINOD|PLTWAIT, &log->l_grant_lock, s); | 2627 | sv_wait(&tic->t_wait, PINOD|PLTWAIT, &log->l_grant_lock, s); |
2708 | 2628 | ||
2709 | /* If we're shutting down, this tic is already off the queue */ | 2629 | /* If we're shutting down, this tic is already off the queue */ |
@@ -2711,8 +2631,7 @@ redo: | |||
2711 | if (XLOG_FORCED_SHUTDOWN(log)) | 2631 | if (XLOG_FORCED_SHUTDOWN(log)) |
2712 | goto error_return; | 2632 | goto error_return; |
2713 | 2633 | ||
2714 | xlog_trace_loggrant(log, tic, | 2634 | trace_xfs_log_regrant_write_wake2(log, tic); |
2715 | "xlog_regrant_write_log_space: wake 2"); | ||
2716 | goto redo; | 2635 | goto redo; |
2717 | } else if (tic->t_flags & XLOG_TIC_IN_Q) | 2636 | } else if (tic->t_flags & XLOG_TIC_IN_Q) |
2718 | xlog_del_ticketq(&log->l_write_headq, tic); | 2637 | xlog_del_ticketq(&log->l_write_headq, tic); |
@@ -2727,7 +2646,8 @@ redo: | |||
2727 | } | 2646 | } |
2728 | #endif | 2647 | #endif |
2729 | 2648 | ||
2730 | xlog_trace_loggrant(log, tic, "xlog_regrant_write_log_space: exit"); | 2649 | trace_xfs_log_regrant_write_exit(log, tic); |
2650 | |||
2731 | xlog_verify_grant_head(log, 1); | 2651 | xlog_verify_grant_head(log, 1); |
2732 | spin_unlock(&log->l_grant_lock); | 2652 | spin_unlock(&log->l_grant_lock); |
2733 | return 0; | 2653 | return 0; |
@@ -2736,7 +2656,9 @@ redo: | |||
2736 | error_return: | 2656 | error_return: |
2737 | if (tic->t_flags & XLOG_TIC_IN_Q) | 2657 | if (tic->t_flags & XLOG_TIC_IN_Q) |
2738 | xlog_del_ticketq(&log->l_reserve_headq, tic); | 2658 | xlog_del_ticketq(&log->l_reserve_headq, tic); |
2739 | xlog_trace_loggrant(log, tic, "xlog_regrant_write_log_space: err_ret"); | 2659 | |
2660 | trace_xfs_log_regrant_write_error(log, tic); | ||
2661 | |||
2740 | /* | 2662 | /* |
2741 | * If we are failing, make sure the ticket doesn't have any | 2663 | * If we are failing, make sure the ticket doesn't have any |
2742 | * current reservations. We don't want to add this back when | 2664 | * current reservations. We don't want to add this back when |
@@ -2760,8 +2682,8 @@ STATIC void | |||
2760 | xlog_regrant_reserve_log_space(xlog_t *log, | 2682 | xlog_regrant_reserve_log_space(xlog_t *log, |
2761 | xlog_ticket_t *ticket) | 2683 | xlog_ticket_t *ticket) |
2762 | { | 2684 | { |
2763 | xlog_trace_loggrant(log, ticket, | 2685 | trace_xfs_log_regrant_reserve_enter(log, ticket); |
2764 | "xlog_regrant_reserve_log_space: enter"); | 2686 | |
2765 | if (ticket->t_cnt > 0) | 2687 | if (ticket->t_cnt > 0) |
2766 | ticket->t_cnt--; | 2688 | ticket->t_cnt--; |
2767 | 2689 | ||
@@ -2769,8 +2691,9 @@ xlog_regrant_reserve_log_space(xlog_t *log, | |||
2769 | xlog_grant_sub_space(log, ticket->t_curr_res); | 2691 | xlog_grant_sub_space(log, ticket->t_curr_res); |
2770 | ticket->t_curr_res = ticket->t_unit_res; | 2692 | ticket->t_curr_res = ticket->t_unit_res; |
2771 | xlog_tic_reset_res(ticket); | 2693 | xlog_tic_reset_res(ticket); |
2772 | xlog_trace_loggrant(log, ticket, | 2694 | |
2773 | "xlog_regrant_reserve_log_space: sub current res"); | 2695 | trace_xfs_log_regrant_reserve_sub(log, ticket); |
2696 | |||
2774 | xlog_verify_grant_head(log, 1); | 2697 | xlog_verify_grant_head(log, 1); |
2775 | 2698 | ||
2776 | /* just return if we still have some of the pre-reserved space */ | 2699 | /* just return if we still have some of the pre-reserved space */ |
@@ -2780,8 +2703,9 @@ xlog_regrant_reserve_log_space(xlog_t *log, | |||
2780 | } | 2703 | } |
2781 | 2704 | ||
2782 | xlog_grant_add_space_reserve(log, ticket->t_unit_res); | 2705 | xlog_grant_add_space_reserve(log, ticket->t_unit_res); |
2783 | xlog_trace_loggrant(log, ticket, | 2706 | |
2784 | "xlog_regrant_reserve_log_space: exit"); | 2707 | trace_xfs_log_regrant_reserve_exit(log, ticket); |
2708 | |||
2785 | xlog_verify_grant_head(log, 0); | 2709 | xlog_verify_grant_head(log, 0); |
2786 | spin_unlock(&log->l_grant_lock); | 2710 | spin_unlock(&log->l_grant_lock); |
2787 | ticket->t_curr_res = ticket->t_unit_res; | 2711 | ticket->t_curr_res = ticket->t_unit_res; |
@@ -2811,11 +2735,11 @@ xlog_ungrant_log_space(xlog_t *log, | |||
2811 | ticket->t_cnt--; | 2735 | ticket->t_cnt--; |
2812 | 2736 | ||
2813 | spin_lock(&log->l_grant_lock); | 2737 | spin_lock(&log->l_grant_lock); |
2814 | xlog_trace_loggrant(log, ticket, "xlog_ungrant_log_space: enter"); | 2738 | trace_xfs_log_ungrant_enter(log, ticket); |
2815 | 2739 | ||
2816 | xlog_grant_sub_space(log, ticket->t_curr_res); | 2740 | xlog_grant_sub_space(log, ticket->t_curr_res); |
2817 | 2741 | ||
2818 | xlog_trace_loggrant(log, ticket, "xlog_ungrant_log_space: sub current"); | 2742 | trace_xfs_log_ungrant_sub(log, ticket); |
2819 | 2743 | ||
2820 | /* If this is a permanent reservation ticket, we may be able to free | 2744 | /* If this is a permanent reservation ticket, we may be able to free |
2821 | * up more space based on the remaining count. | 2745 | * up more space based on the remaining count. |
@@ -2825,7 +2749,8 @@ xlog_ungrant_log_space(xlog_t *log, | |||
2825 | xlog_grant_sub_space(log, ticket->t_unit_res*ticket->t_cnt); | 2749 | xlog_grant_sub_space(log, ticket->t_unit_res*ticket->t_cnt); |
2826 | } | 2750 | } |
2827 | 2751 | ||
2828 | xlog_trace_loggrant(log, ticket, "xlog_ungrant_log_space: exit"); | 2752 | trace_xfs_log_ungrant_exit(log, ticket); |
2753 | |||
2829 | xlog_verify_grant_head(log, 1); | 2754 | xlog_verify_grant_head(log, 1); |
2830 | spin_unlock(&log->l_grant_lock); | 2755 | spin_unlock(&log->l_grant_lock); |
2831 | xfs_log_move_tail(log->l_mp, 1); | 2756 | xfs_log_move_tail(log->l_mp, 1); |