nvme.h (15f73f5b3e5958f2d169fe13c420eeeeae07bbf2) nvme.h (ff029451496364eef0d342618dfc9972b78f3392)
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (c) 2011-2014, Intel Corporation.
4 */
5
6#ifndef _NVME_H
7#define _NVME_H
8

--- 458 unchanged lines hidden (view full) ---

467/*
468 * Convert byte length to nvme's 0-based num dwords
469 */
470static inline u32 nvme_bytes_to_numd(size_t len)
471{
472 return (len >> 2) - 1;
473}
474
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (c) 2011-2014, Intel Corporation.
4 */
5
6#ifndef _NVME_H
7#define _NVME_H
8

--- 458 unchanged lines hidden (view full) ---

467/*
468 * Convert byte length to nvme's 0-based num dwords
469 */
470static inline u32 nvme_bytes_to_numd(size_t len)
471{
472 return (len >> 2) - 1;
473}
474
475static inline void nvme_end_request(struct request *req, __le16 status,
475static inline bool nvme_end_request(struct request *req, __le16 status,
476 union nvme_result result)
477{
478 struct nvme_request *rq = nvme_req(req);
479
480 rq->status = le16_to_cpu(status) >> 1;
481 rq->result = result;
482 /* inject error when permitted by fault injection framework */
483 nvme_should_fail(req);
476 union nvme_result result)
477{
478 struct nvme_request *rq = nvme_req(req);
479
480 rq->status = le16_to_cpu(status) >> 1;
481 rq->result = result;
482 /* inject error when permitted by fault injection framework */
483 nvme_should_fail(req);
484 if (likely(!blk_should_fake_timeout(req->q)))
485 blk_mq_complete_request(req);
484 if (unlikely(blk_should_fake_timeout(req->q)))
485 return true;
486 return blk_mq_complete_request_remote(req);
486}
487
488static inline void nvme_get_ctrl(struct nvme_ctrl *ctrl)
489{
490 get_device(ctrl->device);
491}
492
493static inline void nvme_put_ctrl(struct nvme_ctrl *ctrl)

--- 221 unchanged lines hidden ---
487}
488
489static inline void nvme_get_ctrl(struct nvme_ctrl *ctrl)
490{
491 get_device(ctrl->device);
492}
493
494static inline void nvme_put_ctrl(struct nvme_ctrl *ctrl)

--- 221 unchanged lines hidden ---