Skip to content

Commit 5ddb88f

Browse files
metaspaceaxboe
authored andcommitted
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: bd4a633 ("block: move the nonrot flag to queue_limits") Signed-off-by: Andreas Hindborg <a.hindborg@samsung.com> Link: https://lore.kernel.org/r/20240620085721.1218296-1-nmi@metaspace.dk Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 69c34f0 commit 5ddb88f

1 file changed

Lines changed: 3 additions & 14 deletions

File tree

rust/kernel/block/mq/gen_disk.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ impl GenDiskBuilder {
100100

101101
lim.logical_block_size = self.logical_block_size;
102102
lim.physical_block_size = self.physical_block_size;
103+
if self.rotational {
104+
lim.features = bindings::BLK_FEAT_ROTATIONAL;
105+
}
103106

104107
// SAFETY: `tagset.raw_tag_set()` points to a valid and initialized tag set
105108
let gendisk = from_err_ptr(unsafe {
@@ -152,20 +155,6 @@ impl GenDiskBuilder {
152155
// operation, so we will not race.
153156
unsafe { bindings::set_capacity(gendisk, self.capacity_sectors) };
154157

155-
if !self.rotational {
156-
// SAFETY: `gendisk` points to a valid and initialized instance of
157-
// `struct gendisk`. This operation uses a relaxed atomic bit flip
158-
// operation, so there is no race on this field.
159-
unsafe { bindings::blk_queue_flag_set(bindings::QUEUE_FLAG_NONROT, (*gendisk).queue) };
160-
} else {
161-
// SAFETY: `gendisk` points to a valid and initialized instance of
162-
// `struct gendisk`. This operation uses a relaxed atomic bit flip
163-
// operation, so there is no race on this field.
164-
unsafe {
165-
bindings::blk_queue_flag_clear(bindings::QUEUE_FLAG_NONROT, (*gendisk).queue)
166-
};
167-
}
168-
169158
crate::error::to_result(
170159
// SAFETY: `gendisk` points to a valid and initialized instance of
171160
// `struct gendisk`.

0 commit comments

Comments
 (0)