From patchwork Tue Feb 14 19:02:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 13140743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9707AC61DA4 for ; Tue, 14 Feb 2023 19:02:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 293276B0081; Tue, 14 Feb 2023 14:02:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CD076B0082; Tue, 14 Feb 2023 14:02:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F39B56B0083; Tue, 14 Feb 2023 14:02:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id E42726B0081 for ; Tue, 14 Feb 2023 14:02:43 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 8DA311C6721 for ; Tue, 14 Feb 2023 19:02:43 +0000 (UTC) X-FDA: 80466819006.30.2D1C3DA Received: from mail-il1-f172.google.com (mail-il1-f172.google.com [209.85.166.172]) by imf21.hostedemail.com (Postfix) with ESMTP id 7EEE61C002F for ; Tue, 14 Feb 2023 19:02:41 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=cpuu8RHh; spf=pass (imf21.hostedemail.com: domain of shy828301@gmail.com designates 209.85.166.172 as permitted sender) smtp.mailfrom=shy828301@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676401361; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=mFajPTMRcCMM2sMtnpqlL+/MlXEk9UiKBjz1wMnJjFA=; b=QUW2wx+OoEDUdk3MzfuDbdPpE8Azked9uIps4Km2oMBhl8AlgPUkhb6YIp+ChnEEBBeUk/ lrTwR6/XCulrJgPPx1CyThCI2Y8sDiZVxWenb6vvjVg+dhc7+ExibwcepKgEWCEo3BWtcc Pscig7j7XiowJ8eK9bvxMhwexEVmisc= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=cpuu8RHh; spf=pass (imf21.hostedemail.com: domain of shy828301@gmail.com designates 209.85.166.172 as permitted sender) smtp.mailfrom=shy828301@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676401361; a=rsa-sha256; cv=none; b=sCxQD4hFVAUIeEvSMXdAC3/Eh8k8JKKRIizfaTkVfqQVpSW4wuuqey7cZ8xbKazUD4Nv34 ZGIrkSjXy+CsCVSwYbe6S5QEWOXbGu/pqUZoNWaEUvP6mBRwIKxrFfgixpj/UpmMKMHsNO H0xssVhO9dRZWKSboG65WdySMrdQN/g= Received: by mail-il1-f172.google.com with SMTP id h4so3234173ile.5 for ; Tue, 14 Feb 2023 11:02:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mFajPTMRcCMM2sMtnpqlL+/MlXEk9UiKBjz1wMnJjFA=; b=cpuu8RHhLHTB9Kf5s0trAt7bengNbUN4ZN2xoDYyF+XdtzVhnHEooRlP9BzRHtxlEP r3Rf1jjDg8BQhkHtx/TVMG/uS8NRXNag+1UWtBCkPSLdTJy+q87vzrf0AACu9OupPfqI GnrPCavwpOhXW44xfYvrtpkf/gp3krMsKHx7/M6K8g4qqClwoz6f8Iz7CE+WhipAL6FO UTRQhaQ8FC74Ihf+tDyxdXiJdWD3uKM5/g54L2eY5a93eT0WfuzvRIFE1gDaP91Cbjii 8/IghgHlkNLzreTfyh7VixSz1DQiCh+dNirmbfzL8nalJsFlCCsVvFn1fwk40nyxGMlR tFOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mFajPTMRcCMM2sMtnpqlL+/MlXEk9UiKBjz1wMnJjFA=; b=LNNmuhFtmS4EFfIlDh9MzTYyvcMlaYJeEG3UV0T6YaqaR0feiDLMhRtYl0n/MnHrFf rDErR4wKHzkvN+xhixDxMQAyKRO4c61rq1xFiVaN14tBZ3xLMJP671zCmrS/7eB96uF6 zRrZRJZPMtAoR4DYOyRTcZ9N+sTOEDWUo8gBoYRZkqGwHuShdAM3EA1E5iuur1yTnRMW FsNVV7/sj7gs40gcchgeyWaxepojeryR491WFTSJEuV7NUOMZapnc+X+/X0nOFniOKtr my8HeyuK93PVcofyE/o5AAsC6BFpFSVvr6ahudVfog2EVL4NpnSg4sUHmUrOSTq2Im6w KRPQ== X-Gm-Message-State: AO0yUKWK2IGRYeiSZUxB+de28P8pwhV5A2uyZBXblUG9NIVVA/Iheuem +WXog7/biy5WC6Cuoc3acanzj1igvYH98w== X-Google-Smtp-Source: AK7set+zChOBkvDmv8upovQoaKfuAxrbFAxXV5MZ5rjassuOdi24vOvvtuhY+6wN48rk9TwI/nKFhA== X-Received: by 2002:a05:6e02:1b8c:b0:315:45c5:9185 with SMTP id h12-20020a056e021b8c00b0031545c59185mr3407244ili.31.1676401360782; Tue, 14 Feb 2023 11:02:40 -0800 (PST) Received: from localhost.localdomain (c-67-174-241-145.hsd1.ca.comcast.net. [67.174.241.145]) by smtp.gmail.com with ESMTPSA id r11-20020a056e0219cb00b0030c27c9eea4sm3608770ill.33.2023.02.14.11.02.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 11:02:40 -0800 (PST) From: Yang Shi To: mgorman@techsingularity.net, agk@redhat.com, snitzer@kernel.org, dm-devel@redhat.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [v2 PATCH 4/5] md: dm-crypt: move crypt_free_buffer_pages ahead Date: Tue, 14 Feb 2023 11:02:20 -0800 Message-Id: <20230214190221.1156876-5-shy828301@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230214190221.1156876-1-shy828301@gmail.com> References: <20230214190221.1156876-1-shy828301@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: 6aijm8pdnjjhwm4xatj3drxoerg6zbop X-Rspamd-Queue-Id: 7EEE61C002F X-HE-Tag: 1676401361-813827 X-HE-Meta: U2FsdGVkX1//SknF36McXLTkPdw12ky9NVv/HSmSa3X7ERzqW5Z+hgXZ3Wj5qdcbiIJarN0kh4K2e2SOV8OOBKwzYMTliZ2SNwbc4FgMBbIX0bsylJfsIhCxnPQlkxOd21fP/1ucDkusR5zLMAT+1JD7ktApUblVd9nh/4fWbACJy5gKHSns2rG/G/Ymtyzuaqh1yqtwleOND8mJiUywzWWGMzbNsGusKPHvEAayeQLbbzu8IbBbLEmRvHfH8gl0Bd8nipMt1/6m8eTLzLVAQxflDKI7RO1hpYta15DI48ebzL+mvmZkgUluVRQqbxOtAFOv6tVJ/8m3niDponPnTJvj+CIQ3n5GA9amFpHF/9jW/+kvTcKjx0W1Hqn/MJJSLNlu73csu+LwBN4hxwjeYaBpHS0hKmQG2CVq+0Uq7zbTw6T+a9RBWQnk3nBQkWmVpuuujx2kVl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.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: With moving crypt_free_buffer_pages() before crypt_alloc_buffer(), we don't need an extra declaration anymore. Signed-off-by: Yang Shi --- drivers/md/dm-crypt.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 2653516bcdef..73069f200cc5 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -1639,7 +1639,17 @@ static blk_status_t crypt_convert(struct crypt_config *cc, return 0; } -static void crypt_free_buffer_pages(struct crypt_config *cc, struct bio *clone); + +static void crypt_free_buffer_pages(struct crypt_config *cc, struct bio *clone) +{ + struct bio_vec *bv; + struct bvec_iter_all iter_all; + + bio_for_each_segment_all(bv, clone, iter_all) { + BUG_ON(!bv->bv_page); + mempool_free(bv->bv_page, &cc->page_pool); + } +} /* * Generate a new unfragmented bio with the given size @@ -1707,17 +1717,6 @@ static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned size) return clone; } -static void crypt_free_buffer_pages(struct crypt_config *cc, struct bio *clone) -{ - struct bio_vec *bv; - struct bvec_iter_all iter_all; - - bio_for_each_segment_all(bv, clone, iter_all) { - BUG_ON(!bv->bv_page); - mempool_free(bv->bv_page, &cc->page_pool); - } -} - static void crypt_io_init(struct dm_crypt_io *io, struct crypt_config *cc, struct bio *bio, sector_t sector) {