Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5155462pxb; Wed, 19 Jan 2022 12:14:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJwt0sS1MrIjOkMh2SuA7PYgLVHYFUbcMQDSf6tADwQqp3UoA92JnaVoVyMqFQes9pkNwsPC X-Received: by 2002:a17:902:c205:b0:14a:f5ba:1e10 with SMTP id 5-20020a170902c20500b0014af5ba1e10mr3501956pll.172.1642623264257; Wed, 19 Jan 2022 12:14:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642623264; cv=none; d=google.com; s=arc-20160816; b=GxHOG7hxTIp+9H7m5yd8Y5TlWUy3q5SAOzREiQUK3ywUNx0CTu08394iGpz8wbOX5U fskiheGlIrOYWYHOjpjjeRiLBsfAh+tHzzjTADE1v/3fNVMtx94RkkcKS48OWulcEby4 Ga8FwS+oemooGojZ6EgCIO1ZarG29mdDTCWRQ5s3ynAsQE6LJrt4ffcdgERK5snEKa/A wxtwC081D0qB0usWWSBKmk6luyjHYbLJQMbtCCIvWecFrIDzxZisOmL51DO3eGzezuUy lBFFu3iH+Arn+1EiqrjAMoizVsfKeeSoORAa4rBZz1+aGSFQCNJ+bcNs+3m6R6Bz4s/U MFQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NiiyVm7T1RSoly2lncOqK9SkmVJ5v0QSThOfEky6q20=; b=hQbfWdSx0vMVGL7h2ZpBMdWdL5hCsWN+GYGqPTVD1aX8D049OvGotGgsG6yS5pBg6f 0nK1dhxoMk2SQShVGpDIyTY9UkVCbfUg695yZgzAXyjsGozijAb+QGd9YVI33EPJFTY5 hGIzbw+SeOKSn9sEwYl1aPl1/RT54LxR0K6SoOghiNsjJMzzCRs8R6700eV+6RBBBV+i Q8cV/yZeplIOHaNX0UfsGinZKB34wiUOlBBbTYIluKSmtqOvEnGzxdgGxbKKUoclRBBx JJriIpxZK6SjrYzOP5TuXjgbVp6jObmwqpsI6vhBzKp7pTQjsLUQOofqeVa9IeUAJE8F aEVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=MpqAqQ8K; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j17si888061pgl.837.2022.01.19.12.14.12; Wed, 19 Jan 2022 12:14:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=MpqAqQ8K; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244822AbiARHUV (ORCPT + 99 others); Tue, 18 Jan 2022 02:20:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244726AbiARHUS (ORCPT ); Tue, 18 Jan 2022 02:20:18 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E41CC061574; Mon, 17 Jan 2022 23:20:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=NiiyVm7T1RSoly2lncOqK9SkmVJ5v0QSThOfEky6q20=; b=MpqAqQ8K5Fa6Y5wTGJl/gbG8OO dn6PaxcYnaVlNfT2mS1jeUKelsFExp+uG3u9mIvCpmas8BzQ0HJleX15bQnbvwePmlkVlO5W0vzSK HvgBfIGs0RGASj9FFd6sE8tJ4qfhkmRCextanNUhqXChTqh8JwFoHdtpflmklbp5zQYV6ZVzOyC1T pwKLY+kGCwUQFPrabqHRfoONsuU1ADJ9WWyYqDlTyqsbbVI8ypgDGmJbl8/GUeu7NuW8yznpIFL9H xC7HLvhlMXxb+qdKze/uBd+r7dTrjI/Jf8j/c9/dF2KRq4+f8hr1Qn1e+/PCC7wHouMmupch1ruki Eavz2L2w==; Received: from [2001:4bb8:184:72a4:a4a9:19c0:5242:7768] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9imp-000ZRg-HC; Tue, 18 Jan 2022 07:20:12 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Pavel Begunkov , Mike Snitzer , Ryusuke Konishi , Konstantin Komarov , Andrew Morton , "Md . Haris Iqbal " , Jack Wang , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Philipp Reisner , Lars Ellenberg , linux-block@vger.kernel.org, dm-devel@redhat.com, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-nilfs@vger.kernel.org, ntfs3@lists.linux.dev, xen-devel@lists.xenproject.org, drbd-dev@lists.linbit.com Subject: [PATCH 06/19] dm-crypt: remove clone_init Date: Tue, 18 Jan 2022 08:19:39 +0100 Message-Id: <20220118071952.1243143-7-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220118071952.1243143-1-hch@lst.de> References: <20220118071952.1243143-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Just open code it next to the bio allocations, which saves a few lines of code, prepares for future changes and allows to remove the duplicate bi_opf assignment for the bio_clone_fast case in kcryptd_io_read. Signed-off-by: Christoph Hellwig --- drivers/md/dm-crypt.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 20abe3486aba1..3c5ecd35d3483 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -234,7 +234,7 @@ static volatile unsigned long dm_crypt_pages_per_client; #define DM_CRYPT_MEMORY_PERCENT 2 #define DM_CRYPT_MIN_PAGES_PER_CLIENT (BIO_MAX_VECS * 16) -static void clone_init(struct dm_crypt_io *, struct bio *); +static void crypt_endio(struct bio *clone); static void kcryptd_queue_crypt(struct dm_crypt_io *io); static struct scatterlist *crypt_get_sg_data(struct crypt_config *cc, struct scatterlist *sg); @@ -1673,7 +1673,10 @@ static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned size) mutex_lock(&cc->bio_alloc_lock); clone = bio_alloc_bioset(GFP_NOIO, nr_iovecs, &cc->bs); - clone_init(io, clone); + clone->bi_private = io; + clone->bi_end_io = crypt_endio; + bio_set_dev(clone, cc->dev->bdev); + clone->bi_opf = io->base_bio->bi_opf; remaining_size = size; @@ -1826,16 +1829,6 @@ static void crypt_endio(struct bio *clone) crypt_dec_pending(io); } -static void clone_init(struct dm_crypt_io *io, struct bio *clone) -{ - struct crypt_config *cc = io->cc; - - clone->bi_private = io; - clone->bi_end_io = crypt_endio; - bio_set_dev(clone, cc->dev->bdev); - clone->bi_opf = io->base_bio->bi_opf; -} - static int kcryptd_io_read(struct dm_crypt_io *io, gfp_t gfp) { struct crypt_config *cc = io->cc; @@ -1850,10 +1843,12 @@ static int kcryptd_io_read(struct dm_crypt_io *io, gfp_t gfp) clone = bio_clone_fast(io->base_bio, gfp, &cc->bs); if (!clone) return 1; + clone->bi_private = io; + clone->bi_end_io = crypt_endio; + bio_set_dev(clone, cc->dev->bdev); crypt_inc_pending(io); - clone_init(io, clone); clone->bi_iter.bi_sector = cc->start + io->sector; if (dm_crypt_integrity_io_alloc(io, clone)) { -- 2.30.2