From patchwork Thu Jan 28 07:11:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12052257 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFAF1C433E6 for ; Thu, 28 Jan 2021 07:12:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 99B3764DCE for ; Thu, 28 Jan 2021 07:12:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 99B3764DCE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 350216B007E; Thu, 28 Jan 2021 02:12:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 300766B0080; Thu, 28 Jan 2021 02:12:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 19FD36B0081; Thu, 28 Jan 2021 02:12:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0095.hostedemail.com [216.40.44.95]) by kanga.kvack.org (Postfix) with ESMTP id EDF106B007E for ; Thu, 28 Jan 2021 02:12:28 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id ACA1F1E11 for ; Thu, 28 Jan 2021 07:12:28 +0000 (UTC) X-FDA: 77754315576.29.dogs02_0d17d052759d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id 8BAB8180868D9 for ; Thu, 28 Jan 2021 07:12:28 +0000 (UTC) X-HE-Tag: dogs02_0d17d052759d X-Filterd-Recvd-Size: 6601 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Thu, 28 Jan 2021 07:12:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1611817947; x=1643353947; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yNs/pnE8yDpXGswjvz9qkLYz+CA1dL9+4aNznurTKfw=; b=ABqU0TSLndvxDDWKfL5zVGwpxOOy19qhSPFc5HmUY2mnGdtSaNggSoFg potYzDbECGCx6ycrzIuG7KOMDkzGvkNrD736uvfYR7/CHzHKsmFIhXXLt R5H0LfnZItvqgJmo93KjECDJFniM56JettL6AZYiWC8fbZeZEvb3QeP+5 cwNFNzg58qYJD5QkLPad/Tl47BGOWYVg6sOxN6n/zwR7QkwaoG7BI0nuK 205irqTa5aT9d03xdWv0PbGzP5JNfTnyyFiqDcaUphlvlNKQB/R1AbYMx 2yEf+KSSQefgLUNtP4KtBknKiKXcC+y/zRh6BCE3zlwELA98BuzJxZnGI Q==; IronPort-SDR: KZtSzoa4bofnFSLELkzBnAAIICHsAaaUaulZ+5O6aCGC9BgTs7UrZt1z7/U3YOZ3nMuMljfS+J U+8xjxvh69tAROId2RnaJSYr6sxAcU7m0oGNv6bkqNCwzmgI6YB6p8CASp3gYy++kOBIMv9wic rORu6Yc6Wiy4i9yx/p31q9unul9uIRkoNikTUerQ6lCOHwS6dj6a6Mv9JGxn2AN/jL8UuUuMBT ETtQRevja7r2PuFLd2kfHw31mbl6Ok9kGYErHIlzRcIdW/fH+Pri5wq/cCofhHI/yQMg3m8gcD q50= X-IronPort-AV: E=Sophos;i="5.79,381,1602518400"; d="scan'208";a="159693757" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 28 Jan 2021 15:12:26 +0800 IronPort-SDR: wGWynrI7IDM4OTzciWsktLrWGwsJJu51B2VZQP+CECfL+wGN7loWh13URnvSc8M3BR4/lMH5oo vqavdct2OaG3y24tqXBQ2LBoJDdN9oMDVjcIvZfD6vnlxtuVqhROM7h462IqC7pEFXKFxnwauI Gx8YNI4fXF7PYBqZtyx4SDIVR51JlXprotShiCO3CQGilEx6h6UHYL5K7xpirvFU7bX01ma+hC Eh943fbwKGSPyoPKYpZA32dl7ZyhIe5iq8N2EceuiEbDIOXNTXB76vFpWcbI3FyRjQ+yMrYdff qEe7ojEQ+ZhwIGwmP51nSNx6 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jan 2021 22:56:46 -0800 IronPort-SDR: AXyfJ+0DzRblLd1C2a8i26F/p5ozSimYWSlSS31hVM9ZD6XicSUM+PrSEKfC1Dird0dpCST4jr RH8MY1sbvDVq5P84PowPihV3IFXmyzQNH7jhgBGPCvDUQHmJMRxTWJczw7haMsXH6G94Is8ChW 3Thpc5BIBnKiKhlT74BApZ+91+Tr+DAOOck7bXVmzNs8yvwHiSmvLe1vToPqpHXLGvuEQ8CHDc wMtFD3vO2n6mQgoI8Yf56mEPo6oNIWF003bHhQMN3DD+ikOw4kJGblAZl7I7M30srcHVxOHbPk wqE= WDCIronportException: Internal Received: from vm.labspan.wdc.com (HELO vm.sc.wdc.com) ([10.6.137.102]) by uls-op-cesaip02.wdc.com with ESMTP; 27 Jan 2021 23:12:26 -0800 From: Chaitanya Kulkarni To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, dm-devel@redhat.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, drbd-dev@lists.linbit.com, xen-devel@lists.xenproject.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-fscrypt@vger.kernel.org, jfs-discussion@lists.sourceforge.net, linux-nilfs@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-pm@vger.kernel.org, linux-mm@kvack.org Cc: axboe@kernel.dk, philipp.reisner@linbit.com, lars.ellenberg@linbit.com, konrad.wilk@oracle.com, roger.pau@citrix.com, minchan@kernel.org, ngupta@vflare.org, sergey.senozhatsky.work@gmail.com, agk@redhat.com, snitzer@redhat.com, hch@lst.de, sagi@grimberg.me, chaitanya.kulkarni@wdc.com, martin.petersen@oracle.com, viro@zeniv.linux.org.uk, tytso@mit.edu, jaegeuk@kernel.org, ebiggers@kernel.org, djwong@kernel.org, shaggy@kernel.org, konishi.ryusuke@gmail.com, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, damien.lemoal@wdc.com, naohiro.aota@wdc.com, jth@kernel.org, rjw@rjwysocki.net, len.brown@intel.com, pavel@ucw.cz, akpm@linux-foundation.org, hare@suse.de, gustavoars@kernel.org, tiwai@suse.de, alex.shi@linux.alibaba.com, asml.silence@gmail.com, ming.lei@redhat.com, tj@kernel.org, osandov@fb.com, bvanassche@acm.org, jefflexu@linux.alibaba.com Subject: [RFC PATCH 05/34] xen-blkback: use bio_new Date: Wed, 27 Jan 2021 23:11:04 -0800 Message-Id: <20210128071133.60335-6-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210128071133.60335-1-chaitanya.kulkarni@wdc.com> References: <20210128071133.60335-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Create a wrapper on the tio of the bio_new() named get_new_bio() & use it in the dispatch_rw_block_io(). p Signed-off-by: Chaitanya Kulkarni --- drivers/block/xen-blkback/blkback.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 9ebf53903d7b..3760278f0ee6 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -1174,6 +1174,15 @@ do_block_io_op(struct xen_blkif_ring *ring, unsigned int *eoi_flags) return more_to_do; } + +static struct bio * +get_new_bio(struct phys_req *preq, unsigned int op, unsigned int op_flags, + gfp_t gfp_mask, unsigned int nr_bvec) +{ + return bio_new(preq->bdev, preq->sector_number, op, op_flags, nr_bvec, + gfp_mask); + +} /* * Transmutation of the 'struct blkif_request' to a proper 'struct bio' * and call the 'submit_bio' to pass it to the underlying storage. @@ -1324,16 +1333,14 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring, seg[i].offset) == 0)) { int nr_iovecs = min_t(int, (nseg-i), BIO_MAX_PAGES); - bio = bio_alloc(GFP_KERNEL, nr_iovecs); + bio = get_new_bio(&preq, operation, operation_flags, + GFP_KERNEL, nr_iovecs); if (unlikely(bio == NULL)) goto fail_put_bio; biolist[nbio++] = bio; - bio_set_dev(bio, preq.bdev); bio->bi_private = pending_req; bio->bi_end_io = end_block_io_op; - bio->bi_iter.bi_sector = preq.sector_number; - bio_set_op_attrs(bio, operation, operation_flags); } preq.sector_number += seg[i].nsec; @@ -1343,15 +1350,14 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring, if (!bio) { BUG_ON(operation_flags != REQ_PREFLUSH); - bio = bio_alloc(GFP_KERNEL, 0); + bio = get_new_bio(&preq, operation, operation_flags, + GFP_KERNEL, 0); if (unlikely(bio == NULL)) goto fail_put_bio; biolist[nbio++] = bio; - bio_set_dev(bio, preq.bdev); bio->bi_private = pending_req; bio->bi_end_io = end_block_io_op; - bio_set_op_attrs(bio, operation, operation_flags); } atomic_set(&pending_req->pendcnt, nbio);