From nobody Sat Nov 30 10:29:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail header.i=@wdc.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=wdc.com ARC-Seal: i=1; a=rsa-sha256; t=1611817991; cv=none; d=zohomail.com; s=zohoarc; b=FZ0gYAghN+i/xXS+owrsC2vDvyTN/44/5WC62DFKDZdkdKP1DKAqCZFbzUShVNFE6e3qqLPg/rjfEVMVuy6jOktNUPixxn81FdPPeFjUgO0EFZjU6wIn58+rLf/9RZhtsmjSW6LegaucwK9yrjeb5pVEhpxHARRWgBHAObf0t7o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611817991; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Mp+TqthrEQwik0r339pP0NpM3xwQG73uCJBt8TSlm1U=; b=SNXOIudCV5lcD2teckpizqdiww7rAmA7HXg9nN4TnV+xVAqAWY+U+Hg/cSX+jbBkAkJqqsu2itUur9rnAJAhu2Uuv36/QesDKROVXqqymTJe0BgXYhuQiK49urOpvs1SpMPww27jppx1ytUf2o0/Y4bs+RskvwT99rPitmV6/Qs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail header.i=@wdc.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 161181799127826.25349478627834; Wed, 27 Jan 2021 23:13:11 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.76595.138275 (Exim 4.92) (envelope-from ) id 1l51UA-00042i-2a; Thu, 28 Jan 2021 07:12:58 +0000 Received: by outflank-mailman (output) from mailman id 76595.138275; Thu, 28 Jan 2021 07:12:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l51U9-00042X-Vq; Thu, 28 Jan 2021 07:12:57 +0000 Received: by outflank-mailman (input) for mailman id 76595; Thu, 28 Jan 2021 07:12:56 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l51U8-00040j-DC for xen-devel@lists.xenproject.org; Thu, 28 Jan 2021 07:12:56 +0000 Received: from esa2.hgst.iphmx.com (unknown [68.232.143.124]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 7f087a9c-87f4-413b-9b62-01a83a78ff2f; Thu, 28 Jan 2021 07:12:53 +0000 (UTC) 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:14:21 +0800 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:57:05 -0800 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 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 7f087a9c-87f4-413b-9b62-01a83a78ff2f DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1611818074; x=1643354074; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=A6gWT2+anXyYq2Hv6qVI+iojoFiSM9Vb51ZpjBpkhPc=; b=gM/RwNIq1yMz3moNmYY7tIHWnvLEFZi3it25y6vCR8uyG74Ok+VaQrVD dQplJFcYrzQ62nAgkEVt6DyO75+H8w87LM/hbmJYMIFh3+jN7anHpphm5 HoOL77UagK5gxoYb4b0q62/lQCt70KprQ3d83VZBiK2E2MbzXYu+HgSPa dIQn9kWdAN5EwG4um1EkSTVT3aVddLRIdHp2jQYne1FSROA/eQCfhoHbU NQXguNFM+7JTRpTNVkNh1cGH+Fwnk3D7DzNxXVQnAPYN2J/TAknDdjSrQ LvOoq/eE6Q4eyF860CxYDp4dM922/vhVXX/IMx7EX83T79ZT7Hcd6AYV9 w==; IronPort-SDR: VaaR04ggAqFXOyy7jziY6XZn8tZ+eAXmimmP3zvqMO06fWIgMx+2nrQ/OWKG7VJriTxCOKhwzw cEO7jbgMSvCA3dFAMMYasC50xR0nNHEJaAULDaaPpSxTNEA4xIwbcHHY0BD5W/5WoAQjxt0cUN +PqtQSa24rXZJX1fh6TloJ0KSfTfd7m/WHUlpjdLgb9Y2rl8CeN/301piaVc/bSPke2sRvbzPy XmHq6qVkAkXiJRREfXAPLEQj6UKNXK+SDHs74g8xtYB19i630SO5u8pHaLu/gB+4km5MQZHYJq sbw= X-IronPort-AV: E=Sophos;i="5.79,381,1602518400"; d="scan'208";a="262548934" IronPort-SDR: tHKnkyA5sDjpo439P4+RiOKkzW5Juu1iWfyWNK9QKgTeCwc04rS7dgMt7vhaJpkILwBMpQmfVp gD7zv1Ct3HmK4l7RhTHtJU44dOaJVM6+AUlM3QNnviVFbEKLcvXhtr+NhsSydPXB5oHzKX2uB3 6z7/ykNrnuxV/jiJ6uh+VRlT+eStWQrsiNHInAONKI4ow+4zhF6ey06Yhy9aXw5s1rC72D5Xdq Ho4MNY8172qGVII50yIiSHRFC0CH5LSOR8WDmBETCLN1Y+S3R2vi6y891Cx6XxtEFD/zNGc7w0 jCIPY3RfMEdRwXKeoayd/OkE IronPort-SDR: iX0HhBu+61xFa7EtRWB17G0RFoDdFxtABLHP5yHe733z1qMOeQszsqPYXIq64MFQkReY48/RWk FOClHc2dhNxuRM1QyLpF0KtQrhnCpVvcpPgq0B9OecXrJpCL8UYdCuDWFTL9LdxFS6qWHXh51B DNrP6xQEwjJPm/GL/W/Mv5XtvThzXYCRCRRzvICfBStun4/LN576oOtiFYHwzWMShhTX3BjqKf c8icNJold/1bdh3xf4xqkQcFwP0TJ4M2AqZVo41MRst8Lsv9bfR6qeue7iMnlhLF3vJJuSRBwu WXg= WDCIronportException: Internal 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 07/34] dm: use bio_new in dm-log-writes 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 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: fail (Signature date is -83 seconds in the future.) Content-Type: text/plain; charset="utf-8" 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, vo= id *entry, void *ptr; size_t ret; =20 - bio =3D bio_alloc(GFP_KERNEL, 1); + bio =3D 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 =3D 0; - bio->bi_iter.bi_sector =3D sector; - bio_set_dev(bio, lc->logdev->bdev); bio->bi_end_io =3D (sector =3D=3D WRITE_LOG_SUPER_SECTOR) ? log_end_super : log_end_io; bio->bi_private =3D lc; - bio_set_op_attrs(bio, REQ_OP_WRITE, 0); =20 page =3D alloc_page(GFP_KERNEL); if (!page) { @@ -264,7 +261,7 @@ static int write_inline_data(struct log_writes_c *lc, v= oid *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, =20 while (datalen) { num_pages =3D ALIGN(datalen, PAGE_SIZE) >> PAGE_SHIFT; - bio_pages =3D min(num_pages, BIO_MAX_PAGES); =20 atomic_inc(&lc->io_blocks); =20 - bio =3D bio_alloc(GFP_KERNEL, bio_pages); + bio =3D 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; } =20 bio->bi_iter.bi_size =3D 0; - bio->bi_iter.bi_sector =3D sector; - bio_set_dev(bio, lc->logdev->bdev); bio->bi_end_io =3D log_end_io; bio->bi_private =3D lc; - bio_set_op_attrs(bio, REQ_OP_WRITE, 0); =20 - for (i =3D 0; i < bio_pages; i++) { + for (i =3D 0; i < bio->bi_max_vecs; i++) { pg_datalen =3D min_t(int, datalen, PAGE_SIZE); pg_sectorlen =3D ALIGN(pg_datalen, lc->sectorsize); =20 @@ -317,7 +311,7 @@ static int write_inline_data(struct log_writes_c *lc, v= oid *entry, } submit_bio(bio); =20 - sector +=3D bio_pages * PAGE_SECTORS; + sector +=3D 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; =20 atomic_inc(&lc->io_blocks); - bio =3D bio_alloc(GFP_KERNEL, min(block->vec_cnt, BIO_MAX_PAGES)); + bio =3D 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 =3D 0; - bio->bi_iter.bi_sector =3D sector; - bio_set_dev(bio, lc->logdev->bdev); bio->bi_end_io =3D log_end_io; bio->bi_private =3D lc; - bio_set_op_attrs(bio, REQ_OP_WRITE, 0); =20 for (i =3D 0; i < block->vec_cnt; i++) { /* @@ -386,17 +378,15 @@ static int log_one_block(struct log_writes_c *lc, if (ret !=3D block->vecs[i].bv_len) { atomic_inc(&lc->io_blocks); submit_bio(bio); - bio =3D bio_alloc(GFP_KERNEL, min(block->vec_cnt - i, BIO_MAX_PAGES)); + bio =3D 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 =3D 0; - bio->bi_iter.bi_sector =3D sector; - bio_set_dev(bio, lc->logdev->bdev); bio->bi_end_io =3D log_end_io; bio->bi_private =3D lc; - bio_set_op_attrs(bio, REQ_OP_WRITE, 0); =20 ret =3D bio_add_page(bio, block->vecs[i].bv_page, block->vecs[i].bv_len, 0); --=20 2.22.1