Commit 5ddb88f2 authored by Andreas Hindborg's avatar Andreas Hindborg Committed by Jens Axboe

rust: block: do not use removed queue flag API

`blk_queue_flag_set` and `blk_queue_flag_clear` was removed in favor of a
new API. This caused a build error for Rust block device abstractions.
Thus, use the new feature passing API instead of the old removed API.

Fixes: bd4a633b ("block: move the nonrot flag to queue_limits")
Signed-off-by: default avatarAndreas Hindborg <a.hindborg@samsung.com>
Link: https://lore.kernel.org/r/20240620085721.1218296-1-nmi@metaspace.dkSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 69c34f07
...@@ -100,6 +100,9 @@ pub fn build<T: Operations>( ...@@ -100,6 +100,9 @@ pub fn build<T: Operations>(
lim.logical_block_size = self.logical_block_size; lim.logical_block_size = self.logical_block_size;
lim.physical_block_size = self.physical_block_size; lim.physical_block_size = self.physical_block_size;
if self.rotational {
lim.features = bindings::BLK_FEAT_ROTATIONAL;
}
// SAFETY: `tagset.raw_tag_set()` points to a valid and initialized tag set // SAFETY: `tagset.raw_tag_set()` points to a valid and initialized tag set
let gendisk = from_err_ptr(unsafe { let gendisk = from_err_ptr(unsafe {
...@@ -152,20 +155,6 @@ pub fn build<T: Operations>( ...@@ -152,20 +155,6 @@ pub fn build<T: Operations>(
// operation, so we will not race. // operation, so we will not race.
unsafe { bindings::set_capacity(gendisk, self.capacity_sectors) }; unsafe { bindings::set_capacity(gendisk, self.capacity_sectors) };
if !self.rotational {
// SAFETY: `gendisk` points to a valid and initialized instance of
// `struct gendisk`. This operation uses a relaxed atomic bit flip
// operation, so there is no race on this field.
unsafe { bindings::blk_queue_flag_set(bindings::QUEUE_FLAG_NONROT, (*gendisk).queue) };
} else {
// SAFETY: `gendisk` points to a valid and initialized instance of
// `struct gendisk`. This operation uses a relaxed atomic bit flip
// operation, so there is no race on this field.
unsafe {
bindings::blk_queue_flag_clear(bindings::QUEUE_FLAG_NONROT, (*gendisk).queue)
};
}
crate::error::to_result( crate::error::to_result(
// SAFETY: `gendisk` points to a valid and initialized instance of // SAFETY: `gendisk` points to a valid and initialized instance of
// `struct gendisk`. // `struct gendisk`.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment