diff mbox series

rust: block: do not use removed queue flag API

Message ID 20240620085721.1218296-1-nmi@metaspace.dk (mailing list archive)
State New, archived
Headers show
Series rust: block: do not use removed queue flag API | expand

Commit Message

Andreas Hindborg June 20, 2024, 8:57 a.m. UTC
From: Andreas Hindborg <a.hindborg@samsung.com>

`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: bd4a633b6f7c ("block: move the nonrot flag to queue_limits")
Signed-off-by: Andreas Hindborg <a.hindborg@samsung.com>
---
 rust/kernel/block/mq/gen_disk.rs | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)


base-commit: 43ccacc7be96b71bf8c1461036034f1174be2f4d

Comments

Jens Axboe June 20, 2024, 12:56 p.m. UTC | #1
On Thu, 20 Jun 2024 10:57:21 +0200, Andreas Hindborg wrote:
> `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.
> 
> 

Applied, thanks!

[1/1] rust: block: do not use removed queue flag API
      commit: 5ddb88f22eb97218d9295e69c39e0ff7cc64e09c

Best regards,
diff mbox series

Patch

diff --git a/rust/kernel/block/mq/gen_disk.rs b/rust/kernel/block/mq/gen_disk.rs
index e06044b549e0..f548a6199847 100644
--- a/rust/kernel/block/mq/gen_disk.rs
+++ b/rust/kernel/block/mq/gen_disk.rs
@@ -100,6 +100,9 @@  pub fn build<T: Operations>(
 
         lim.logical_block_size = self.logical_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
         let gendisk = from_err_ptr(unsafe {
@@ -152,20 +155,6 @@  pub fn build<T: Operations>(
         // operation, so we will not race.
         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(
             // SAFETY: `gendisk` points to a valid and initialized instance of
             // `struct gendisk`.