Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dm-writeboost-target.c: Fix build error in 6.10 #259

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/dm-writeboost-target.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ int wb_io_internal(struct wb_device *wb, struct dm_io_request *io_req,

sector_t dm_devsize(struct dm_dev *dev)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
return i_size_read(dev->bdev->bd_inode) >> 9;
#else
return bdev_nr_sectors(dev->bdev);
#endif
Comment on lines +119 to +123
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bdev_nr_sectors was added in 5.11, so we could switch this to build with 5.11+ kernels instead. I'm unsure what the best practice here is though.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WestonReed Thank you for the PR.

Not sure this is the best practice in the community though, I think the switch boundary should be 5.11 to make the code more informative: your suggestion here seems to me that bdev_nr_sectors was introduced in 6.10.

}

/*----------------------------------------------------------------------------*/
Expand Down