25-akpm/fs/ext3/balloc.c | 33 +++++++++++++++++++++++++++++---- 1 files changed, 29 insertions(+), 4 deletions(-) diff -puN fs/ext3/balloc.c~fnup-stats fs/ext3/balloc.c --- 25/fs/ext3/balloc.c~fnup-stats Tue Jul 1 16:26:48 2003 +++ 25-akpm/fs/ext3/balloc.c Tue Jul 1 16:32:51 2003 @@ -279,6 +279,19 @@ error_return: return; } +struct fnub { + int ext3_test_allocatable_calls; + int find_next_usable_block_calls; + int occupied; + int closeby; + int not_closeby; + int memscan_worked; + int bitmap_scan_worked; + int ext3_try_to_allocate_calls; + int claim_block_succeeded; + int claim_block_failed; +} fnub; + /* For ext3 allocations, we must not reuse any blocks which are * allocated in the bitmap buffer's "last committed data" copy. This * prevents deletes from freeing up the page for reuse until we have @@ -297,6 +310,7 @@ error_return: static inline int ext3_test_allocatable(int nr, struct buffer_head *bh, int have_access) { + fnub.ext3_test_allocatable_calls++; if (ext3_test_bit(nr, bh->b_data)) return 0; if (!have_access || !buffer_jbd(bh) || !bh2jh(bh)->b_committed_data) @@ -317,6 +331,7 @@ static int find_next_usable_block(int st int here, next; char *p, *r; + fnub.find_next_usable_block_calls++; if (start > 0) { /* * The goal was occupied; search forward for a free @@ -327,11 +342,14 @@ static int find_next_usable_block(int st * next 64-bit boundary is simple.. */ int end_goal = (start + 63) & ~63; + fnub.occupied++; here = ext3_find_next_zero_bit(bh->b_data, end_goal, start); if (here < end_goal && - ext3_test_allocatable(here, bh, have_access)) + ext3_test_allocatable(here, bh, have_access)) { + fnub.closeby++; return here; - + } + fnub.not_closeby++; ext3_debug ("Bit not found near goal\n"); } @@ -351,8 +369,10 @@ static int find_next_usable_block(int st r = memscan(p, 0, (maxblocks - here + 7) >> 3); next = (r - ((char *) bh->b_data)) << 3; - if (next < maxblocks && ext3_test_allocatable(next, bh, have_access)) + if (next < maxblocks && ext3_test_allocatable(next, bh, have_access)) { + fnub.memscan_worked++; return next; + } /* The bitmap search --- search forward alternately * through the actual bitmap and the last-committed copy @@ -363,8 +383,10 @@ static int find_next_usable_block(int st maxblocks, here); if (next >= maxblocks) return -1; - if (ext3_test_allocatable(next, bh, have_access)) + if (ext3_test_allocatable(next, bh, have_access)) { + fnub.bitmap_scan_worked++; return next; + } if (have_access) here = ext3_find_next_zero_bit @@ -408,6 +430,7 @@ ext3_try_to_allocate(struct super_block int credits = 0; *errp = 0; + fnub.ext3_try_to_allocate_calls++; if (goal >= 0 && ext3_test_allocatable(goal, bitmap_bh, 0)) goto got; @@ -447,11 +470,13 @@ got: * The block was allocated by another thread, or it was * allocated and then freed by another thread */ + fnub.claim_block_failed++; goal++; if (goal >= EXT3_BLOCKS_PER_GROUP(sb)) goto fail; goto repeat; } + fnub.claim_block_succeeded++; BUFFER_TRACE(bitmap_bh, "journal_dirty_metadata for bitmap block"); jbd_unlock_bh_state(bitmap_bh); _