From patchwork Mon Nov 14 23:49:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 9428685 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1567C6047D for ; Mon, 14 Nov 2016 23:55:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1478A28552 for ; Mon, 14 Nov 2016 23:55:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0889228670; Mon, 14 Nov 2016 23:55:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61A3028552 for ; Mon, 14 Nov 2016 23:55:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935071AbcKNXz5 (ORCPT ); Mon, 14 Nov 2016 18:55:57 -0500 Received: from mail-pf0-f177.google.com ([209.85.192.177]:33921 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752483AbcKNXz5 (ORCPT ); Mon, 14 Nov 2016 18:55:57 -0500 Received: by mail-pf0-f177.google.com with SMTP id c4so20159760pfb.1 for ; Mon, 14 Nov 2016 15:55:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=v1E3oVfuhMlcjvnqYwLgigcahHyzwUfdAI6JmtpgapY=; b=ZW0worg3eYnORfPYXsz/RO+KvbWmx2It1viRshQWdb3PC5XvyfsG6WWsmk93IVyHpz Enn3Q0DBdOJOS+DDoS14de5b32I1RyynWRfSy1FZiFPa7dlJXBH8tiNPF5K2qL/yekun b/nD6hP21MX/cFMucLMHBM9Bv47pBeWIqfP9TGuh35W5ZACcevz00nYz35I1JrikTE5Y Jq19DtIYD1mlWKYfdONJEf4c9DiydqiGyJtR7aTHVQB9odJzuGWCllMcilfNLKG2fVBp wk300hUpGPy1IH3+lirJa8KDON5p2Hwtj6ti80nD6YBoUcS588TPYUsATx9+1kyR0N7E i+mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=v1E3oVfuhMlcjvnqYwLgigcahHyzwUfdAI6JmtpgapY=; b=IAU2fD9dsQz2FyF1jFh8fq1hKwaFtG3vh2w1r0TkNl1e9flyREUgNQlVIwebZtN+O5 JyhQgQGeyxEsnx2tNGVUPsrmdU1hZ0nM/3FAWxM8+umAUB50lstMH0KVizbTnZ69f1y4 SxCRaTfM09wCu4q8WJaRji4zTZ3LoDtDvqAvchpsvQV1dRo3aKfAD4YWfFYILcjYkxMT dN4xV20qrfy1bQrkf8QkI0uRYBEvOuh9g7Bz/FgTilWyo57+fu0E5NOX+bd/ujkfUq8h Nyukwb8ZxTxGpiVqgNmIkKUavwyWAjvCyu8Zyb8+q5tABkysItEu9FMRc9VxNC73X7Fj xcEg== X-Gm-Message-State: ABUngvdeBbbexIJ3KAaU38cT7ruUkq9aYzBE/Li35FBzzoQ2L/386UvdJE0P9gmU9eLAdEIe X-Received: by 10.98.152.212 with SMTP id d81mr41806406pfk.12.1479167407823; Mon, 14 Nov 2016 15:50:07 -0800 (PST) Received: from vader.thefacebook.com ([2620:10d:c090:200::a:38b9]) by smtp.gmail.com with ESMTPSA id 64sm37749800pfu.17.2016.11.14.15.50.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Nov 2016 15:50:07 -0800 (PST) From: Omar Sandoval To: linux-block@vger.kernel.org Cc: linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, kernel-team@fb.com Subject: [PATCH] blk-mq drivers: untangle 0 and BLK_MQ_RQ_QUEUE_OK Date: Mon, 14 Nov 2016 15:49:59 -0800 Message-Id: <6ac81fdd561e008fec1f31e9a4530358737389a6.1479167141.git.osandov@fb.com> X-Mailer: git-send-email 2.10.2 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Omar Sandoval Let's not depend on any of the BLK_MQ_RQ_QUEUE_* constants having specific values. No functional change. Signed-off-by: Omar Sandoval --- Hi, Jens, Some more trivial cleanup, feel free to apply or not if it's too intrusive. drivers/nvme/host/core.c | 4 ++-- drivers/nvme/host/pci.c | 8 ++++---- drivers/nvme/host/rdma.c | 2 +- drivers/nvme/target/loop.c | 6 +++--- drivers/scsi/scsi_lib.c | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 79e679d..e7f9ef5 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -276,7 +276,7 @@ static inline int nvme_setup_discard(struct nvme_ns *ns, struct request *req, */ req->__data_len = nr_bytes; - return 0; + return BLK_MQ_RQ_QUEUE_OK; } static inline void nvme_setup_rw(struct nvme_ns *ns, struct request *req, @@ -324,7 +324,7 @@ static inline void nvme_setup_rw(struct nvme_ns *ns, struct request *req, int nvme_setup_cmd(struct nvme_ns *ns, struct request *req, struct nvme_command *cmd) { - int ret = 0; + int ret = BLK_MQ_RQ_QUEUE_OK; if (req->cmd_type == REQ_TYPE_DRV_PRIV) memcpy(cmd, req->cmd, sizeof(*cmd)); diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 0248d0e..4afa2f7 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -328,7 +328,7 @@ static int nvme_init_iod(struct request *rq, unsigned size, rq->retries = 0; rq->cmd_flags |= REQ_DONTPREP; } - return 0; + return BLK_MQ_RQ_QUEUE_OK; } static void nvme_free_iod(struct nvme_dev *dev, struct request *req) @@ -598,17 +598,17 @@ static int nvme_queue_rq(struct blk_mq_hw_ctx *hctx, map_len = nvme_map_len(req); ret = nvme_init_iod(req, map_len, dev); - if (ret) + if (ret != BLK_MQ_RQ_QUEUE_OK) return ret; ret = nvme_setup_cmd(ns, req, &cmnd); - if (ret) + if (ret != BLK_MQ_RQ_QUEUE_OK) goto out; if (req->nr_phys_segments) ret = nvme_map_data(dev, req, map_len, &cmnd); - if (ret) + if (ret != BLK_MQ_RQ_QUEUE_OK) goto out; cmnd.common.command_id = req->tag; diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 5a83881..125c43b 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -1399,7 +1399,7 @@ static int nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx, sizeof(struct nvme_command), DMA_TO_DEVICE); ret = nvme_setup_cmd(ns, rq, c); - if (ret) + if (ret != BLK_MQ_RQ_QUEUE_OK) return ret; c->common.command_id = rq->tag; diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c index d5df77d..01035fb 100644 --- a/drivers/nvme/target/loop.c +++ b/drivers/nvme/target/loop.c @@ -168,7 +168,7 @@ static int nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx, int ret; ret = nvme_setup_cmd(ns, req, &iod->cmd); - if (ret) + if (ret != BLK_MQ_RQ_QUEUE_OK) return ret; iod->cmd.common.flags |= NVME_CMD_SGL_METABUF; @@ -178,7 +178,7 @@ static int nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx, nvme_cleanup_cmd(req); blk_mq_start_request(req); nvme_loop_queue_response(&iod->req); - return 0; + return BLK_MQ_RQ_QUEUE_OK; } if (blk_rq_bytes(req)) { @@ -197,7 +197,7 @@ static int nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx, blk_mq_start_request(req); schedule_work(&iod->work); - return 0; + return BLK_MQ_RQ_QUEUE_OK; } static void nvme_loop_submit_async_event(struct nvme_ctrl *arg, int aer_idx) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 2cca9cf..13887c0 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1801,7 +1801,7 @@ static inline int prep_to_mq(int ret) { switch (ret) { case BLKPREP_OK: - return 0; + return BLK_MQ_RQ_QUEUE_OK; case BLKPREP_DEFER: return BLK_MQ_RQ_QUEUE_BUSY; default: @@ -1888,7 +1888,7 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx, int reason; ret = prep_to_mq(scsi_prep_state_check(sdev, req)); - if (ret) + if (ret != BLK_MQ_RQ_QUEUE_OK) goto out; ret = BLK_MQ_RQ_QUEUE_BUSY; @@ -1905,7 +1905,7 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx, if (!(req->cmd_flags & REQ_DONTPREP)) { ret = prep_to_mq(scsi_mq_prep_fn(req)); - if (ret) + if (ret != BLK_MQ_RQ_QUEUE_OK) goto out_dec_host_busy; req->cmd_flags |= REQ_DONTPREP; } else {