From patchwork Thu Jan 28 07:11:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 12052627 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.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 2732AC4332B for ; Thu, 28 Jan 2021 07:27:14 +0000 (UTC) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8F48B64DD9 for ; Thu, 28 Jan 2021 07:27:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8F48B64DD9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10S7OxE1064380; Thu, 28 Jan 2021 07:27:11 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 368brktmms-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Jan 2021 07:27:11 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10S7QDfa096858; Thu, 28 Jan 2021 07:27:10 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3030.oracle.com with ESMTP id 368wqyw5vv-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Thu, 28 Jan 2021 07:27:10 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1l51ht-0003ON-7f; Wed, 27 Jan 2021 23:27:09 -0800 Received: from aserp3030.oracle.com ([141.146.126.71]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1l51Tz-0002YL-Py for ocfs2-devel@oss.oracle.com; Wed, 27 Jan 2021 23:12:47 -0800 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10S71AuG050208 for ; Thu, 28 Jan 2021 07:12:47 GMT Received: from userp2040.oracle.com (userp2040.oracle.com [156.151.31.90]) by aserp3030.oracle.com with ESMTP id 368wcq94m3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 28 Jan 2021 07:12:47 +0000 Received: from pps.filterd (userp2040.oracle.com [127.0.0.1]) by userp2040.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10S74GIQ013951 for ; Thu, 28 Jan 2021 07:12:46 GMT Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by userp2040.oracle.com with ESMTP id 36bpgxhk8p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 28 Jan 2021 07:12:46 +0000 IronPort-SDR: UcnUbZKFoLZf9gznTBE0tP9k3CSgfRbfrWuAh4kIwVg8eTuu9j7Xoevn2KGp62mQP6PQLpXlst KUjHp0Rw95u0PnL0a/3Z9L+LNt07H63XT+9DCPcdyXbramrstm+jr1T/jwpkS0Grdq3MYoFYAu bwu3gzinC15pJpTWBwViuO1NE/pGaJW7R12UZ+xgyP/4EyZd19gnMH1QzYinZ4tWG3y0ErawvV Ac54ow3nOgQC48v5c3EoNDjHbrDc2P/fXRNga8EfhIpGOLai7LGRb++JRj5iB2L6sUiJtpK82H bNY= X-IronPort-AV: E=Sophos;i="5.79,381,1602518400"; d="scan'208";a="162963177" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 28 Jan 2021 15:12:45 +0800 IronPort-SDR: ZxpoI27SEKOHY/DJPSeyzZoNX1mJb/KCbc4fsL9s0X1lHGthBSn0wY/EmERtR1GA4aivxL67fG 5QcR4JA8x9xpwojNqITY2nBhy+6vhlAFSZwqpvw3gVqmhwGo93NKazHAI3CClSHd1punmNnz+L Bc+KZq5bQGnavfmKxfqrrSUdWHj8tniDKkyV40zS8c5q3awKGUV/LNu44cj8OdlPTvaU4leg+3 VsIfjidGK1PC0vIMh7xO9VjOzP/u2tRejJxDCVEzjImw5fX/GaYO2aylRSarCcGr8135t23paI nt31Qot1EgiURPUDzjNkDxgk Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jan 2021 22:55:03 -0800 IronPort-SDR: iX0HhBu+61xFa7EtRWB17G0RFoDdFxtABLHP5yHe733z1qMOeQszsqPYXIq64MFQkReY48/RWk FOClHc2dhNxuRM1QyLpF0KtQrhnCpVvcpPgq0B9OecXrJpCL8UYdCuDWFTL9LdxFS6qWHXh51B DNrP6xQEwjJPm/GL/W/Mv5XtvThzXYCRCRRzvICfBStun4/LN576oOtiFYHwzWMShhTX3BjqKf c8icNJold/1bdh3xf4xqkQcFwP0TJ4M2AqZVo41MRst8Lsv9bfR6qeue7iMnlhLF3vJJuSRBwu WXg= 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:45 -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 Date: Wed, 27 Jan 2021 23:11:06 -0800 Message-Id: <20210128071133.60335-8-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-PDR: PASS X-Source-IP: 216.71.153.141 X-ServerName: esa3.hgst.iphmx.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 ptr ip4:35.160.12.30 ip4:52.34.195.46 ip4:35.162.181.10 ip4:35.162.44.129 ip4:68.232.141.245 ip4:68.232.143.124 ip4:52.36.78.170 ip4:52.86.68.205 ip4:52.86.226.44 ip4:68.232.142.99 ip4:68.232.148.20 ip4:52.26.217.74 ip4:54.187.119.58 ip4:216.71.154.42 ip4:68.232.143.124 ip4:68.232.141.245 ip4:216.71.153.141 ip4:216.71.153.144 ip4:216.71.154.45 ip4:199.255.45.14 ip4:199.255.45.15 include:spf.mandrillapp.com include:servers.mcsv.net include:spf.protection.outlook.com -all X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9877 signatures=668683 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 bulkscore=0 adultscore=0 mlxscore=0 priorityscore=78 phishscore=0 spamscore=0 clxscore=206 mlxlogscore=823 impostorscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101280034 X-Spam: Clean X-Mailman-Approved-At: Wed, 27 Jan 2021 23:27:08 -0800 Cc: shaggy@kernel.org, sergey.senozhatsky.work@gmail.com, snitzer@redhat.com, tiwai@suse.de, djwong@kernel.org, gustavoars@kernel.org, pavel@ucw.cz, alex.shi@linux.alibaba.com, agk@redhat.com, naohiro.aota@wdc.com, sagi@grimberg.me, osandov@fb.com, ebiggers@kernel.org, ngupta@vflare.org, len.brown@intel.com, chaitanya.kulkarni@wdc.com, konrad.wilk@oracle.com, hare@suse.de, ming.lei@redhat.com, viro@zeniv.linux.org.uk, jefflexu@linux.alibaba.com, jaegeuk@kernel.org, konishi.ryusuke@gmail.com, bvanassche@acm.org, axboe@kernel.dk, damien.lemoal@wdc.com, tytso@mit.edu, rjw@rjwysocki.net, philipp.reisner@linbit.com, minchan@kernel.org, tj@kernel.org, lars.ellenberg@linbit.com, jth@kernel.org, asml.silence@gmail.com, roger.pau@citrix.com Subject: [Ocfs2-devel] [RFC PATCH 07/34] dm: use bio_new in dm-log-writes X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9877 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 phishscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101280035 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9877 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 impostorscore=0 phishscore=0 bulkscore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 spamscore=0 mlxscore=0 suspectscore=0 malwarescore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101280035 Signed-off-by: Chaitanya Kulkarni --- drivers/md/dm-log-writes.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/drivers/md/dm-log-writes.c b/drivers/md/dm-log-writes.c index e3d35c6c9f71..7ca9af407647 100644 --- a/drivers/md/dm-log-writes.c +++ b/drivers/md/dm-log-writes.c @@ -217,18 +217,15 @@ static int write_metadata(struct log_writes_c *lc, void *entry, void *ptr; size_t ret; - bio = bio_alloc(GFP_KERNEL, 1); + bio = bio_new(lc->logdev->bdev, sector, REQ_OP_WRITE, 0, 1, GFP_KERNEL); if (!bio) { DMERR("Couldn't alloc log bio"); goto error; } bio->bi_iter.bi_size = 0; - bio->bi_iter.bi_sector = sector; - bio_set_dev(bio, lc->logdev->bdev); bio->bi_end_io = (sector == WRITE_LOG_SUPER_SECTOR) ? log_end_super : log_end_io; bio->bi_private = lc; - bio_set_op_attrs(bio, REQ_OP_WRITE, 0); page = alloc_page(GFP_KERNEL); if (!page) { @@ -264,7 +261,7 @@ static int write_inline_data(struct log_writes_c *lc, void *entry, size_t entrylen, void *data, size_t datalen, sector_t sector) { - int num_pages, bio_pages, pg_datalen, pg_sectorlen, i; + int num_pages, pg_datalen, pg_sectorlen, i; struct page *page; struct bio *bio; size_t ret; @@ -272,24 +269,21 @@ static int write_inline_data(struct log_writes_c *lc, void *entry, while (datalen) { num_pages = ALIGN(datalen, PAGE_SIZE) >> PAGE_SHIFT; - bio_pages = min(num_pages, BIO_MAX_PAGES); atomic_inc(&lc->io_blocks); - bio = bio_alloc(GFP_KERNEL, bio_pages); + bio = bio_new(lc->logdev->bdev, sector, REQ_OP_WRITE, 0, + num_pages, GFP_KERNEL); if (!bio) { DMERR("Couldn't alloc inline data bio"); goto error; } bio->bi_iter.bi_size = 0; - bio->bi_iter.bi_sector = sector; - bio_set_dev(bio, lc->logdev->bdev); bio->bi_end_io = log_end_io; bio->bi_private = lc; - bio_set_op_attrs(bio, REQ_OP_WRITE, 0); - for (i = 0; i < bio_pages; i++) { + for (i = 0; i < bio->bi_max_vecs; i++) { pg_datalen = min_t(int, datalen, PAGE_SIZE); pg_sectorlen = ALIGN(pg_datalen, lc->sectorsize); @@ -317,7 +311,7 @@ static int write_inline_data(struct log_writes_c *lc, void *entry, } submit_bio(bio); - sector += bio_pages * PAGE_SECTORS; + sector += bio->bi_max_vecs * PAGE_SECTORS; } return 0; error_bio: @@ -364,17 +358,15 @@ static int log_one_block(struct log_writes_c *lc, goto out; atomic_inc(&lc->io_blocks); - bio = bio_alloc(GFP_KERNEL, min(block->vec_cnt, BIO_MAX_PAGES)); + bio = bio_new(lc->logdev->bdev, sector, REQ_OP_WRITE, 0, + block->vec_cnt, GFP_KERNEL); if (!bio) { DMERR("Couldn't alloc log bio"); goto error; } bio->bi_iter.bi_size = 0; - bio->bi_iter.bi_sector = sector; - bio_set_dev(bio, lc->logdev->bdev); bio->bi_end_io = log_end_io; bio->bi_private = lc; - bio_set_op_attrs(bio, REQ_OP_WRITE, 0); for (i = 0; i < block->vec_cnt; i++) { /* @@ -386,17 +378,15 @@ static int log_one_block(struct log_writes_c *lc, if (ret != block->vecs[i].bv_len) { atomic_inc(&lc->io_blocks); submit_bio(bio); - bio = bio_alloc(GFP_KERNEL, min(block->vec_cnt - i, BIO_MAX_PAGES)); + bio = bio_new(lc->logdev->bdev, sector, REQ_OP_WRITE, + 0, block->vec_cnt - i, GFP_KERNEL); if (!bio) { DMERR("Couldn't alloc log bio"); goto error; } bio->bi_iter.bi_size = 0; - bio->bi_iter.bi_sector = sector; - bio_set_dev(bio, lc->logdev->bdev); bio->bi_end_io = log_end_io; bio->bi_private = lc; - bio_set_op_attrs(bio, REQ_OP_WRITE, 0); ret = bio_add_page(bio, block->vecs[i].bv_page, block->vecs[i].bv_len, 0);