]> sourceware.org Git - systemtap.git/commitdiff
Update dev.stp tapset for Linux 6.10
authorWilliam Cohen <wcohen@redhat.com>
Tue, 25 Jun 2024 02:52:32 +0000 (22:52 -0400)
committerWilliam Cohen <wcohen@redhat.com>
Thu, 27 Jun 2024 18:47:48 +0000 (14:47 -0400)
Linux 6.10 changes how the partition number is stored in struct block_device.
Linux kernel git commit 1116b9fa15c097 puts the partition number in the lower
8 bits of the __bd_flags and uses an accessor function to obtain it.  The
dev.stp tapset has been adjusted to work with this newer data structure.

tapset/linux/dev.stp

index 4b85b7f25d9b5eaba2e61d525ce1b77c6c9dbcda..f6b90c5d38eb139de4ca2e2224944b98cab1a235 100644 (file)
@@ -64,6 +64,18 @@ function disk_name:string(hd:long, partno:long)
                return sprintf("%s%d", disk_name, partno)
 }
 
+%( kernel_v >= "6.10" %?
+%{
+#include <linux/blkdev.h>
+%}
+
+function bdev_partno(bdev:long)
+%{ /* pure */ /* unprivileged */
+  STAP_RETURN(bdev_partno((const struct block_device *) STAP_ARG_bdev));
+%}
+%:
+%)
+
 function bdevname:string(bdev:long)
 {
        bdev = & @cast(bdev, "block_device", "kernel")
@@ -72,11 +84,15 @@ function bdevname:string(bdev:long)
 
        hd = bdev->bd_disk
 
+%( kernel_v >= "6.10" %?
+       partno = bdev_partno(bdev)
+%:
        if (@defined(@cast(bdev, "block_device", "kernel")->bd_partno))
                partno = bdev->bd_partno
        else if (bdev->bd_part)
                partno = bdev->bd_part->partno
        else
                partno = MINOR(bdev->bd_dev) - hd->first_minor;
+%)
        return disk_name(hd, partno)
 }
This page took 0.027794 seconds and 5 git commands to generate.