Commit e5bd63db authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Kleber Sacilotto de Souza

block: introduce blk_rq_is_passthrough

BugLink: https://bugs.launchpad.net/bugs/1853881

commit 57292b58 upstream.

This can be used to check for fs vs non-fs requests and basically
removes all knowledge of BLOCK_PC specific from the block layer,
as well as preparing for removing the cmd_type field in struct request.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
[only take the blkdev.h changes as we only want the function for backported
patches - gregkh]
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent b673ef34
......@@ -199,6 +199,11 @@ struct request {
struct request *next_rq;
};
static inline bool blk_rq_is_passthrough(struct request *rq)
{
return rq->cmd_type != REQ_TYPE_FS;
}
static inline unsigned short req_get_ioprio(struct request *req)
{
return req->ioprio;
......@@ -583,9 +588,10 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \
REQ_FAILFAST_DRIVER))
#define blk_account_rq(rq) \
(((rq)->cmd_flags & REQ_STARTED) && \
((rq)->cmd_type == REQ_TYPE_FS))
static inline bool blk_account_rq(struct request *rq)
{
return (rq->cmd_flags & REQ_STARTED) && !blk_rq_is_passthrough(rq);
}
#define blk_rq_cpu_valid(rq) ((rq)->cpu != -1)
#define blk_bidi_rq(rq) ((rq)->next_rq != NULL)
......@@ -646,7 +652,7 @@ static inline void blk_clear_rl_full(struct request_list *rl, bool sync)
static inline bool rq_mergeable(struct request *rq)
{
if (rq->cmd_type != REQ_TYPE_FS)
if (blk_rq_is_passthrough(rq))
return false;
if (rq->cmd_flags & REQ_NOMERGE_FLAGS)
......@@ -891,7 +897,7 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq)
{
struct request_queue *q = rq->q;
if (unlikely(rq->cmd_type != REQ_TYPE_FS))
if (blk_rq_is_passthrough(rq))
return q->limits.max_hw_sectors;
if (!q->limits.chunk_sectors || (rq->cmd_flags & REQ_DISCARD))
......
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