Closed meke closed 3 years ago
Here is the compile error message with 2.2.13 and 5.11. With 5.10, it was ok.
/home/akira/dm-writeboost/src/dm-writeboost-daemon.c: In function ‘writeback_modulator_proc’:
/home/akira/dm-writeboost/src/dm-writeboost-daemon.c:484:48: error: ‘struct block_device’ has no member named ‘bd_part’; did you mean ‘bd_partno’?
struct hd_struct *hd = wb->backing_dev->bdev->bd_part;
^~~~~~~
bd_partno
In file included from /home/akira/dm-writeboost/src/dm-writeboost-daemon.c:25:
./include/linux/part_stat.h:35:15: error: dereferencing pointer to incomplete type ‘struct hd_struct’
typeof((part)->bd_stats->field) res = 0; \
^~
/home/akira/dm-writeboost/src/dm-writeboost-daemon.c:489:26: note: in expansion of macro ‘part_stat_read’
new = jiffies_to_msecs(part_stat_read(hd, io_ticks));
^~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:279: /home/akira/dm-writeboost/src/dm-writeboost-daemon.o] Error 1
make[1]: *** [Makefile:1800: /home/akira/dm-writeboost/src] Error 2
make[1]: Leaving directory '/home/akira/linux'
make: *** [Makefile:11: all] Error 2
Confirmed that the patch fixes the compile error.
Let's look at a code in a main tree. (drivers/nvme/target/admin-cmd.c)
5.10
xa_for_each(&ctrl->subsys->namespaces, idx, ns) {
/* we don't have the right data for file backed ns */
if (!ns->bdev)
continue;
host_reads += part_stat_read(ns->bdev->bd_part, ios[READ]);
5.11
xa_for_each(&ctrl->subsys->namespaces, idx, ns) {
/* we don't have the right data for file backed ns */
if (!ns->bdev)
continue;
host_reads += part_stat_read(ns->bdev, ios[READ]);
@meke I will drop this one because piso77 has submitted a complete PR. I expected you to update the patch quickly so I can approve it.
The part_stat_read function has changed in Linux-5.11, so I made a patch for it.
I am not sure about it, so please review it.