linux/block/elevator.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ELEVATOR_H
#define _ELEVATOR_H

#include <linux/percpu.h>
#include <linux/hashtable.h>
#include "blk-mq.h"

struct io_cq;
struct elevator_type;
struct blk_mq_debugfs_attr;

/*
 * Return values from elevator merger
 */
enum elv_merge {};

struct blk_mq_alloc_data;
struct blk_mq_hw_ctx;

struct elevator_mq_ops {};

#define ELV_NAME_MAX

struct elv_fs_entry {};

/*
 * identifies an elevator type, such as AS or deadline
 */
struct elevator_type
{};

static inline bool elevator_tryget(struct elevator_type *e)
{}

static inline void __elevator_get(struct elevator_type *e)
{}

static inline void elevator_put(struct elevator_type *e)
{}

#define ELV_HASH_BITS

void elv_rqhash_del(struct request_queue *q, struct request *rq);
void elv_rqhash_add(struct request_queue *q, struct request *rq);
void elv_rqhash_reposition(struct request_queue *q, struct request *rq);
struct request *elv_rqhash_find(struct request_queue *q, sector_t offset);

/*
 * each queue has an elevator_queue associated with it
 */
struct elevator_queue
{};

#define ELEVATOR_FLAG_REGISTERED
#define ELEVATOR_FLAG_DISABLE_WBT

/*
 * block elevator interface
 */
extern enum elv_merge elv_merge(struct request_queue *, struct request **,
		struct bio *);
extern void elv_merge_requests(struct request_queue *, struct request *,
			       struct request *);
extern void elv_merged_request(struct request_queue *, struct request *,
		enum elv_merge);
extern bool elv_attempt_insert_merge(struct request_queue *, struct request *,
				     struct list_head *);
extern struct request *elv_former_request(struct request_queue *, struct request *);
extern struct request *elv_latter_request(struct request_queue *, struct request *);
void elevator_init_mq(struct request_queue *q);

/*
 * io scheduler registration
 */
extern int elv_register(struct elevator_type *);
extern void elv_unregister(struct elevator_type *);

/*
 * io scheduler sysfs switching
 */
ssize_t elv_iosched_show(struct gendisk *disk, char *page);
ssize_t elv_iosched_store(struct gendisk *disk, const char *page, size_t count);

extern bool elv_bio_merge_ok(struct request *, struct bio *);
extern struct elevator_queue *elevator_alloc(struct request_queue *,
					struct elevator_type *);

/*
 * Helper functions.
 */
extern struct request *elv_rb_former_request(struct request_queue *, struct request *);
extern struct request *elv_rb_latter_request(struct request_queue *, struct request *);

/*
 * rb support functions.
 */
extern void elv_rb_add(struct rb_root *, struct request *);
extern void elv_rb_del(struct rb_root *, struct request *);
extern struct request *elv_rb_find(struct rb_root *, sector_t);

/*
 * Insertion selection
 */
#define ELEVATOR_INSERT_FRONT
#define ELEVATOR_INSERT_BACK
#define ELEVATOR_INSERT_SORT
#define ELEVATOR_INSERT_REQUEUE
#define ELEVATOR_INSERT_FLUSH
#define ELEVATOR_INSERT_SORT_MERGE

#define rb_entry_rq(node)

#define rq_entry_fifo(ptr)
#define rq_fifo_clear(rq)

#endif /* _ELEVATOR_H */