linux/block/blk-ioprio.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Block rq-qos policy for assigning an I/O priority class to requests.
 *
 * Using an rq-qos policy for assigning I/O priority class has two advantages
 * over using the ioprio_set() system call:
 *
 * - This policy is cgroup based so it has all the advantages of cgroups.
 * - While ioprio_set() does not affect page cache writeback I/O, this rq-qos
 *   controller affects page cache writeback I/O for filesystems that support
 *   assiociating a cgroup with writeback I/O. See also
 *   Documentation/admin-guide/cgroup-v2.rst.
 */

#include <linux/blk-mq.h>
#include <linux/blk_types.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include "blk-cgroup.h"
#include "blk-ioprio.h"
#include "blk-rq-qos.h"

/**
 * enum prio_policy - I/O priority class policy.
 * @POLICY_NO_CHANGE: (default) do not modify the I/O priority class.
 * @POLICY_PROMOTE_TO_RT: modify no-IOPRIO_CLASS_RT to IOPRIO_CLASS_RT.
 * @POLICY_RESTRICT_TO_BE: modify IOPRIO_CLASS_NONE and IOPRIO_CLASS_RT into
 *		IOPRIO_CLASS_BE.
 * @POLICY_ALL_TO_IDLE: change the I/O priority class into IOPRIO_CLASS_IDLE.
 * @POLICY_NONE_TO_RT: an alias for POLICY_PROMOTE_TO_RT.
 *
 * See also <linux/ioprio.h>.
 */
enum prio_policy {};

static const char *policy_name[] =;

static struct blkcg_policy ioprio_policy;

/**
 * struct ioprio_blkg - Per (cgroup, request queue) data.
 * @pd: blkg_policy_data structure.
 */
struct ioprio_blkg {};

/**
 * struct ioprio_blkcg - Per cgroup data.
 * @cpd: blkcg_policy_data structure.
 * @prio_policy: One of the IOPRIO_CLASS_* values. See also <linux/ioprio.h>.
 */
struct ioprio_blkcg {};

static inline struct ioprio_blkg *pd_to_ioprio(struct blkg_policy_data *pd)
{}

static struct ioprio_blkcg *blkcg_to_ioprio_blkcg(struct blkcg *blkcg)
{}

static struct ioprio_blkcg *
ioprio_blkcg_from_css(struct cgroup_subsys_state *css)
{}

static struct ioprio_blkcg *ioprio_blkcg_from_bio(struct bio *bio)
{}

static int ioprio_show_prio_policy(struct seq_file *sf, void *v)
{}

static ssize_t ioprio_set_prio_policy(struct kernfs_open_file *of, char *buf,
				      size_t nbytes, loff_t off)
{}

static struct blkg_policy_data *
ioprio_alloc_pd(struct gendisk *disk, struct blkcg *blkcg, gfp_t gfp)
{}

static void ioprio_free_pd(struct blkg_policy_data *pd)
{}

static struct blkcg_policy_data *ioprio_alloc_cpd(gfp_t gfp)
{}

static void ioprio_free_cpd(struct blkcg_policy_data *cpd)
{}

#define IOPRIO_ATTRS

/* cgroup v2 attributes */
static struct cftype ioprio_files[] =;

/* cgroup v1 attributes */
static struct cftype ioprio_legacy_files[] =;

static struct blkcg_policy ioprio_policy =;

void blkcg_set_ioprio(struct bio *bio)
{}

void blk_ioprio_exit(struct gendisk *disk)
{}

int blk_ioprio_init(struct gendisk *disk)
{}

static int __init ioprio_init(void)
{}

static void __exit ioprio_exit(void)
{}

module_init();
module_exit(ioprio_exit);