提交 e454d122 编写于 作者: C Christoph Hellwig 提交者: Jens Axboe

nvmet: kill nvmet_inline_bio_init

Much easier to just opencode this helper.  Also use ARRAY_SIZE instead of
passing the inline bvec array size manually.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NSagi Grimberg <sagi@rimberg.me>
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 5e62d5c9
...@@ -33,18 +33,11 @@ static inline u32 nvmet_rw_len(struct nvmet_req *req) ...@@ -33,18 +33,11 @@ static inline u32 nvmet_rw_len(struct nvmet_req *req)
req->ns->blksize_shift; req->ns->blksize_shift;
} }
static void nvmet_inline_bio_init(struct nvmet_req *req)
{
struct bio *bio = &req->inline_bio;
bio_init(bio, req->inline_bvec, NVMET_MAX_INLINE_BIOVEC);
}
static void nvmet_execute_rw(struct nvmet_req *req) static void nvmet_execute_rw(struct nvmet_req *req)
{ {
int sg_cnt = req->sg_cnt; int sg_cnt = req->sg_cnt;
struct bio *bio = &req->inline_bio;
struct scatterlist *sg; struct scatterlist *sg;
struct bio *bio;
sector_t sector; sector_t sector;
blk_qc_t cookie; blk_qc_t cookie;
int op, op_flags = 0, i; int op, op_flags = 0, i;
...@@ -66,8 +59,7 @@ static void nvmet_execute_rw(struct nvmet_req *req) ...@@ -66,8 +59,7 @@ static void nvmet_execute_rw(struct nvmet_req *req)
sector = le64_to_cpu(req->cmd->rw.slba); sector = le64_to_cpu(req->cmd->rw.slba);
sector <<= (req->ns->blksize_shift - 9); sector <<= (req->ns->blksize_shift - 9);
nvmet_inline_bio_init(req); bio_init(bio, req->inline_bvec, ARRAY_SIZE(req->inline_bvec));
bio = &req->inline_bio;
bio_set_dev(bio, req->ns->bdev); bio_set_dev(bio, req->ns->bdev);
bio->bi_iter.bi_sector = sector; bio->bi_iter.bi_sector = sector;
bio->bi_private = req; bio->bi_private = req;
...@@ -99,11 +91,9 @@ static void nvmet_execute_rw(struct nvmet_req *req) ...@@ -99,11 +91,9 @@ static void nvmet_execute_rw(struct nvmet_req *req)
static void nvmet_execute_flush(struct nvmet_req *req) static void nvmet_execute_flush(struct nvmet_req *req)
{ {
struct bio *bio; struct bio *bio = &req->inline_bio;
nvmet_inline_bio_init(req);
bio = &req->inline_bio;
bio_init(bio, req->inline_bvec, ARRAY_SIZE(req->inline_bvec));
bio_set_dev(bio, req->ns->bdev); bio_set_dev(bio, req->ns->bdev);
bio->bi_private = req; bio->bi_private = req;
bio->bi_end_io = nvmet_bio_done; bio->bi_end_io = nvmet_bio_done;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册