[Bug 266158] bio_length and bio_bcount in the GEOM bio structure are documented to be the same, but they are not

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 01 Sep 2022 14:09:05 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266158

            Bug ID: 266158
           Summary: bio_length and bio_bcount in the GEOM bio structure
                    are documented to be the same, but they are not
           Product: Base System
           Version: 13.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: 0mp@FreeBSD.org

In the source code (sys/sys/bio.h), bio_bcount is documented as "Valid bytes in
buffer". bio_length is documented as "Like bio_bcount". Unfortunately, they are
not the same. Here's a sh(1) script to show that:

    # Create a memory device.
    md=$(mdconfig -s 1G)
    # Trace the io subsystem when the dd command is executing. Limit the
results to
    # the PID of the dd command only.
    dtrace -n '
            io:::start /pid == $target/ {
                    @bcount[execname] = quantize(args[0]->bio_bcount);
                    @length[execname] = quantize(args[0]->bio_length);
            }
    ' -c "dd if=/dev/random of=/dev/$md bs=1m count=230 oflag=sync"
    # Remove the memory device.
    mdconfig -d -u "$md"

-- 
You are receiving this mail because:
You are the assignee for the bug.