summaryrefslogtreecommitdiff
path: root/block/elevator.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2022-10-20 08:48:16 +0200
committerJens Axboe <axboe@kernel.dk>2022-10-23 18:59:17 -0600
commitdd6f7f17bf5831ac94d2b8ffe3d67dac201a9b97 (patch)
treec2898bdc5199cb3de5027f38df1afd042f6a78c6 /block/elevator.h
parent671fae5e51297fc76b3758ca2edd514858734a6a (diff)
block: add proper helpers for elevator_type module refcount management
Make sure we have helpers for all relevant module refcount operations on the elevator_type in elevator.h, and use them. Move the call to the get helper in blk_mq_elv_switch_none a bit so that it is obvious with a less verbose comment. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20221020064819.1469928-2-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/elevator.h')
-rw-r--r--block/elevator.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/block/elevator.h b/block/elevator.h
index 75382471222d..774a8f6b99e6 100644
--- a/block/elevator.h
+++ b/block/elevator.h
@@ -84,6 +84,21 @@ struct elevator_type
struct list_head list;
};
+static inline bool elevator_tryget(struct elevator_type *e)
+{
+ return try_module_get(e->elevator_owner);
+}
+
+static inline void __elevator_get(struct elevator_type *e)
+{
+ __module_get(e->elevator_owner);
+}
+
+static inline void elevator_put(struct elevator_type *e)
+{
+ module_put(e->elevator_owner);
+}
+
#define ELV_HASH_BITS 6
void elv_rqhash_del(struct request_queue *q, struct request *rq);