Page MenuHomeFreeBSD

Improve BUF_TRACKING.
ClosedPublic

Authored by trasz on Apr 20 2017, 9:26 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jan 25, 9:33 AM
Unknown Object (File)
Oct 28 2024, 10:27 AM
Unknown Object (File)
Oct 2 2024, 1:46 PM
Unknown Object (File)
Oct 1 2024, 10:42 AM
Unknown Object (File)
Sep 30 2024, 9:01 AM
Unknown Object (File)
Sep 30 2024, 12:33 AM
Unknown Object (File)
Sep 28 2024, 5:15 PM
Unknown Object (File)
Sep 27 2024, 9:13 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.