diff options
Diffstat (limited to 'fs/xfs/xfs_alloc_btree.c')
-rw-r--r-- | fs/xfs/xfs_alloc_btree.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/fs/xfs/xfs_alloc_btree.c b/fs/xfs/xfs_alloc_btree.c index 4d44f03858b0..9e63f8c180d9 100644 --- a/fs/xfs/xfs_alloc_btree.c +++ b/fs/xfs/xfs_alloc_btree.c | |||
@@ -311,6 +311,45 @@ xfs_allocbt_kill_root( | |||
311 | return 0; | 311 | return 0; |
312 | } | 312 | } |
313 | 313 | ||
314 | #ifdef DEBUG | ||
315 | STATIC int | ||
316 | xfs_allocbt_keys_inorder( | ||
317 | struct xfs_btree_cur *cur, | ||
318 | union xfs_btree_key *k1, | ||
319 | union xfs_btree_key *k2) | ||
320 | { | ||
321 | if (cur->bc_btnum == XFS_BTNUM_BNO) { | ||
322 | return be32_to_cpu(k1->alloc.ar_startblock) < | ||
323 | be32_to_cpu(k2->alloc.ar_startblock); | ||
324 | } else { | ||
325 | return be32_to_cpu(k1->alloc.ar_blockcount) < | ||
326 | be32_to_cpu(k2->alloc.ar_blockcount) || | ||
327 | (k1->alloc.ar_blockcount == k2->alloc.ar_blockcount && | ||
328 | be32_to_cpu(k1->alloc.ar_startblock) < | ||
329 | be32_to_cpu(k2->alloc.ar_startblock)); | ||
330 | } | ||
331 | } | ||
332 | |||
333 | STATIC int | ||
334 | xfs_allocbt_recs_inorder( | ||
335 | struct xfs_btree_cur *cur, | ||
336 | union xfs_btree_rec *r1, | ||
337 | union xfs_btree_rec *r2) | ||
338 | { | ||
339 | if (cur->bc_btnum == XFS_BTNUM_BNO) { | ||
340 | return be32_to_cpu(r1->alloc.ar_startblock) + | ||
341 | be32_to_cpu(r1->alloc.ar_blockcount) <= | ||
342 | be32_to_cpu(r2->alloc.ar_startblock); | ||
343 | } else { | ||
344 | return be32_to_cpu(r1->alloc.ar_blockcount) < | ||
345 | be32_to_cpu(r2->alloc.ar_blockcount) || | ||
346 | (r1->alloc.ar_blockcount == r2->alloc.ar_blockcount && | ||
347 | be32_to_cpu(r1->alloc.ar_startblock) < | ||
348 | be32_to_cpu(r2->alloc.ar_startblock)); | ||
349 | } | ||
350 | } | ||
351 | #endif /* DEBUG */ | ||
352 | |||
314 | #ifdef XFS_BTREE_TRACE | 353 | #ifdef XFS_BTREE_TRACE |
315 | ktrace_t *xfs_allocbt_trace_buf; | 354 | ktrace_t *xfs_allocbt_trace_buf; |
316 | 355 | ||
@@ -395,6 +434,11 @@ static const struct xfs_btree_ops xfs_allocbt_ops = { | |||
395 | .init_ptr_from_cur = xfs_allocbt_init_ptr_from_cur, | 434 | .init_ptr_from_cur = xfs_allocbt_init_ptr_from_cur, |
396 | .key_diff = xfs_allocbt_key_diff, | 435 | .key_diff = xfs_allocbt_key_diff, |
397 | 436 | ||
437 | #ifdef DEBUG | ||
438 | .keys_inorder = xfs_allocbt_keys_inorder, | ||
439 | .recs_inorder = xfs_allocbt_recs_inorder, | ||
440 | #endif | ||
441 | |||
398 | #ifdef XFS_BTREE_TRACE | 442 | #ifdef XFS_BTREE_TRACE |
399 | .trace_enter = xfs_allocbt_trace_enter, | 443 | .trace_enter = xfs_allocbt_trace_enter, |
400 | .trace_cursor = xfs_allocbt_trace_cursor, | 444 | .trace_cursor = xfs_allocbt_trace_cursor, |