Page MenuHomeFreeBSD

dtrace_io.4: Use bio_length instead of bio_bcount in examples
ClosedPublic

Authored by 0mp on Sun, Oct 26, 5:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 2, 7:40 PM
Unknown Object (File)
Sun, Nov 2, 6:19 AM
Unknown Object (File)
Sat, Nov 1, 5:57 PM
Unknown Object (File)
Sat, Nov 1, 10:45 AM
Unknown Object (File)
Sat, Nov 1, 10:45 AM
Unknown Object (File)
Sat, Nov 1, 10:45 AM
Unknown Object (File)
Sat, Nov 1, 6:25 AM
Unknown Object (File)
Tue, Oct 28, 10:37 PM
Subscribers

Details

Summary

It seems like bio_length is preferred. Tracing bio_bcount makes little
sense for some devices like for example md(4), as it is set to "0"
instead of the I/O length.

Unfortunately, the reason behind having both bio_length and bio_bcount
in struct bio is not well documented. The FreeBSD commit log contains
hints that bio_length is preferred, but I couldn't find anything
definitive.

MFC after: 2 weeks

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

0mp requested review of this revision.Sun, Oct 26, 5:04 PM

The original intent was to get rid of of bio_bcount but I never got around to convering CAM.

(No opinion on the patch.)

In D53365#1218884, @phk wrote:

The original intent was to get rid of of bio_bcount but I never got around to convering CAM.

(No opinion on the patch.)

Great! Thanks for clarifying that!

Do we still want to convert all bio_bcount to bio_length and remove bio_bcount? That sounds like a fairly nice project.

Cam still uses bcount. I came here to ask what the actual difference between the two is.

In D53365#1219060, @imp wrote:

Cam still uses bcount. I came here to ask what the actual difference between the two is.

BTW, bio_length was introduced in 23b8e16947ff3426a6b08e497bcc1783a146d180 during an augmentation of struct bio for GEOM.

I could have told you that :-)

In D53365#1219430, @0mp wrote:
In D53365#1219060, @imp wrote:

Cam still uses bcount. I came here to ask what the actual difference between the two is.

BTW, bio_length was introduced in 23b8e16947ff3426a6b08e497bcc1783a146d180 during an augmentation of struct bio for GEOM.

And then it became a non-temporary part of struct bio in 61e1c1f39ee6e1e15e19789d7b8d6bee1b89ec58.

In D53365#1219431, @phk wrote:

I could have told you that :-)

So does it all mean that FreeBSD ultimately should document that bio_bcount is deprecated and transition to bio_length?

I am not sure if we would like to remove bio_bcount completely considering that it's been in the tree for a long time but that's out of scope ;)

A simple experiment, dtrace -n 'io:::start /args[0]->bio_length != args[0]->bio_bcount/{printf("%d %d", args[0]->bio_length, args[0]->bio_bcount); stack();}', shows some cases where bio_length is set but bio_bcount is not, i.e., it's 0.

We should try and get rid of bio_bcount if it serves no purpose.

This revision is now accepted and ready to land.Tue, Oct 28, 4:10 PM

I'll wait a couple of days before committing this to let others have a chance to respond to this revision.