Page MenuHomeFreeBSD

Improve BUF_TRACKING.
ClosedPublic

Authored by trasz on Apr 20 2017, 9:26 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Sep 11, 8:44 AM
Unknown Object (File)
Wed, Sep 10, 10:42 AM
Unknown Object (File)
Wed, Aug 27, 3:39 PM
Unknown Object (File)
Sun, Aug 24, 5:20 AM
Unknown Object (File)
Aug 13 2025, 11:32 PM
Unknown Object (File)
Aug 12 2025, 2:01 PM
Unknown Object (File)
Aug 8 2025, 11:30 AM
Unknown Object (File)
Aug 4 2025, 3:42 AM
Subscribers

Details

Summary

Make BUF_TRACKING a bit more user-friendly by:

  1. Not displaying "(null)" entries, and
  2. Separating entries by ", " instead of newlines

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/kern/vfs_bio.c
4929 ↗(On Diff #27591)

I don't think this works correctly. b_io_tracking is a circular buffer of size BUF_TRACKING_SIZE; b_io_tcnt is an index into b_io_tracking, mod BUF_TRACKING_SIZE.

Either way: the point of the loop is to walk the entire circular buffer and no more. This change breaks that.

Maybe instead: j <= min(bp->b_io_tcnt + 1, BUF_TRACKING_SIZE)? That would still break output near where b_io_tcnt wraps at 4 billion, but at least it would be fairly unlikely.

Or keep the existing iteration, but check for and skip NULL values? That's straightforward.

4930–4932 ↗(On Diff #27591)

I prefer one trace per line, similar to stack frames in backtraces. Why mash it all together?

trasz added inline comments.
sys/kern/vfs_bio.c
4929 ↗(On Diff #27591)

You're right; I've reworked it to just check for NULLs instead.

4930–4932 ↗(On Diff #27591)

Mostly to conserve the screen space; it's somewhat annoying when you do "show lockedbufs" and then realize you can't stop the output by pressing 'q' - for some reason it then just stops paging and decides to display everything, and the console output can take a few minutes.

Still, just checking for NULL improves things a lot, so I've just dropped this part of the diff.

Looks good to me.

sys/kern/vfs_bio.c
4948–4952 ↗(On Diff #27653)

I suspect we should add a if (db_pager_quit) break; to this loop (and probably the other looped commands below) to fix the overprint issue.

This revision is now accepted and ready to land.Apr 23 2017, 5:02 PM
This revision was automatically updated to reflect the committed changes.
trasz marked an inline comment as done.

Thanks for the db_pager_quit hint; that was it. :-)

Thanks for the db_pager_quit hint; that was it. :-)

Great :-). It's missing from a lot of db command output, unfortunately.