#undef pr_fmt
#define pr_fmt(fmt) …
#include <linux/module.h>
#include <linux/blkdev.h>
#include <linux/hdreg.h>
#include <linux/scatterlist.h>
#include <linux/idr.h>
#include "rnbd-clt.h"
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
static int rnbd_client_major;
static DEFINE_IDA(index_ida);
static DEFINE_MUTEX(sess_lock);
static LIST_HEAD(sess_list);
static struct workqueue_struct *rnbd_clt_wq;
#define RNBD_PART_BITS …
static inline bool rnbd_clt_get_sess(struct rnbd_clt_session *sess)
{ … }
static void free_sess(struct rnbd_clt_session *sess);
static void rnbd_clt_put_sess(struct rnbd_clt_session *sess)
{ … }
static void rnbd_clt_put_dev(struct rnbd_clt_dev *dev)
{ … }
static inline bool rnbd_clt_get_dev(struct rnbd_clt_dev *dev)
{ … }
static void rnbd_clt_change_capacity(struct rnbd_clt_dev *dev,
sector_t new_nsectors)
{ … }
static int process_msg_open_rsp(struct rnbd_clt_dev *dev,
struct rnbd_msg_open_rsp *rsp)
{ … }
int rnbd_clt_resize_disk(struct rnbd_clt_dev *dev, sector_t newsize)
{ … }
static inline void rnbd_clt_dev_requeue(struct rnbd_queue *q)
{ … }
enum { … };
static struct rnbd_cpu_qlist *
rnbd_get_cpu_qlist(struct rnbd_clt_session *sess, int cpu)
{ … }
static inline int nxt_cpu(int cpu)
{ … }
static bool rnbd_rerun_if_needed(struct rnbd_clt_session *sess)
{ … }
static void rnbd_rerun_all_if_idle(struct rnbd_clt_session *sess)
{ … }
static struct rtrs_permit *rnbd_get_permit(struct rnbd_clt_session *sess,
enum rtrs_clt_con_type con_type,
enum wait_type wait)
{ … }
static void rnbd_put_permit(struct rnbd_clt_session *sess,
struct rtrs_permit *permit)
{ … }
static struct rnbd_iu *rnbd_get_iu(struct rnbd_clt_session *sess,
enum rtrs_clt_con_type con_type,
enum wait_type wait)
{ … }
static void rnbd_put_iu(struct rnbd_clt_session *sess, struct rnbd_iu *iu)
{ … }
static void rnbd_softirq_done_fn(struct request *rq)
{ … }
static void msg_io_conf(void *priv, int errno)
{ … }
static void wake_up_iu_comp(struct rnbd_iu *iu, int errno)
{ … }
static void msg_conf(void *priv, int errno)
{ … }
static int send_usr_msg(struct rtrs_clt_sess *rtrs, int dir,
struct rnbd_iu *iu, struct kvec *vec,
size_t len, struct scatterlist *sg, unsigned int sg_len,
void (*conf)(struct work_struct *work),
int *errno, int wait)
{ … }
static void msg_close_conf(struct work_struct *work)
{ … }
static int send_msg_close(struct rnbd_clt_dev *dev, u32 device_id,
enum wait_type wait)
{ … }
static void msg_open_conf(struct work_struct *work)
{ … }
static void msg_sess_info_conf(struct work_struct *work)
{ … }
static int send_msg_open(struct rnbd_clt_dev *dev, enum wait_type wait)
{ … }
static int send_msg_sess_info(struct rnbd_clt_session *sess, enum wait_type wait)
{ … }
static void set_dev_states_to_disconnected(struct rnbd_clt_session *sess)
{ … }
static void remap_devs(struct rnbd_clt_session *sess)
{ … }
static void rnbd_clt_link_ev(void *priv, enum rtrs_clt_link_ev ev)
{ … }
static void rnbd_init_cpu_qlists(struct rnbd_cpu_qlist __percpu *cpu_queues)
{ … }
static void destroy_mq_tags(struct rnbd_clt_session *sess)
{ … }
static inline void wake_up_rtrs_waiters(struct rnbd_clt_session *sess)
{ … }
static void close_rtrs(struct rnbd_clt_session *sess)
{ … }
static void free_sess(struct rnbd_clt_session *sess)
{ … }
static struct rnbd_clt_session *alloc_sess(const char *sessname)
{ … }
static int wait_for_rtrs_connection(struct rnbd_clt_session *sess)
{ … }
static void wait_for_rtrs_disconnection(struct rnbd_clt_session *sess)
__releases(&sess_lock)
__acquires(&sess_lock)
{ … }
static struct rnbd_clt_session *__find_and_get_sess(const char *sessname)
__releases(&sess_lock)
__acquires(&sess_lock)
{ … }
static struct
rnbd_clt_session *find_or_create_sess(const char *sessname, bool *first)
{ … }
static int rnbd_client_open(struct gendisk *disk, blk_mode_t mode)
{ … }
static void rnbd_client_release(struct gendisk *gen)
{ … }
static int rnbd_client_getgeo(struct block_device *block_device,
struct hd_geometry *geo)
{ … }
static const struct block_device_operations rnbd_client_ops = …;
static size_t rnbd_clt_get_sg_size(struct scatterlist *sglist, u32 len)
{ … }
static int rnbd_client_xfer_request(struct rnbd_clt_dev *dev,
struct request *rq,
struct rnbd_iu *iu)
{ … }
static bool rnbd_clt_dev_add_to_requeue(struct rnbd_clt_dev *dev,
struct rnbd_queue *q)
{ … }
static void rnbd_clt_dev_kick_mq_queue(struct rnbd_clt_dev *dev,
struct blk_mq_hw_ctx *hctx,
int delay)
{ … }
static blk_status_t rnbd_queue_rq(struct blk_mq_hw_ctx *hctx,
const struct blk_mq_queue_data *bd)
{ … }
static int rnbd_rdma_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch *iob)
{ … }
static void rnbd_rdma_map_queues(struct blk_mq_tag_set *set)
{ … }
static struct blk_mq_ops rnbd_mq_ops = …;
static int setup_mq_tags(struct rnbd_clt_session *sess)
{ … }
static struct rnbd_clt_session *
find_and_get_or_create_sess(const char *sessname,
const struct rtrs_addr *paths,
size_t path_cnt, u16 port_nr, u32 nr_poll_queues)
{ … }
static inline void rnbd_init_hw_queue(struct rnbd_clt_dev *dev,
struct rnbd_queue *q,
struct blk_mq_hw_ctx *hctx)
{ … }
static void rnbd_init_mq_hw_queues(struct rnbd_clt_dev *dev)
{ … }
static int rnbd_clt_setup_gen_disk(struct rnbd_clt_dev *dev,
struct rnbd_msg_open_rsp *rsp, int idx)
{ … }
static int rnbd_client_setup_device(struct rnbd_clt_dev *dev,
struct rnbd_msg_open_rsp *rsp)
{ … }
static struct rnbd_clt_dev *init_dev(struct rnbd_clt_session *sess,
enum rnbd_access_mode access_mode,
const char *pathname,
u32 nr_poll_queues)
{ … }
static bool __exists_dev(const char *pathname, const char *sessname)
{ … }
static bool exists_devpath(const char *pathname, const char *sessname)
{ … }
static bool insert_dev_if_not_exists_devpath(struct rnbd_clt_dev *dev)
{ … }
static void delete_dev(struct rnbd_clt_dev *dev)
{ … }
struct rnbd_clt_dev *rnbd_clt_map_device(const char *sessname,
struct rtrs_addr *paths,
size_t path_cnt, u16 port_nr,
const char *pathname,
enum rnbd_access_mode access_mode,
u32 nr_poll_queues)
{ … }
static void destroy_gen_disk(struct rnbd_clt_dev *dev)
{ … }
static void destroy_sysfs(struct rnbd_clt_dev *dev,
const struct attribute *sysfs_self)
{ … }
int rnbd_clt_unmap_device(struct rnbd_clt_dev *dev, bool force,
const struct attribute *sysfs_self)
{ … }
int rnbd_clt_remap_device(struct rnbd_clt_dev *dev)
{ … }
static void unmap_device_work(struct work_struct *work)
{ … }
static void rnbd_destroy_sessions(void)
{ … }
static int __init rnbd_client_init(void)
{ … }
static void __exit rnbd_client_exit(void)
{ … }
module_init(…) …;
module_exit(rnbd_client_exit);