You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
block: introduce new block status code type
Currently we use nornal Linux errno values in the block layer, and while we accept any error a few have overloaded magic meanings. This patch instead introduces a new blk_status_t value that holds block layer specific status codes and explicitly explains their meaning. Helpers to convert from and to the previous special meanings are provided for now, but I suspect we want to get rid of them in the long run - those drivers that have a errno input (e.g. networking) usually get errnos that don't know about the special block layer overloads, and similarly returning them to userspace will usually return somethings that strictly speaking isn't correct for file system operations, but that's left as an exercise for later. For now the set of errors is a very limited set that closely corresponds to the previous overloaded errno values, but there is some low hanging fruite to improve it. blk_status_t (ab)uses the sparse __bitwise annotations to allow for sparse typechecking, so that we can easily catch places passing the wrong values. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
committed by
Jens Axboe
parent
1be5690984
commit
2a842acab1
+4
-4
@@ -394,7 +394,7 @@ void blk_mq_free_request(struct request *rq)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(blk_mq_free_request);
|
||||
|
||||
inline void __blk_mq_end_request(struct request *rq, int error)
|
||||
inline void __blk_mq_end_request(struct request *rq, blk_status_t error)
|
||||
{
|
||||
blk_account_io_done(rq);
|
||||
|
||||
@@ -409,7 +409,7 @@ inline void __blk_mq_end_request(struct request *rq, int error)
|
||||
}
|
||||
EXPORT_SYMBOL(__blk_mq_end_request);
|
||||
|
||||
void blk_mq_end_request(struct request *rq, int error)
|
||||
void blk_mq_end_request(struct request *rq, blk_status_t error)
|
||||
{
|
||||
if (blk_update_request(rq, error, blk_rq_bytes(rq)))
|
||||
BUG();
|
||||
@@ -988,7 +988,7 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list)
|
||||
pr_err("blk-mq: bad return on queue: %d\n", ret);
|
||||
case BLK_MQ_RQ_QUEUE_ERROR:
|
||||
errors++;
|
||||
blk_mq_end_request(rq, -EIO);
|
||||
blk_mq_end_request(rq, BLK_STS_IOERR);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1433,7 +1433,7 @@ static void __blk_mq_try_issue_directly(struct request *rq, blk_qc_t *cookie,
|
||||
|
||||
if (ret == BLK_MQ_RQ_QUEUE_ERROR) {
|
||||
*cookie = BLK_QC_T_NONE;
|
||||
blk_mq_end_request(rq, -EIO);
|
||||
blk_mq_end_request(rq, BLK_STS_IOERR);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user