Page MenuHomeFreeBSD

Improve BUF_TRACKING.
ClosedPublic

Authored by trasz on Apr 20 2017, 9:26 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 8 2024, 4:35 AM
Unknown Object (File)
Jan 23 2024, 2:51 PM
Unknown Object (File)
Jan 13 2024, 12:25 AM
Unknown Object (File)
Dec 23 2023, 2:46 AM
Unknown Object (File)
Dec 18 2023, 1:51 PM
Unknown Object (File)
Dec 12 2023, 8:07 PM
Unknown Object (File)
Dec 3 2023, 4:12 AM
Unknown Object (File)
Dec 2 2023, 9:31 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.