From patchwork Fri May 24 05:28:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13672720 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 46123C25B7D for ; Fri, 24 May 2024 05:29:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC4246B0088; Fri, 24 May 2024 01:29:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D58A86B008A; Fri, 24 May 2024 01:29:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B58486B008C; Fri, 24 May 2024 01:29:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 95D766B0089 for ; Fri, 24 May 2024 01:29:22 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 475A580884 for ; Fri, 24 May 2024 05:29:22 +0000 (UTC) X-FDA: 82152161364.17.BFDBC26 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf23.hostedemail.com (Postfix) with ESMTP id A6E77140013; Fri, 24 May 2024 05:29:18 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf23.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716528560; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kSpveyLV3EbSeZx4zQOd0tiQD0sHw6XYtVTvi3tA16U=; b=2pNW7XIyCJIUawTgOBDPfNgS3z5wqHWx5dEU4Hw115lDxRwyiDzgtez49Oia5RBzX95Lt3 MOYsfahBM9FXS/ZmvzVDj731x/sKOc8qpYGMIffTistSDti1zCXhCU9auRyTG2zb5w7nRX F8Hy2wrYzlUGo0wpDh3U6MQoehsa7rY= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf23.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716528560; a=rsa-sha256; cv=none; b=zHs0mGSXTO2buckrblo6eaYPq5mKf+OjyROmMBLaOduy1P6JwGa2BjFpgZgMX0lJTz72qU aUqLC7cPVi2cCexY0nBn5D5GaxLYTozt66r3XxaoqHauGNtifww53f84BnPTby5l271mm9 MRjGrCBgvok0N+9uLh0JzqZFmejDSIk= Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Vltq02m8BzcjWl; Fri, 24 May 2024 13:27:56 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id C8C2F18007E; Fri, 24 May 2024 13:29:14 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 24 May 2024 13:29:14 +0800 From: Kefeng Wang To: , CC: Tony Luck , Miaohe Lin , , Matthew Wilcox , David Hildenbrand , Muchun Song , Benjamin LaHaise , , Zi Yan , Jiaqi Yan , Hugh Dickins , Vishal Moola , Alistair Popple , Kefeng Wang Subject: [PATCH 1/5] mm: migrate: simplify __buffer_migrate_folio() Date: Fri, 24 May 2024 13:28:39 +0800 Message-ID: <20240524052843.182275-2-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240524052843.182275-1-wangkefeng.wang@huawei.com> References: <20240524052843.182275-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm100001.china.huawei.com (7.185.36.93) X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: A6E77140013 X-Stat-Signature: d3uw3qysi7a1enhswhpiyqaaf89aoaep X-Rspam-User: X-HE-Tag: 1716528558-937546 X-HE-Meta: U2FsdGVkX1/kbgOUEY5orhhD70MgrJGVt0KaBWRuf1csUxnRpGFAJrPwBhMl8I+786Ltby5jOkvH5qWov4qoOc3qf64VddFmQT1DFiCX3jGnZRpKipJ7ehuDTVNGcDvyy3Q3MyQQU3KLLLGHBsnEW1ThlW5Mgf6ICRGEnomt7KUWoJNa+XIXlX2+Van8AetN4/uy9rsSAlqbjlfoqBtSOXlM3UrHvf/DCFdmznVA5+F5MJKU81l5yv1gmKSXpN7uimaUCte6xTj5P4NdHdaCWmpGmUy04fnTz8MmJf6JxeUQZum9GOGxhkQ6v8rPgIvO3Rach2lrmq03X5roznN0TaEpM/mkL938Ux3orDpLhL2fDyHx/swmisWrwahUgiQEd0yUYVL3ySdXcXaP0upGs97V9B8Gbas7OICEOIhq5iR5HkkcTzf+KLvRQhKKXCZh0umSIp4tdEBUs2gQY5ZXe6fUJKYxFObtU+J6s3l65OK8Y2kSeMABFvoSacjwmk+Tys1WxUKo0W/KPAvlotVm6f4r3TIp+BJ0OoEjdk7O/iur1O/Kp0f3wApyOddNAY0uDUOm4Ev/jqro0pnP/aJz8Bv1Qdm3qLQLYz4o7FvsM/JaRZVZu+FeacdRIaDdMSLFZeRpJza2vhuGs6AP6tiMJCJlRkoWebTcGMUCj5enDMWXxS6PLyYDBYLzf8pjW2Q2LPzAiORFriBq82JM0oRw5kES5Wm509lmmw/+xDwcBi0fzwV38uVHZc++t+Sdnu3W1vcAlfusVzMFOzIqq6RSDOCqhYsb6VMmbF9rxQzZqPyP30ZEbSTKaK/qfKXm/eYEFRD0Pj2s9X16hJAJZTyNsZ/2cqpiS7os0gcrq7OvMgcakaEAczy/BRYyKDXYVzZx1SiQCvXJQm4XuMmUp9i0uQeymOvIZzzMjA/F2xFh9WWLUtqvj4SC8OSEUJCPxsUqUeMWaB/h3RrDUP9FBYW +X6Uf9+X HX/Tns0CXSqB3C4j20Z1Oxzcrk52Itrb6GQh0aO67Ve2eSXZdEkqsNtIFnr6G8ZoQFqvghXFNO76FD/8+UqxPSakztkbdNqk2H6zuQ63jVTM2waBBHHB2vkOFTsPwwkT9RQTTCmbwER7Ows0wZmJFYZdxhwHBTkbzwX/PkdantPLQ+8DugHu4v3atzFN4w18obARCIwNaECsxodN7wSy0QoGNU+DBiurE/CaF0JBJRJAFBf+t8BmHvPE1BAgwMjI5kIzyWzIr/E2o4v/dMRtKuY37EjrDViRgCUPDruwLl0e0zfX3YwAEVRS3z2FmdQN3WzzNjqlFmorlM4kjk0GJ7pHNwv0xYLOAEKy8 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: List-Subscribe: List-Unsubscribe: Use filemap_migrate_folio() helper to simplify __buffer_migrate_folio(). Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: Vishal Moola (Oracle) Reviewed-by: Miaohe Lin Signed-off-by: Kefeng Wang --- mm/migrate.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index dd04f578c19c..159f737501e1 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -777,24 +777,16 @@ static int __buffer_migrate_folio(struct address_space *mapping, } } - rc = folio_migrate_mapping(mapping, dst, src, 0); + rc = filemap_migrate_folio(mapping, dst, src, mode); if (rc != MIGRATEPAGE_SUCCESS) goto unlock_buffers; - folio_attach_private(dst, folio_detach_private(src)); - bh = head; do { folio_set_bh(bh, dst, bh_offset(bh)); bh = bh->b_this_page; } while (bh != head); - if (mode != MIGRATE_SYNC_NO_COPY) - folio_migrate_copy(dst, src); - else - folio_migrate_flags(dst, src); - - rc = MIGRATEPAGE_SUCCESS; unlock_buffers: if (check_refs) spin_unlock(&mapping->i_private_lock);