From patchwork Tue Mar 13 16:28:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10279905 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 74E356038F for ; Tue, 13 Mar 2018 16:28:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65E632864E for ; Tue, 13 Mar 2018 16:28:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A89E2892E; Tue, 13 Mar 2018 16:28:58 +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 15D5128672 for ; Tue, 13 Mar 2018 16:28:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933664AbeCMQ2z (ORCPT ); Tue, 13 Mar 2018 12:28:55 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:46538 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933643AbeCMQ2x (ORCPT ); Tue, 13 Mar 2018 12:28:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=j1wqR0hF3Y7i4wJIcvLdmTvVWEAf+HCWt1/h1YgogOY=; b=XbL6gbmg9XMY61h8YbiwpqMrr se9zSX5gZBLxpm/pLLy4TI1mqbqWC4+z6WqGOb6ZRds5eqLHKm9KhOf3XTrbE94Q4/UNJzCbr/gKh oUXJIdn15Atbzra80rio0H6IxKx55x1PkeornIKaRovRmTlCcXyeyK3ru6ailoyNEWn6WIVDkmDoP 9zC+nQMPYAbTqtN//g29gmUMx12+Mdhm5Mgqz7PiEZbRN3UcJ1nk2OZlLhMhyJdENe4LT7secllQ+ Pd6fbYIQaHndGVVt5WHbCLYYUPx3feONGOcwg+o1c+BmUjI5pHMH4bFpepUOKoq3GFIRHuFZA3JTs /k340SH/Q==; Received: from 77.117.139.172.wireless.dyn.drei.com ([77.117.139.172] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1evmnC-0003pP-OQ; Tue, 13 Mar 2018 16:28:51 +0000 From: Christoph Hellwig To: axboe@kernel.dk Cc: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, Johannes Thumshirn , Benjamin Block Subject: [PATCH 2/3] bsg-lib: remove bsg_job.req Date: Tue, 13 Mar 2018 17:28:40 +0100 Message-Id: <20180313162841.9030-3-hch@lst.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180313162841.9030-1-hch@lst.de> References: <20180313162841.9030-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html 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 Users of the bsg-lib interface should only use the bsg_job data structure and not know about implementation details of it. Signed-off-by: Christoph Hellwig Reviewed-by: Benjamin Block Reviewed-by: Hannes Reinecke Reviewed-by: Johannes Thumshirn --- block/bsg-lib.c | 14 ++++++-------- include/linux/bsg-lib.h | 1 - 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/block/bsg-lib.c b/block/bsg-lib.c index fb509779a090..f2c2d54a61b4 100644 --- a/block/bsg-lib.c +++ b/block/bsg-lib.c @@ -35,7 +35,7 @@ static void bsg_teardown_job(struct kref *kref) { struct bsg_job *job = container_of(kref, struct bsg_job, kref); - struct request *rq = job->req; + struct request *rq = blk_mq_rq_from_pdu(job); put_device(job->dev); /* release reference for the request */ @@ -68,19 +68,18 @@ EXPORT_SYMBOL_GPL(bsg_job_get); void bsg_job_done(struct bsg_job *job, int result, unsigned int reply_payload_rcv_len) { - struct request *req = job->req; + struct request *req = blk_mq_rq_from_pdu(job); struct request *rsp = req->next_rq; - struct scsi_request *rq = scsi_req(req); int err; - err = scsi_req(job->req)->result = result; + err = job->sreq.result = result; if (err < 0) /* we're only returning the result field in the reply */ - rq->sense_len = sizeof(u32); + job->sreq.sense_len = sizeof(u32); else - rq->sense_len = job->reply_len; + job->sreq.sense_len = job->reply_len; /* we assume all request payload was transferred, residual == 0 */ - rq->resid_len = 0; + job->sreq.resid_len = 0; if (rsp) { WARN_ON(reply_payload_rcv_len > scsi_req(rsp)->resid_len); @@ -232,7 +231,6 @@ static void bsg_initialize_rq(struct request *req) sreq->sense = sense; sreq->sense_len = SCSI_SENSE_BUFFERSIZE; - job->req = req; job->reply = sense; job->reply_len = sreq->sense_len; job->dd_data = job + 1; diff --git a/include/linux/bsg-lib.h b/include/linux/bsg-lib.h index 402223c95ce1..08762d297cbd 100644 --- a/include/linux/bsg-lib.h +++ b/include/linux/bsg-lib.h @@ -40,7 +40,6 @@ struct bsg_buffer { struct bsg_job { struct scsi_request sreq; struct device *dev; - struct request *req; struct kref kref;