pkoutoupis/rapiddisk

Build error with kernel 6.10

Opened this issue · 3 comments

When compiling the module with kernel 6.10, the following error message occurs:

drivers/block/rapiddisk/rapiddisk-cache.c:1045:47: error: no member named 'bd_inode' in 'struct block_device'
 1045 |                 dmc->size = to_sector(dmc->cache_dev->bdev->bd_inode->i_size);
      |                                       ~~~~~~~~~~~~~~~~~~~~  ^
drivers/block/rapiddisk/rapiddisk-cache.c:1081:45: error: no member named 'bd_inode' in 'struct block_device'
 1081 |         dev_size = to_sector(dmc->cache_dev->bdev->bd_inode->i_size);
      |                              ~~~~~~~~~~~~~~~~~~~~  ^
2 errors generated.

The link to the kernel code modification that produces the error.

Regards

Can we replace to_sector(dmc->cache_dev->bdev->bd_inode->i_size) with bdev_nr_sectors(dmc->cache_dev->bdev) ?
bdev_nr_sectors() was introduced in Linux v5.11 (torvalds/linux@a782483)

I will need to look into this, although time has not been kind to me lately and I do apologize for the delay in everything.

Can we replace to_sector(dmc->cache_dev->bdev->bd_inode->i_size) with bdev_nr_sectors(dmc->cache_dev->bdev) ? bdev_nr_sectors() was introduced in Linux v5.11 (torvalds/linux@a782483)

I have tested it and it works. Thanks for the contribution. @anbe42