Commit f2586544 authored by Jan Kara's avatar Jan Kara Committed by Jens Axboe

blk-ioprio: Remove unneeded field

blkcg->ioprio_set field is not really useful except for avoiding
possibly more expensive checks inside blkcg_ioprio_track(). The check
for blkcg->prio_policy being equal to POLICY_NO_CHANGE does the same
service so just remove the ioprio_set field and replace the check.
Reviewed-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
Tested-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220623074840.5960-6-jack@suse.czSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 4b838d9e
...@@ -62,7 +62,6 @@ struct ioprio_blkg { ...@@ -62,7 +62,6 @@ struct ioprio_blkg {
struct ioprio_blkcg { struct ioprio_blkcg {
struct blkcg_policy_data cpd; struct blkcg_policy_data cpd;
enum prio_policy prio_policy; enum prio_policy prio_policy;
bool prio_set;
}; };
static inline struct ioprio_blkg *pd_to_ioprio(struct blkg_policy_data *pd) static inline struct ioprio_blkg *pd_to_ioprio(struct blkg_policy_data *pd)
...@@ -113,7 +112,6 @@ static ssize_t ioprio_set_prio_policy(struct kernfs_open_file *of, char *buf, ...@@ -113,7 +112,6 @@ static ssize_t ioprio_set_prio_policy(struct kernfs_open_file *of, char *buf,
if (ret < 0) if (ret < 0)
return ret; return ret;
blkcg->prio_policy = ret; blkcg->prio_policy = ret;
blkcg->prio_set = true;
return nbytes; return nbytes;
} }
...@@ -193,16 +191,15 @@ static void blkcg_ioprio_track(struct rq_qos *rqos, struct request *rq, ...@@ -193,16 +191,15 @@ static void blkcg_ioprio_track(struct rq_qos *rqos, struct request *rq,
struct ioprio_blkcg *blkcg = ioprio_blkcg_from_bio(bio); struct ioprio_blkcg *blkcg = ioprio_blkcg_from_bio(bio);
u16 prio; u16 prio;
if (!blkcg->prio_set) if (blkcg->prio_policy == POLICY_NO_CHANGE)
return; return;
/* /*
* Except for IOPRIO_CLASS_NONE, higher I/O priority numbers * Except for IOPRIO_CLASS_NONE, higher I/O priority numbers
* correspond to a lower priority. Hence, the max_t() below selects * correspond to a lower priority. Hence, the max_t() below selects
* the lower priority of bi_ioprio and the cgroup I/O priority class. * the lower priority of bi_ioprio and the cgroup I/O priority class.
* If the cgroup policy has been set to POLICY_NO_CHANGE == 0, the * If the bio I/O priority equals IOPRIO_CLASS_NONE, the cgroup I/O
* bio I/O priority is not modified. If the bio I/O priority equals * priority is assigned to the bio.
* IOPRIO_CLASS_NONE, the cgroup I/O priority is assigned to the bio.
*/ */
prio = max_t(u16, bio->bi_ioprio, prio = max_t(u16, bio->bi_ioprio,
IOPRIO_PRIO_VALUE(blkcg->prio_policy, 0)); IOPRIO_PRIO_VALUE(blkcg->prio_policy, 0));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment