From patchwork Thu May 2 08:45:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13651428 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 718D8C4345F for ; Thu, 2 May 2024 08:47:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F0ED26B0083; Thu, 2 May 2024 04:47:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EBE336B0085; Thu, 2 May 2024 04:47:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D10AE6B0087; Thu, 2 May 2024 04:47:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B4CC06B0083 for ; Thu, 2 May 2024 04:47:20 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 6B3111A07F5 for ; Thu, 2 May 2024 08:47:20 +0000 (UTC) X-FDA: 82072826640.02.D2984C6 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by imf05.hostedemail.com (Postfix) with ESMTP id C45DC100016 for ; Thu, 2 May 2024 08:47:17 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=V9ICqMUi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf05.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.215.171 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714639637; h=from:from:sender:reply-to: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=WSvD/YVvY3oR/SV9lrJcxmGa9WfASg1z+eMVQdwymCU=; b=XOA7+0tIMhIT9I3ZNwPkyMQ7BfsFu0OjldZ6nlvEPnhLAgeAKykxKe/lzdphI9cDJgt99m HCwa3Z99oMYzQTmfP25vyqmZP7SdQuTIY2mRp2bD0tnyHQn0FvQ4+RTlFyTB4vzTMC3J7d 3avv/l9NUruqjBR3rDvOGpA5MavGVZ4= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=V9ICqMUi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf05.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.215.171 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714639637; a=rsa-sha256; cv=none; b=OIYzDlN4WaY2j/38+dw0VlJm6tclZpdSjMrjf+9E64Q44/jYWL24OuhOOnh7drsf+wfl9w Q5RW/l3Drvbt5yx01ku4mvOtkTMQC19OtoBSEmwiLaZCqOhN8uZ015kNHmSrCHj/Dnxg/N bPG80cl9tx6CPTI6SFwPsaKWmLIVM4M= Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-5bdbe2de25fso5833301a12.3 for ; Thu, 02 May 2024 01:47:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714639636; x=1715244436; darn=kvack.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=WSvD/YVvY3oR/SV9lrJcxmGa9WfASg1z+eMVQdwymCU=; b=V9ICqMUizcWR1ePI6JpB4K85Yx9gKWVsSG6e/DM5kpbQwMDQGO58ePAG9DBSWniJrf jfz+HNcFEqZIz015fRWz0fOUqeiuvlGr4hm5lYlKYbTbNovHi35EMGqz2q1pMt54qyCn 9fpJCQLqM06r1yda0eDkNWb2Px7oHpWoA+6s3n1mMDqg83ow+mp3FCiNcjbhwibkq95I Gxbr+XjulVsSqpTA33mtcDp1E3X4XYSIO3g/uJykIl6aMZNbIPbV/vbrKPuhQKcXcP9W JXLHvmoHQNnShVaV+SLiIe9dUbyRHgQMrKM5IuRP5iq0CHj4Uado8ITyyTGQBj3skMfN F5Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714639636; x=1715244436; h=content-transfer-encoding:mime-version:reply-to: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=WSvD/YVvY3oR/SV9lrJcxmGa9WfASg1z+eMVQdwymCU=; b=Gt0Js3HJOW8QXzRegmmQ752SilEIK1qg5F7SoGVru9N9mTRmGvJJnxG7pFZuEgYul+ iPK+G+mxx7kMEjfQ43Xj/eSJjf7JVnERQ+/NW6sTzfoO5Ksn79YcKY5EYRuOsmbDTUPs VGi97PmtIM4dd2uazh1yaCdwAsswugY7l14P7osc9i/TYmiGKI2xSYmp7E2YIHZzXeFB VoWAJ7evUOUMbpSiHHLTJ8O7LQv4AX1UVYpSxQTezXCPHbxJZ8hHUpnyPu16/dzPabNw /cD2Y9vi4VFP++uIeDQdPynu0xEFx8Ml466XrZGNjWp63HFBzsiyr+CMIeNU6IeWCAf5 6Bkw== X-Gm-Message-State: AOJu0Ywvse66wtVl24fkAWGxZqdCiqBTVEmhoENAjXJeORTa9feJgdLs do5dLscRg+j3re7GsHQ4Ndd+yfMMYbdJx00iuuW1nU8Ku6KySYiacsegUC6gSBs= X-Google-Smtp-Source: AGHT+IHHmKPYxmQ1NnctSOq7P493kmk6LeLXH7PC/dx0NjjiKoIYGnc+kgONRssyDz3JCfG5GAiMeg== X-Received: by 2002:a17:90b:50cc:b0:2ad:da23:da0b with SMTP id sb12-20020a17090b50cc00b002adda23da0bmr5630235pjb.34.1714639636249; Thu, 02 May 2024 01:47:16 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id q6-20020a17090a938600b002b273cbbdf1sm686805pjo.49.2024.05.02.01.47.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 May 2024 01:47:15 -0700 (PDT) From: Kairui Song To: linux-mm@kvack.org Cc: Andrew Morton , "Huang, Ying" , Matthew Wilcox , Chris Li , Barry Song , Ryan Roberts , Neil Brown , Minchan Kim , Hugh Dickins , David Hildenbrand , Yosry Ahmed , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kairui Song , Chao Yu , Jaegeuk Kim , linux-f2fs-devel@lists.sourceforge.net Subject: [PATCH v4 01/12] f2fs: drop usage of page_index Date: Thu, 2 May 2024 16:45:58 +0800 Message-ID: <20240502084609.28376-2-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240502084609.28376-1-ryncsn@gmail.com> References: <20240502084609.28376-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Stat-Signature: mcfx6x7y3x4ru4rzsxrzsd7m1hqj5zoq X-Rspamd-Queue-Id: C45DC100016 X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1714639637-285049 X-HE-Meta: U2FsdGVkX1+UwZLfbz2Rk8UtbPX88+IdgB/6KRRTWPsW1npzP6OfydtJXOF+5meQ4HK1F7EmdnDwfODLvRBNaIj7NMi8MzErqqWwlzoNf8E4hkEkF3aFL3Ud8f5cRb192A4CeRjVBUmKPtaXc4SxYzEJcPhLAyYCKA5zduHuHB8F8nnbdA+mAKA2Sb3+A/bNr15zpmn4Tjo8U6mL54SsLwo6JJ9AnnA4+9cTWs9ZwKPBF2CztQBK78SmU0XyGUG13Hs4ZjHSOwXDHGbYPTLq7u1YZQArFrPi4MyToAE2mXi73s26Ll9sAMgwIEZvSSZtBgbpSSQe1ov7i7XE611IeYukKNKJwxQwGcU/8q7oVQFSH77EHpKCKN4La/PkuY8nmQLGMl8aYtc5w4WR6w1VWxZHtzhB/IViP6q8fGBflrE4JpOrTggnxS4IJH5kxuIlERI+efCHQC6/3ljG8CwQDH6g5dYJAIVK/9hbX35rjkm70KjvYBY1iPkcf/ojr+PVBY+vtwaWxB/mt/Y3MO4Z6tEKHxXsOAFS/Gr45M5WWFWlg6DqwwTvEpqI6AajBz0e5qC17Iicgojk0SiN6nnR89Qz7gJ7WdlZRzhLeSLL211zlOpWxkWcu/yZzrivAvVGvriHjZSS6+BMwnPQbTCTxM556FqIe2+qo1UJEVKSTrb6JZsyMFEPbXmzi+W88+9/Bch0+MzFu1wNwBgx9nly9ibCwWP1AO7frZv4GUXbjKY3xmP3kZSsz5vLXtZ3IxfL8VgiDnECiIzwQY8emgyeZQPlYgNp4dkHZixtF4qdeQ7fnu6LiZ/EoJIv1/jihvsL296gC1TEEs+GaBqKp6KE6mFcQ28E1h/NDajG6LGpZaL8oT20kSwx6o5D4uWTtHm/piatdIusHFYiViTbWHasdCdVGD8wuohd4RQS5k2YkIdUn/RY5Y9gqhB+9nej3/qoHiG4rJcAmR1SfKCNhDk A6DExxN/ hutOXza3YV3U6iRpNorgv1r5xF0FZpLJ0SGVZrKu9bfAsVLiphpzaIEC3l79sgt+Xm8Ynl95yuH3XeuXj+y2qdzsK14kcle4ji5eMucBvYbv8UxLw0MW/E4uicbIHBYnZ9l9mqllbD6p9pKlnpxJRuNDBfIj8btYhCHg5ybXpyD3OhpST0C2X9ff/R6mRG6c0YVx6R3o0e//fYZVl7o6jEISSedFr8xXhh0Umxw0xuhpCXpv1OpFC/ZpCOHIwoMD1ebthvM1KatAs+QjU4jwkc/yao0hdig7wmw6Raxb+vmyNmu9ct5ugez4SyQ== 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: From: Kairui Song page_index is needed for mixed usage of page cache and swap cache, for pure page cache usage, the caller can just use page->index instead. It can't be a swap cache page here, so just drop it. [ This commit will not be needed once f2fs converted f2fs_mpage_readpages() to use folio] Signed-off-by: Kairui Song Cc: Chao Yu Cc: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net --- fs/f2fs/data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 961e6ff77c72..c0e1459702e6 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2057,7 +2057,7 @@ static int f2fs_read_single_page(struct inode *inode, struct page *page, sector_t block_nr; int ret = 0; - block_in_file = (sector_t)page_index(page); + block_in_file = (sector_t)page->index; last_block = block_in_file + nr_pages; last_block_in_file = bytes_to_blks(inode, f2fs_readpage_limit(inode) + blocksize - 1); From patchwork Thu May 2 08:45:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13651429 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 D72D9C4345F for ; Thu, 2 May 2024 08:47:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3EA986B0087; Thu, 2 May 2024 04:47:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 398F46B0089; Thu, 2 May 2024 04:47:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 23ABD6B008A; Thu, 2 May 2024 04:47:25 -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 03B446B0087 for ; Thu, 2 May 2024 04:47:24 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 60378C0CD0 for ; Thu, 2 May 2024 08:47:24 +0000 (UTC) X-FDA: 82072826808.18.F1C6029 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by imf22.hostedemail.com (Postfix) with ESMTP id 8DED9C0003 for ; Thu, 2 May 2024 08:47:22 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Gsvv5I9K; spf=pass (imf22.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.181 as permitted sender) smtp.mailfrom=ryncsn@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=1714639642; h=from:from:sender:reply-to: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=dKeW621Yklmzy6NXiq7Wct3/1VaKARCv12uVKwULRiw=; b=0xUxRcoHWY2I5qWTmCp9yI3EJxDzyAAc0BZ21+nwRDRSnPN6DfE3lGRFf/quA81rbUYUJl CI4wS+i6AWmZ8sP2+pWf/qslO9/iafI4DIIxoolEJ3Rkv4cL5n5qs+i+NyA4GRxDR6YBu2 irGyWk5vcqYCPJGTxzsBcwKBjL/vwZA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714639642; a=rsa-sha256; cv=none; b=NCHGCnufmrZawdbc/tEHyc5+e2EXRwP0nyMLAffNOLnHDwpWpACdb40s5ojF+GcGKRT3VZ xDSKLubKFFvzc1V7cH5pn54hhBJ4Q+6IfYJyE5/d6H9qnU1LbcISEpv7auQ+SrxjMGK1pI EHmvDs+u7QmwSn7WcM0ASqY6VbmWsvA= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Gsvv5I9K; spf=pass (imf22.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.181 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6eff9dc1821so7070399b3a.3 for ; Thu, 02 May 2024 01:47:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714639641; x=1715244441; darn=kvack.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=dKeW621Yklmzy6NXiq7Wct3/1VaKARCv12uVKwULRiw=; b=Gsvv5I9KV6RLx82P1l5vah/SVxOZeh/3M0ck4MB1gPaArwRq4wHddUskRzA/rDSsNl wC4vfdC+MfjnDNWG/LzQ+9HpLg8AKu8RVPozAK4L8iggdjYlJblw2rZaGplNtWgXO3ma yb634upBvDFCfv7802DjfIt2AfwWpr3a28+CKW5BFJCFqeoPiXYWj+NVue0wKzlsphLA w8mCPmqzCFSvjhA+MbdTf7WKQc2Wi95wP4th57PUYxqwnECrVXLF/lj8avbDgLYhDJ3X mn5Zlk3G51IldcDxZ17LzvHj0BtxAjhUYW+rvRJOolN4CDmqJguMkZMJnqW8aVsgr7yl qp0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714639641; x=1715244441; h=content-transfer-encoding:mime-version:reply-to: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=dKeW621Yklmzy6NXiq7Wct3/1VaKARCv12uVKwULRiw=; b=KA4hvSoOVfkOoGfZWrywlpLMq4M0C3Vg9uF7aOogKLui0Y+vFnD/M5ISYZs9EeykkF N3gbA310Nf4sku4yc5+pviR3GqWRnqsVEnijRylZwqX9jGCRBs0Pjm82R+RPj/iBlu3u wQLALszFr20vaDzn/FE41gZ2RddnsP8TD8DQETb7y/I4cdG967M3oIzCPcCcfAeGaRII sorxNS4rR9tqyer4pZOQnWZ5jx9ZagNmz3aWGm4Na9v4JR5Eap8KeHN97OxEI56W/L2+ XVmPOXtb43ty0TWNhKdTP0AGcRkX5KB0Ez0G0F2IQo+0Kaybfjtueq+0vbN18m6L7X77 9SVA== X-Gm-Message-State: AOJu0YzoNS/TuKLF0xWFFOaJvuXOBDK/So/ZbyQXtCfO8dv0yEv5BHl9 pYAUPv+eHZEMYmfc7QxPQvYhdF89ZJhV/UhFOd3inJm2fWbg5z72juxQyCDqDCk= X-Google-Smtp-Source: AGHT+IFw7DPiHNZRifdJPZ097xuBBnwfxycsF06NxKzZyaEaRqiuEdjNax8xBn+KkdLO8zdGBCA7rg== X-Received: by 2002:a05:6a21:338f:b0:1af:66aa:f968 with SMTP id yy15-20020a056a21338f00b001af66aaf968mr6570426pzb.20.1714639640628; Thu, 02 May 2024 01:47:20 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id q6-20020a17090a938600b002b273cbbdf1sm686805pjo.49.2024.05.02.01.47.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 May 2024 01:47:20 -0700 (PDT) From: Kairui Song To: linux-mm@kvack.org Cc: Andrew Morton , "Huang, Ying" , Matthew Wilcox , Chris Li , Barry Song , Ryan Roberts , Neil Brown , Minchan Kim , Hugh Dickins , David Hildenbrand , Yosry Ahmed , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kairui Song , Ryusuke Konishi , linux-nilfs@vger.kernel.org Subject: [PATCH v4 02/12] nilfs2: drop usage of page_index Date: Thu, 2 May 2024 16:45:59 +0800 Message-ID: <20240502084609.28376-3-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240502084609.28376-1-ryncsn@gmail.com> References: <20240502084609.28376-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: mmgwsq68tds1r5rn31xyarxcwfz6d3ub X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 8DED9C0003 X-HE-Tag: 1714639642-985444 X-HE-Meta: U2FsdGVkX1+NOQirBpd2Oc5GTxFTLJm7lpwWdfXOP7YwsZvKxClcc6Erz9QCGYf7T+o3N2B2x5fpR1GDMESBMkGy6+d8cyFRGgFh/nIcE4mD6jpaUvC9EX19lNg/JAgC+C6pgOY2STyW8CT5W9b0eeTE/S1hZiwQ0/PW+gHkcqipqPPfZdgEE6DxKq/QA7uPU+1qoMX64rxLQFaVmcPvkPX2NjO8WTHlDxFurPWQpwmj4IT3L/Lr8POw/CUeK2bX9odEh5cIYUxCNRp7u5sNU+/GkDWZJFlr6qeM9WZIirrMTqzQoWYm2OPfLm5ICmM7BDNEpN5QByoOpnoKwvoYQyAzbGH2msxWtAWW9V8VNyD7WiG/xxfFSvby1ku8UlzDVehuSzjMMmbKhwaLrzuqwwNeE9fZ4zqZVgu1AlNG7LIDxzTol8NsrRTndKk3iBtdyj0akVz20KnXUFGC6tS5glglkpudMRh9iOAMlk7oBj82x+G16Svtm7MxyAzBZrx6xUgXu1Y4s/RPAAJ687b84Q8sKfWkbSj0EvWUh1scmf6HPXkdTilkDPlcfwz6LYJccG9MaTFKDKHrXClEQAuPMr4v0S54xKryAklzajbKMPBGMUO4YN5VRaAHVfu7eTBWuGR/vFKTwRcXnecFW1g8RND0QtrnXn9CF0ttgeLWfob8A1o31TQW+kd0IbVTMEdrKb5BR11nHvsOUTRFgEDGO//7R20J9KOfHBVINrsItCZyzf2VOBaKo0kam0dK5/gNQA/sk3n876qdAa5wtGV56la0cBrB3XFAPmwQ7iqhcDkSvOQkZgXuk2VdU3e5yV/r1Ce2bhu8wX/OX9rMMtTcNOPhUJOG7j8/LpJGalqp47b5ofThyhlL9q/sCnbFX0/JhKqM2WgzHuOhmUywiLJRCDPdZV/acVpb/j2z8Qby5ysGmeLTjfOqcV4ixXYp2WobR7Ha4OSTP5mJCPONKKQ XC4iwN99 hseZqVZTeG2VE2uAeUUXW7yHehFZwDzdJrUi7rvTemdTROtNoK+PAISgrmkB3fN9LPq4SNyJyK+CJOfY9FzmhG8+ZzH3HH1dUXq8KGk7JoxW8IAqFUjnj82RETg/0/b5nvVkaxp6n9PoJrF6B2KQ1YQOeK+dpRa1PpkfrBQJTknvgNI1INjx52mZxBZtNRunhUuCu88mleGARzk9LXLja4xZCFM+bhwqiHhpFxSlUUvlDLmWsEN0oURFIrs24Qycg/89+nzv7816C78a0YwgMdLaW1tS8X/fhNHIUupA97lvHdn67kPiDiTSqkqDI15GfYplY/TgCoS/6rPQNSkfgpmhzt+Cm8XQmaJjlG6jRh7L81ZZt6gLCReqUacnHoiccIann6+lc1cCAPLcnfAmyJ81vyCEyS6Xg9oc9fjUOEHXfezcFJA6XruT5NgCmAgbUmXXEKQ+YjLqXVIH3Pt9tevTz2OsdAOCfZ4K2jID7kFRxVxZK4LL+LzIrb/Dqdj/Yb4TF/7L+Sx1UBkzG61FXpPUV7U6HB1q3TGjx0xuPTd4Zw3nOg6+CvlFTx9eFHucpsg5QuiZjAo9+CsVoxel/pYqChTW5LkbnFYQlXnSFY472rKpUeSiRStnp92ReXnrbNAE25362EYds4vzzrCmd9PQUsZyskPnqtZRg1VimxzXYkBfHudzU5qxU3bePiMDo5eojv+uHp7vYk28ttSStqE+wXhaYpU0YiPr6ka4UeH6jz8VxzrTcHwLv8T29NnLmOqTAQ0CjL3dU1fy4+Z+qLFEFEQIHC0bOTjhkdG0MEhjKjdabABp8pqGUKC9Q0Tx3a0rOzSoYBcvuwxMdP+ZLJGfXK8PZtP5SI1OSw+OMAI2qkJQ731KqewFsq0JNcNRddGBp 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: From: Kairui Song page_index is only for mixed usage of page cache and swap cache, for pure page cache usage, the caller can just use page->index instead. It can't be a swap cache page here (being part of buffer head), so just drop it. And while we are at it, optimize the code by retrieving the offset of the buffer head within the folio directly using bh_offset, and get rid of the loop and usage of page helpers. Suggested-by: Matthew Wilcox Signed-off-by: Kairui Song Cc: Ryusuke Konishi Cc: linux-nilfs@vger.kernel.org Acked-by: Ryusuke Konishi --- fs/nilfs2/bmap.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c index 383f0afa2cea..cd14ea25968c 100644 --- a/fs/nilfs2/bmap.c +++ b/fs/nilfs2/bmap.c @@ -450,15 +450,9 @@ int nilfs_bmap_test_and_clear_dirty(struct nilfs_bmap *bmap) __u64 nilfs_bmap_data_get_key(const struct nilfs_bmap *bmap, const struct buffer_head *bh) { - struct buffer_head *pbh; - __u64 key; + loff_t pos = folio_pos(bh->b_folio) + bh_offset(bh); - key = page_index(bh->b_page) << (PAGE_SHIFT - - bmap->b_inode->i_blkbits); - for (pbh = page_buffers(bh->b_page); pbh != bh; pbh = pbh->b_this_page) - key++; - - return key; + return pos >> bmap->b_inode->i_blkbits; } __u64 nilfs_bmap_find_target_seq(const struct nilfs_bmap *bmap, __u64 key) From patchwork Thu May 2 08:46:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13651430 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 DBF69C4345F for ; Thu, 2 May 2024 08:47:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7445B6B008A; Thu, 2 May 2024 04:47:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F5146B008C; Thu, 2 May 2024 04:47:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 595D76B0092; Thu, 2 May 2024 04:47:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 375096B008A for ; Thu, 2 May 2024 04:47:29 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D32C6808FD for ; Thu, 2 May 2024 08:47:28 +0000 (UTC) X-FDA: 82072826976.11.EC370AF Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by imf10.hostedemail.com (Postfix) with ESMTP id 2262AC0016 for ; Thu, 2 May 2024 08:47:26 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Antw6MYl; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.216.48 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714639647; h=from:from:sender:reply-to: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=5+IkB3+J9K42d+V5Wi+AdhWpwnXMtEpYhZXm/5fw+dM=; b=OBZ3nbZfOSu8adPDeHh7QOpdNOSBkLaPY+dIPFQUTfiGq9LxsRpM9kQzgYPnVlKbPW6KuV xUavTbT6LKJ6clMukncUz3mVIgUacfd0Q9NR47R79SzLhzWFiTISYVTSOyTGzP/mb7M/fc GI3goIKUa3OVTx5hH1WARuDh3HVqkY0= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Antw6MYl; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.216.48 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714639647; a=rsa-sha256; cv=none; b=txg+3K6Qfxc/I39um6MWtIbl9RPXS2zxq4snTt2raCkzuGyEFyqMbPfCWwtmJPlTzbkb4g agyXMyTb8LleOTS2DSFzh3hJCGx9/kZbhiePlTLoGV0mFpJ1ltppjjkWhDlYZYR7N256z6 iPevPM6e4tFqh1XdGuslJ7bHLsoexiY= Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-2a559928f46so5131292a91.0 for ; Thu, 02 May 2024 01:47:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714639645; x=1715244445; darn=kvack.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=5+IkB3+J9K42d+V5Wi+AdhWpwnXMtEpYhZXm/5fw+dM=; b=Antw6MYlUEFpmxKVia7o9b9Ow2ypYc2tG4AJ8lukE4PiqJJmMEeGyYRxGUFfjK6eOM uBduxaj4XUkJW5wJSB0TEa2Yk1cwtJUTvUjtbMhvMWEtHFeVcV7vMKUff7/Wp2SDLGMi hA0iMJQIGRUdlM4L+FsLVv6ExAs94EHe0AjtuqNKRkUBApEI4TjCl6iz7h0h6C5icoEa As44qqcpnpQCetK8MzQvwtZhGpDRSE9yLFKPdb/lM8cOKH/EiJ46DG7xsUY18lVkBj8M ++aTdiG3e6svHPk8YnKltPocMBjPdOJQrtGUWgxYt5C0+K+oDVSaOG6hKURSaWO7kbyU H+fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714639645; x=1715244445; h=content-transfer-encoding:mime-version:reply-to: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=5+IkB3+J9K42d+V5Wi+AdhWpwnXMtEpYhZXm/5fw+dM=; b=dt7/7M89BYWUMcbv2sXe/QldT2hJYIgTxns6VxzRyDDgk1m0zz0/l2/Om2tGxptrQY 0S7Ulu7Q3ugxNlx2gXN/N3xUJnPDUNtEgCPFxqNDlhJ+Y4hLb3BHHfURmTLZfXkEAyo1 sgZeDG6uVzhCvkM5st5G1kNbpaig2qWTIGl/DNd5XiVX4t9qhCF285pcFM0+zbIaq/tW JaEkIVlDvbMFw2MON7bfjG677wPCdf3tnnOo5vxKERIBnVi4vcgjkGVY1bofrz6plZ6y ptYEwuT0/dDreYRcW6xR7Ije3ZE8nqCK1uBZiMTCWLpu4DXyjtzqZQHCv8YfAjBGorf7 RgNA== X-Gm-Message-State: AOJu0Yxlh9jTuZBhOBTJKoBstT4SjYWLDWph9bqBIzj1cb+xPDdI5Pab VB/2SpZO0d6bemB1k/qE6m7W0I6n+YF3zofaGLwVfBSK3JlbQSsNeUYPZ6fm1O8= X-Google-Smtp-Source: AGHT+IFyJzDWLYcpgS33rbs90FlHpYKxLcb6n/RLJGWRhgWQpaZsVJE2vmaB1MgKiD0eY8T7Jpul2g== X-Received: by 2002:a17:90a:986:b0:2b3:be55:bf6f with SMTP id 6-20020a17090a098600b002b3be55bf6fmr981227pjo.22.1714639645519; Thu, 02 May 2024 01:47:25 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id q6-20020a17090a938600b002b273cbbdf1sm686805pjo.49.2024.05.02.01.47.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 May 2024 01:47:24 -0700 (PDT) From: Kairui Song To: linux-mm@kvack.org Cc: Andrew Morton , "Huang, Ying" , Matthew Wilcox , Chris Li , Barry Song , Ryan Roberts , Neil Brown , Minchan Kim , Hugh Dickins , David Hildenbrand , Yosry Ahmed , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kairui Song , Xiubo Li , Ilya Dryomov , Jeff Layton , ceph-devel@vger.kernel.org Subject: [PATCH v4 03/12] ceph: drop usage of page_index Date: Thu, 2 May 2024 16:46:00 +0800 Message-ID: <20240502084609.28376-4-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240502084609.28376-1-ryncsn@gmail.com> References: <20240502084609.28376-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Stat-Signature: cy35bk1mmuy3y3x7q4r1mp4pzpxqwegx X-Rspamd-Queue-Id: 2262AC0016 X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1714639646-612208 X-HE-Meta: U2FsdGVkX1+aovJijldgbq5vdrmHxURLhLlM40LoIvwnRqdQFM2MO3/ocH1lo1H5GCLrt8fL69I7eR5KhK/hApAuq9Eh+mjAJe3Sgh69YnxsEE/MrFpbMinA5cFkuaECwLuyx7Of16xHEte/4MYcP8O4+V5XvJFlKdnLBW1cPaLyl2ZQkz2iTf7CEzQ2mnBcDgwe5U0RyghcR0xZQVCOGV6WG1W+XasKEbF33FI5vETT4APyiiT6taRuVUP5Auwfh1XGYvbH6DR4C6g7+N80p3Sl14rDasRD+SDa8Qyhnc6IcEhTXqV1i2/g/IhKm183pHyf2NuDoRqhtKR2CytolUlYflS7xISrVhbavAWrDLYlfAd5MKe4doPyaW6/borXtDRcWpWYQmAJjL2MIOhwrLLEBPjTmM9yYqdVUX5+1khkhTCG4JKuSLVet9ZFanQjemgobZw3+Y3Vdkc0ZLEudEZjtuSlIvXi5Hw2gjKvq0KdLiux1ntgZ1OyHxaEA6s9PMxFof5KlwhC93jssilBdWB3Gmd/jjpZelbrLomeVeUp0OiSS2w185OXRGQKZkpJRjlIeJuDJ1i5l2WeOiCS8k5PaudZ/nRVsnz0ivSyGL06MUp8SyQafSwFJX3vC1LyG4a0ZVaPlrGG4D6nHczfRdw+PqKyBymvImsd13AwGKcnHAqvYH8C7aAZkV+HagrcX4JJfUPys9e1JEitUQV73/z9x9q4mJmRUt9aAklDW4IBZzm5vlHqxiZVmWwCA7LGi9rRn+0kMWF7Q65Yp3Eriff8HfhutLs4vODw4lTYWARODMx2kNjyq3T5hBkwKUoBF95RJmdcLVe/W4Jeb59B3uVT7f6eFCpK0yxkj8kGZIxRryo1M4MK8fC04DuGnXGvU7dyGMtzAydulIVIOfX0+wUPXNalbBLu+KLd1oy7UI9zF6u1Jw9kx+71G2RjpCxBy1JRrcgykPp2+lZhaVA 07C9XSW+ za3e1CPOy6/rGeqSniZW1zdWt4S0kcD7yi6SnQPAyeJ0a+cK4ROeW33yKK7z+m6zOjQiY9spA5YfRqN/BE51xw/IhYrlFbb3y1i9TX+zT45QXfI0GgRRHN6poVFgUZ5y9zdGyPXKOPWm54twxSp8iBHBaj8OlYb86yt5XpsEt6DpYVRagHse9aD1JodGy3n2bmdazI4bOA8ZxdMa+nhnqrSXY8AI3xHjM+erjbddY+iLcWAbBKTBpi22B9Whu+GCnaBZzUK0NyXNFnJU7zIhH20W9XTTAYeY9bK9Rw9YRmFS/SW9qNx1IgIBvLlWeE1WK6+QYGs6i4NQpUnSaj5AvGGJh+pCi3WQSNa+UEDzPOuZAquh0ws2Z5mWtaivpVt/TeDXP 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: From: Kairui Song page_index is needed for mixed usage of page cache and swap cache, for pure page cache usage, the caller can just use page->index instead. It can't be a swap cache page here, so just drop it. Signed-off-by: Kairui Song Cc: Xiubo Li Cc: Ilya Dryomov Cc: Jeff Layton Cc: ceph-devel@vger.kernel.org --- fs/ceph/dir.c | 2 +- fs/ceph/inode.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 0e9f56eaba1e..570a9d634cc5 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -141,7 +141,7 @@ __dcache_find_get_entry(struct dentry *parent, u64 idx, if (ptr_pos >= i_size_read(dir)) return NULL; - if (!cache_ctl->page || ptr_pgoff != page_index(cache_ctl->page)) { + if (!cache_ctl->page || ptr_pgoff != cache_ctl->page->index) { ceph_readdir_cache_release(cache_ctl); cache_ctl->page = find_lock_page(&dir->i_data, ptr_pgoff); if (!cache_ctl->page) { diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 7b2e77517f23..1f92d3faaa6b 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -1861,7 +1861,7 @@ static int fill_readdir_cache(struct inode *dir, struct dentry *dn, unsigned idx = ctl->index % nsize; pgoff_t pgoff = ctl->index / nsize; - if (!ctl->page || pgoff != page_index(ctl->page)) { + if (!ctl->page || pgoff != ctl->page->index) { ceph_readdir_cache_release(ctl); if (idx == 0) ctl->page = grab_cache_page(&dir->i_data, pgoff); From patchwork Thu May 2 08:46:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13651431 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 D1A64C4345F for ; Thu, 2 May 2024 08:47:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5E6526B0092; Thu, 2 May 2024 04:47:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 594C36B0093; Thu, 2 May 2024 04:47:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45F3C6B0095; Thu, 2 May 2024 04:47:34 -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 2650B6B0092 for ; Thu, 2 May 2024 04:47:34 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D62DF140D6E for ; Thu, 2 May 2024 08:47:33 +0000 (UTC) X-FDA: 82072827186.22.87ADA78 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by imf26.hostedemail.com (Postfix) with ESMTP id 04B42140007 for ; Thu, 2 May 2024 08:47:31 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=BOdA4Qyq; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.216.51 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714639652; h=from:from:sender:reply-to: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=BixicrujN2w/NN7W8Yk1bOtYDD16jf87ysiCrI+mjZw=; b=YrQE3+DhLg1HJqHRIfUWdmmsVYikvvRe82fU53DvLFRtFPiHGHa6Uv+86x8WbGqscIcpIB yLqfMJioy+rjV+M9rPMLbpLUsrkUT+Sn+5/NrtcMMyfduS2JrOdsP2Y3O/FwKxGt6yY3Am RIvlAu1lvFjfDk2FVV+DVY+gGanjX/I= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714639652; a=rsa-sha256; cv=none; b=GyI19KX39tALXsi+MmSgnn0EExo933tOX9UGAO5ipi607tu9MXA96WLzWsC9QyZUhr6Ant XHQbBh1ktsJdgRMtQQJ0hMS74HHSmbvaclsoTRNPHS1Xq/GtpaJld720wi9HQmIQ4gLooj nsbeJMrLDtcFLuHxus4qXLaAFxe/3P4= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=BOdA4Qyq; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.216.51 as permitted sender) smtp.mailfrom=ryncsn@gmail.com Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-2b239b5fedaso2790079a91.0 for ; Thu, 02 May 2024 01:47:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714639650; x=1715244450; darn=kvack.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=BixicrujN2w/NN7W8Yk1bOtYDD16jf87ysiCrI+mjZw=; b=BOdA4QyqWsnNB5h0P0ec06dV+0ilDaYrdvyeSR/fwoN9ZcKyKlrD/vpXAQVPrnSmZr VT7Zei5ENTW802ZwubLfNZC3JjEkBVWx2hbpyT1HaPDPYfMdiC4GEfT5RauEYfpnTJdJ KAXhvjntw9BxT4vLJibYFtkTkwvPOakZCK+N9cKZjPOw44V3aD6xnkDMlmh3lEmUtRD2 DDRWXgOaqJ7xYAwPuvGZqs7Or523/it2x5rTZ59SsqPpVxezkNOVQznOO4wVGYE8VgRY geupDIsxpyHJ303xz9qyc9/I370kMD6yYSY1oycLaDE3ZbgRdExogPZVTEERjQK8XvaI 91iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714639650; x=1715244450; h=content-transfer-encoding:mime-version:reply-to: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=BixicrujN2w/NN7W8Yk1bOtYDD16jf87ysiCrI+mjZw=; b=R41cI4utv7VdZ0Lz4OCFCaKG2cQX4QissElSgv/dhu47AZim7KC1Tz2PcRBcl7WaNQ 6snZuutveIzbAqCjFMIRo70LXZVNa9LZZHRt6Kiy7w7WsU553gjud2kII4pETVswE3j3 isWkPJKIoeLgH7MvtZK3rKNLftDMP1Tkot8HdtsjHpSE6z3CYWmr1qdussAkbsWnqx3g AK/hPt4PnyE2hIV7Vm8yN16+CWK8HOvB7cHNhS+rHNtUHg//Cln6iadIE6g3nxj2wOWG g3BvaO1mTwo4w4fBrqOh+fiiU9mGJ4lRApr/yVZgbufrfhctsLgIpRBSzgrFs0++ZJdm lphQ== X-Gm-Message-State: AOJu0YywejT2SthtEAtdBRRQGyj2ikJLQRzpAbkwE89FhNErPBfRhBy9 qZ3aLEcc3j5RJxwiH7J6AQ4T+U+q6nbqsYE1Q9VclcCSTaMDtH9Z7EPvVzrmDj4= X-Google-Smtp-Source: AGHT+IGbccr4qE+jXDa3rX92HM+k+7c2FUJ+mYHNc+51KVaTYbTEv0IftYCbT5tTMeNMMnMz/pxdug== X-Received: by 2002:a17:90a:8814:b0:2af:fe34:8ce5 with SMTP id s20-20020a17090a881400b002affe348ce5mr4726191pjn.12.1714639650104; Thu, 02 May 2024 01:47:30 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id q6-20020a17090a938600b002b273cbbdf1sm686805pjo.49.2024.05.02.01.47.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 May 2024 01:47:29 -0700 (PDT) From: Kairui Song To: linux-mm@kvack.org Cc: Andrew Morton , "Huang, Ying" , Matthew Wilcox , Chris Li , Barry Song , Ryan Roberts , Neil Brown , Minchan Kim , Hugh Dickins , David Hildenbrand , Yosry Ahmed , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kairui Song , Trond Myklebust , Anna Schumaker , linux-nfs@vger.kernel.org Subject: [PATCH v4 04/12] NFS: remove nfs_page_lengthg and usage of page_index Date: Thu, 2 May 2024 16:46:01 +0800 Message-ID: <20240502084609.28376-5-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240502084609.28376-1-ryncsn@gmail.com> References: <20240502084609.28376-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 04B42140007 X-Stat-Signature: ixzt81h1xkr365brtyohdhfify31938r X-Rspam-User: X-HE-Tag: 1714639651-326103 X-HE-Meta: U2FsdGVkX199reKGygFRe3zP147fM1MaYWr5Najqz1K3gSIL3bOydEimd9D2TyCDLYbssaguMHzSf+e4xgitPRnueHNIIldU1+fgD5rgXRzWEKO57YN8GkPYufosnNBLh7mHIiXnVMqjbptF4afJucUoElJU8Y/hALVg6rW8C4c77envDsJU+OBkXNSLHdUdv7f9PNcBVmsOI0E1X50SsHSoZo5PsLAh7gFuM4rHrenLTNlaXBnalsZtO6rGgFweyF/yXExVnrGlNa307V/r3JYFazKHwFoimUY+wERUqa7MUHb+CCvbfdOetkBliFGBHDBk5EoNqpJqUR/lp7tjuf9v0RosD0wgKC50i9lJPjGdxD5kaPL0zJoNehc+Ie+KEYwyeFK+fSPUN7X7/6wdlWhZnVWgQP5WkXZfNl9hySQgTr3RevUKAF4c/7CmmiX5+zCb5g/B6ixgjuPJTvYmeCoe+FuNCnRYI7PGuSkdVs+io9XD7x+h2d2wygO/bqJUYGcU/SbPnIeXEh7rftVzNLJtxtcm3OeE2qm5NvkfNj5l7Cu0o+bYPTXzfW4tPci+bPFXTs4tBA50XRH6EJE8qmzDsaBUxcofLUvHOKTvM3oPzgPtQ4sgGnfzQZ17WCs8JYpAFrM/bMOM2qU9L8BNMFC9+OUHN4sD9SYjwMEoiTK56lBklufXz3/xzJg1dlL3rLN76H9RaT15itXgOfx1L0Gc6BipNFPyPMPtSfm+E9+Xl+EFpBPHXH1NykEET/fttN46nw7YCzFU++XFzR4zKxUmrp58cLuJAbGj3RkxUu3F2rvja5NnodX66SlFvH14i2W+gqGg5UJDERS5AoEEZIcOA+pUb6CQOEm5L07fyhbh18/klzNFeVVY7mqznE/8EZHmOMayRdAmsbVos9IgCP5Rfqmo0hNYjAXbDbjikGnpiAJtJaZ31pgGRxXixKY3gxyTThsWj9tP0xGN3Po AUjSkHtl R99tI+kbTeC3G5MiaAwE1+KW9R+Bhkjel6Sty1IvWd1aXqE3B+a5kmkINPPzaAPSmmYGEPDzsrI7OSPLYjmlf0l1jAovWUjBHoZDV83pZWfccAhjuOsZkPMSjmGOvWNA+bJtyfRkoEihyrqUbMbWvB9UUPZ+1dEqGKlLQI2jQZ5t1CvQA0Im7xjN2AjELCo3aE2cZWsztMVoWhtmX26jBeXPLnLCWQhgb1iIIaZLIdZg8Pdj8S51XZQ0yyE41wMO90Bepu83Cns8HQieXgfh7o7nn1hEc/sR4ciYtNIFEZx0ZmXa8L4nC2os94GRB3GBJAJj+brejgRTPnEY6kpk6SJ8nrvL7vqEJCxxXE3cbPI/bHe1BWRgVngg8G0I0iVN6Hyuu 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: From: Kairui Song This function is no longer used after commit 4fa7a717b432 ("NFS: Fix up nfs_vm_page_mkwrite() for folios"), all users have been converted to use folio instead, just delete it to remove usage of page_index. Signed-off-by: Kairui Song Cc: Trond Myklebust Cc: Anna Schumaker Cc: linux-nfs@vger.kernel.org --- fs/nfs/internal.h | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 06253695fe53..deac98dce6ac 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -790,25 +790,6 @@ static inline void nfs_folio_mark_unstable(struct folio *folio, } } -/* - * Determine the number of bytes of data the page contains - */ -static inline -unsigned int nfs_page_length(struct page *page) -{ - loff_t i_size = i_size_read(page_file_mapping(page)->host); - - if (i_size > 0) { - pgoff_t index = page_index(page); - pgoff_t end_index = (i_size - 1) >> PAGE_SHIFT; - if (index < end_index) - return PAGE_SIZE; - if (index == end_index) - return ((i_size - 1) & ~PAGE_MASK) + 1; - } - return 0; -} - /* * Determine the number of bytes of data the page contains */ From patchwork Thu May 2 08:46:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13651432 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 50CCDC4345F for ; Thu, 2 May 2024 08:47:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D5EFA6B0095; Thu, 2 May 2024 04:47:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D0F886B0096; Thu, 2 May 2024 04:47:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD6C46B0098; Thu, 2 May 2024 04:47:39 -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 A067D6B0095 for ; Thu, 2 May 2024 04:47:39 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 536CA120A7E for ; Thu, 2 May 2024 08:47:39 +0000 (UTC) X-FDA: 82072827438.16.80C55A5 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by imf23.hostedemail.com (Postfix) with ESMTP id 84D1114000E for ; Thu, 2 May 2024 08:47:36 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ez6VNN+u; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.176 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714639656; h=from:from:sender:reply-to: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=7PiwJE9uQmN0uws0CC+HD/WsVJUPjjolITxGR0eGWdQ=; b=RLWZhCw0IeJGVExazLRVc2EZN+jyoMP74pubyiexinUdsTTBlAOUM2b1XSU5O7qy9fijJd +AJPrfTFNDC1foBw0sShrDPhhoAG2cnA0+xiyXPhln9I1r9viOKRNuh6hNc9m414rTIRKS dk+REL/C2x4jqBmYIc/cuk2p9Hjs9w8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714639656; a=rsa-sha256; cv=none; b=ekP9WmZHv8LJiBgiF/FEtzSVbLkMJLhH6H0PUKtpUWw6QbXDBMAQJVmOazNkisdckTx3fR Xz5zL8HrobpbbbY2Ije0rQ4ZwG4He18ikG4ZmPGzp4iJyx0vJhSvEi9S9JpltDLdyXpt4m ufQtG3a7pTJfBpOU2ITNKUJ71IBIxB0= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ez6VNN+u; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.176 as permitted sender) smtp.mailfrom=ryncsn@gmail.com Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6ecff9df447so7360694b3a.1 for ; Thu, 02 May 2024 01:47:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714639655; x=1715244455; darn=kvack.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=7PiwJE9uQmN0uws0CC+HD/WsVJUPjjolITxGR0eGWdQ=; b=ez6VNN+urMDi1YAZoADpsp8G/eEEqcTKwWKvZpZ78qC8i590ZoU0QcnhvepEipBusA S8bqmd630Mjd+A0NzvBvQABDiwvXZY0N/wR5Za5WtQU63DqXczhWoecRVQE5aRfXodyQ Sllw4usycKPp3/tMK2EWrE6mnXIbfG/VGSnw92fmaAg2eYEKqYF7APOvcbiX13GCOG/F CTioB8Dbitmh/htGU+p/9ZPSi+LdWZOOr4FmZswnktY4pdJUkmTMrxfqlnfz97P+USQq FgHfmZrYuHqpe57olnRYLDfDh23RDx3L6s2+/EXxfbtkxHxh+nqJiS35rorh4/Wg5mkx IBKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714639655; x=1715244455; h=content-transfer-encoding:mime-version:reply-to: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=7PiwJE9uQmN0uws0CC+HD/WsVJUPjjolITxGR0eGWdQ=; b=AD5X7RJehGYrWcq3ElrOUTGIHFjgdXq2JN/agE5p1mWVLFDVpEzqMVOCyNGqAFPbeF KfxyUKTJNSS7gT0/w1eNafZkc05ZyapqUk2RLehEoTTt/LDIe0ORBuAnES9OIADB/kCM x7j1ToO7pn7BBKb+9PfhYflYpZziSx/UkCz5XLdFx5YLoBoyyeoSF49+59e5SQZLE9Ja Tq/BHpbSX3wy38iaBU1+Sgx9wjGa4qfwy17k+nHJGbD/e2DJsG5KGLN9LSW958jrQaJL n5FRmtX9+wFDjCyz+u7NqzQmj778tkjN48juzAQh5wSc+hxl00kgnyAJNms6O7NDlBKR nU3Q== X-Gm-Message-State: AOJu0Yy12wHDHayfllzjwY6j9oxuTSZPpL+0lqLgfufbSOr1G9tSrzTC dAaHKgOo9tPd8z0xiNZB/mLRoOsAG7JrRcksVTg5beXo7vaJ0xWo+SBxHEJj1WI= X-Google-Smtp-Source: AGHT+IH8n+nmsJYFVIZGJmzndILHRpj0aN5unHTTwojRKIiOB2rktCNSIBo9mSCnI2OwpCiqNtBByg== X-Received: by 2002:a05:6a21:7883:b0:1a9:d9bb:acdc with SMTP id bf3-20020a056a21788300b001a9d9bbacdcmr5924624pzc.28.1714639655088; Thu, 02 May 2024 01:47:35 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id q6-20020a17090a938600b002b273cbbdf1sm686805pjo.49.2024.05.02.01.47.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 May 2024 01:47:34 -0700 (PDT) From: Kairui Song To: linux-mm@kvack.org Cc: Andrew Morton , "Huang, Ying" , Matthew Wilcox , Chris Li , Barry Song , Ryan Roberts , Neil Brown , Minchan Kim , Hugh Dickins , David Hildenbrand , Yosry Ahmed , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kairui Song , Steve French , Namjae Jeon , Paulo Alcantara , Shyam Prasad N , Bharath SM Subject: [PATCH v4 05/12] cifs: drop usage of page_file_offset Date: Thu, 2 May 2024 16:46:02 +0800 Message-ID: <20240502084609.28376-6-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240502084609.28376-1-ryncsn@gmail.com> References: <20240502084609.28376-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 84D1114000E X-Stat-Signature: dintpjymmhjtnecz3djesda3tpratafh X-Rspam-User: X-HE-Tag: 1714639656-387356 X-HE-Meta: U2FsdGVkX18QE1r44DGaXY+gZkSuusjO2+N8WV6jN01OkZZ3xqbFN7VDW8QepdpGaY3ana1KDNvWyYQTWNUIXUL/bOOOpAWA8sO94b+oqYbeRLXOk8Qo8CI9VnHPV8nXLGYUyHgCmP4cMy746hedMGynO93Mpq5mrOj5YeOzQY+EpybsGmZUIer4U6G8pSicHpB69ymNkeHPmQDskOz0TP0z3UsawHQXtrn423KLRU+1GoBgKQ2hh/pGsrkX1HvhID3AI4uJsaYspYpOWWlMMDEak2+ssJLt7jlwunhkytdKlraA9JNKJtq3w/xfXDF3c2x2jHOowqB6+3QokuvM2yyMExQkRe/ROTWGFnnvNPAJb4vw83IfUasqnDLur8xT+7f8ZtWfLaIRrCZhmxX0ZRLlUUuPFPbtsrs1PU5fLyFtbYjBOyQ+E7FPYY8FqKgnhcSwP1trrTzODloG18ddQxIQ9+3kh8aAdTc7E8GAxGHpDLCWBUgwtVjQ9qkslI7+hU+JyrKWI9U1olgiHnwixs5YvAMKkoJFSjsMLwf29b216VzVbl2G0+WuTsLXPWi7mLp2DhIV0Cbc0u5lIL2YbPOW7wxfSz6hfQ+ULVwUcAPsEVXF04WmbobzdNDkljIbGNkhViZq/vxp1oFnlzwO3dt5rh9TyOE2hp8CA8Brl8sgPdclv+tDKmHj4LiokfApuw4xRK+Cdr8wQa64vQLa44tDo14IIUtgcdiePM729OgAbsNjst8gssL+KSLkTO16R5B6FXpCPKPK2nUYHjHTfw8e7I9IG6redX3ohCjAz6VWyTn1VQgdCdn1mf97e2ZInjU5XC97VZLEKWyPYY50ULGwPNXMr4u0D+5xOyxkMKU6u3jASbt3YYGj07JxxFisM1gThX6wqR08c3ju5lnwHFgE79unkO3+hmCWYqoFROAm4XjHj4mQ3MI8x08XVAZDFGxHQExXZuqnmDRbkwK JVixV0Cp xwPvPa+MhO0/y0snZgbxrTR2seeAQBjOFGwHLiPumN0PrWV0rfFZQUUluG/hR42UnIWYWnYBe4ETC6DptaqRPILXInzsx12blgb6wmgGeW8kez7WOpPgC9vNlNPglbNvFeqxXp6vD5a1bc2urZ6VnU10hJ0WjWQyoOZHAjZ00ev9hY0LfzqMhrjaNQatj95P+TwIKwzL8pCR52j0elwUWWEEtOCNOlUcEoyYdkpfLYC7aeypJlQA73QfjDKNjb2AsbAre8FMv4PAvDN7pAUzS33CxFjzgDOKtSk0kOKe3zHi3NtPFNC6Qm8bXPw== 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: From: Kairui Song page_file_offset is only needed for mixed usage of page cache and swap cache, for pure page cache usage, the caller can just use page_offset instead. It can't be a swap cache page here, so just drop it and convert it to use folio. Signed-off-by: Kairui Song Cc: Steve French Cc: Namjae Jeon Cc: Paulo Alcantara Cc: Shyam Prasad N Cc: Bharath SM --- fs/smb/client/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c index 9be37d0fe724..388343b0fceb 100644 --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -4828,7 +4828,7 @@ static int cifs_readpage_worker(struct file *file, struct page *page, static int cifs_read_folio(struct file *file, struct folio *folio) { struct page *page = &folio->page; - loff_t offset = page_file_offset(page); + loff_t offset = folio_pos(folio); int rc = -EACCES; unsigned int xid; From patchwork Thu May 2 08:46:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13651433 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 6C4D9C4345F for ; Thu, 2 May 2024 08:47:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E97976B0098; Thu, 2 May 2024 04:47:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E48686B0099; Thu, 2 May 2024 04:47:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CE9456B009A; Thu, 2 May 2024 04:47:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id AE2C96B0098 for ; Thu, 2 May 2024 04:47:44 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2DD5440C69 for ; Thu, 2 May 2024 08:47:44 +0000 (UTC) X-FDA: 82072827648.25.9672922 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by imf25.hostedemail.com (Postfix) with ESMTP id 57ECFA0013 for ; Thu, 2 May 2024 08:47:41 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="aDn+/5/m"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.216.41 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714639661; h=from:from:sender:reply-to: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=o1JDj7M+VHieQbjCEGNpRgkTBIVb3xdVSM/lbKWffPE=; b=znlv2DZkE1ov6u3LfimVuNJSp2SpJ2otuwDkG7uTyFuREbrvIpQGMnTiOWjV6zqdgxrjWX wTjLQjdt0diB+9se9sJLEk0L22bRV+pQYIwSz7HgQWrcYUQb2L/2WoHfeINpkx55vvpH4G vzO2hKqKKVcTdr8NhylyGYqkogl/FUo= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="aDn+/5/m"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.216.41 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714639661; a=rsa-sha256; cv=none; b=kCv8Bwx3WIRgLFJ/LJM+3DPYBLvQU/OpgrUANDHJrlc0Vz9AxQZwuxMYAWdbEIfrGI3THG gHn8tcjkz4GXW9vRi25uDlmS7i/lL4B/94Ffgq1x1cqN9HcFucwShaLXmuVhm8XJeu35LA HfCkqFcgL/tmTKlEuDa5ZkOtEgGLJaQ= Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-2ad8fb779d2so6190723a91.0 for ; Thu, 02 May 2024 01:47:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714639660; x=1715244460; darn=kvack.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=o1JDj7M+VHieQbjCEGNpRgkTBIVb3xdVSM/lbKWffPE=; b=aDn+/5/mqxzNKONIpas2hCudVUbLfh+vYnT5EbOU7uh1ZHIb8eT9BRWInMI1hyUJ7b RBz7gg5qVnoLUGamVZk2uSdUJNDy4a8bhC8XHWGyUxk6X8aAUO2ck68Cy2sVWrwDzKgf Yv6jXJlZYhQNQ4TTMuQ5HD6lat64KfZ9aJZQH6+pr/T5tuO5mzhEmuIuMlbajDO5u054 t2l0Njts6HRDNApnQvz5NMrJDGBJsnajrrRR/890gEf9ti5qgSu/z1D5uG3bHNY99Fm4 x/nO0cj/iqr9oNsMy2/PI9tiRwRduG9KE9LpUpvI5Ei5YY1cAQlN1NxtNkLRhE1HA8Tp fJ/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714639660; x=1715244460; h=content-transfer-encoding:mime-version:reply-to: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=o1JDj7M+VHieQbjCEGNpRgkTBIVb3xdVSM/lbKWffPE=; b=PZ5uCLHEWcSVBiJf1IsAiqwAEReTNdOHZCttUTsuCY7rma7fwv9lcWa/OFRn/b5BDz MjkM83GBiLoLKxFPcdAc37+1PyCAAn2+J38xdhJtYsQcZS3N2NhVLaULQNDMiSM1NG4Q NKkT4AKX+VEklOgwn6CLpGa/UDw3dQtSWaX3KM5A1aPrJndg+0J+5FjBKIDm36nXMwwx HpSMdjzRbMKYwVFamT9sSp5OrHJRulekBlFsNqgITae+Wjoysz/EPD3jCmZ6i+5p81ro r5S3ZjiE7WTeN34lFSDSkJ8mYc+zEygL/Prx08szo4ny7aE9ORTBhTMfG85GU1KXlAa1 6WNw== X-Gm-Message-State: AOJu0Yyr/MsMOI7R+1d6UIGnHpoSxLDkGh6+O4aIKrZQgeQOJY4SVW3m hLQW4Mf+fKaQ0TkRUon6VFCd6LZ4Vtrbp4Sl+hm3YEHhhjUR4NRY/0/pRSlivhs= X-Google-Smtp-Source: AGHT+IFBu+Fs+rmoaivL9bptW5t+ch5V+p6LPKN15/2dRUJC/IPaj96UkzDDRSMAnS5vPG9aDDkxww== X-Received: by 2002:a17:90a:550e:b0:2b2:9d08:82d2 with SMTP id b14-20020a17090a550e00b002b29d0882d2mr4896166pji.42.1714639659690; Thu, 02 May 2024 01:47:39 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id q6-20020a17090a938600b002b273cbbdf1sm686805pjo.49.2024.05.02.01.47.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 May 2024 01:47:39 -0700 (PDT) From: Kairui Song To: linux-mm@kvack.org Cc: Andrew Morton , "Huang, Ying" , Matthew Wilcox , Chris Li , Barry Song , Ryan Roberts , Neil Brown , Minchan Kim , Hugh Dickins , David Hildenbrand , Yosry Ahmed , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kairui Song , David Howells , Marc Dionne , linux-afs@lists.infradead.org Subject: [PATCH v4 06/12] afs: drop usage of folio_file_pos Date: Thu, 2 May 2024 16:46:03 +0800 Message-ID: <20240502084609.28376-7-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240502084609.28376-1-ryncsn@gmail.com> References: <20240502084609.28376-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Stat-Signature: ruq6ecfbthmar73f5mb6ocru5xyz9odh X-Rspam-User: X-Rspamd-Queue-Id: 57ECFA0013 X-HE-Tag: 1714639661-376712 X-HE-Meta: U2FsdGVkX18NsHIrl7UoMNM6oON+jz2TIIt0Y8HRpqKTOMfyYKFfMwk9zjt7tYUw1yfvdzlYLocxiFAKxU+QpQr4UQ78ykDnPwy3GzJfphuBZWmyDjORzKzbyG+T06U50DoTf529H6gqgywQPjLJX/S63p3xKT6IcdquCwHSp/DYvwWB75XM7qlTaSHlVgDHCORR+dVT5yefw7IXN1cr1c3+nFF7LIHJJhopiSsPt0yPweQYRR3dZ+aihlOqA5SMvv1nyPr4lgpnnfsSLJ9sQsBXCxdiIpJZoNeultiuTYkZO7zbCJgCToCBsLhFrBbtXBB1RTorBdVvciUto83ZjTthER/MMNjioLh64ZlFlhQ4aNkocbOOaz5/qUhCixgOGGddSRgYcC9jw30hmV92d4U8nFdfAwcYIpNjfXW2OdqOME/zmkPImPs1LrMsGhug29PrWcd/HNznR5TNb2EYK71oNo22pHAuy31mHF7ErxsiE1YSGf6lUfz0nqCuRK0hjwHYaBCSYxQUAlCq7t4iLAgcLypu/nKupH5ljWV7V1AAdCXws8hn5HXBoJqbcVPKOicNsnU7U2gEhN8c551weq8ZDaCfxkGfZ3yzQsTeOc1QQeC7oQil6/k5xi1eG65fiGr9U4pNC/HCai90zDtF6cMyr1pQTPBLvXoNLHr3c81Egu7wQyQNYXYp+QZLSQMJv7vSFAM8dX07shuzadgRMr0pvYXKnbkrDFgP8X45H/NBBpT1xu3RyUO8CKMxj7WmETxh0S+BZf6tC4spxO38mt/4obl/bANnVJo0dV8vIJJ08O5Dp6SqqsugVktVLEqbmwConyYQTvV9nR710LkyvOovI7WW3o/PPw3BjQalGzkB5KXb7tPYzkl+yLyPIJelZMp6rLubr1gwoe5jqVNq7o81TaUZjLK99S4ldwPO8W1cG8ECm6SAGxkDeqsLhZjc0pOTvGpthwkHFeMEQtq Ieuv7Cma cZA52MOjBwKIxWelOXaAIcYajCggBe+42KmGUl0AKG+XNpaAwGh8NEBw2imeyvkD9tl3gTBAD+BNev/egmb/DALIG0ryT5ILuFO2YxkxfyGl1C9DWe/oUglKGllaUs9GfmMNArt4M/sr27qs24gkjfaHGA+uv2w1LGkBAJT3xTB5JWOitzOvy9UHxA75ABHJON+QjOzocBC1+VtH2oPGlIq7bWcmthbA8gauIU0MEzlWZjHKelt81BHa2nshAUHzwbQRNY21yhjuG4g1eU0Y0vPzJ5pu1jVlHNb896EEdGtSU5Woxl0yA7YW2eFccETmBJhjTi+Lfa3/zYtWA7lOmrogTvvLSyGG3Ll/xLs3jEqrBWwJJ4rBC06VrVSk3RJB9RV0mKLWL26eJphPwkgqVtNe0poqNPyw9t5F4O+gknxSIzth3Yg7t+eRNT5Dv9rtqS078KUbDPIPsCteQ8oudsunTWk7j8nAijWru4R+FGGdBMCfxk00ICsePvsXpApNh4NYTh/dg+p33M6NyTPcPrAyJL4XTaCTpp+INaUi5eZ/40VcEvKrAIletjWJ6uO2U6Slu0HQORikmlA++AG6kOzKSwoJ+y1OPVSIlrcdwXWA1SGuswBifSXeo1Y0hjnqlwZZtVrq4f7e7EN0p37lZL6W6UzKvbHP4m/pj1E53tVjsAdMXcxIuL2R2VNv6tNoQFtd3WGNoziDQvGvF/tTznlBUNZGeKw/fBxB0BdtviwUCNnfrFE1i7/Xgpnx4QFUbG+aoWp3Z+FP93r8N1aYxFuXWShzkJv64AM9zWME6XCsLjgPJznTAU3DgbQ== 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: From: Kairui Song folio_file_pos is only needed for mixed usage of page cache and swap cache, for pure page cache usage, the caller can just use folio_pos instead. It can't be a swap cache page here. Swap mapping may only call into fs through swap_rw and that is not supported for afs. So just drop it and use folio_pos instead. Signed-off-by: Kairui Song Cc: David Howells Cc: Marc Dionne Cc: linux-afs@lists.infradead.org --- fs/afs/dir.c | 6 +++--- fs/afs/dir_edit.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 67afe68972d5..f8622ed72e08 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -533,14 +533,14 @@ static int afs_dir_iterate(struct inode *dir, struct dir_context *ctx, break; } - offset = round_down(ctx->pos, sizeof(*dblock)) - folio_file_pos(folio); + offset = round_down(ctx->pos, sizeof(*dblock)) - folio_pos(folio); size = min_t(loff_t, folio_size(folio), - req->actual_len - folio_file_pos(folio)); + req->actual_len - folio_pos(folio)); do { dblock = kmap_local_folio(folio, offset); ret = afs_dir_iterate_block(dvnode, ctx, dblock, - folio_file_pos(folio) + offset); + folio_pos(folio) + offset); kunmap_local(dblock); if (ret != 1) goto out; diff --git a/fs/afs/dir_edit.c b/fs/afs/dir_edit.c index e2fa577b66fe..a71bff10496b 100644 --- a/fs/afs/dir_edit.c +++ b/fs/afs/dir_edit.c @@ -256,7 +256,7 @@ void afs_edit_dir_add(struct afs_vnode *vnode, folio = folio0; } - block = kmap_local_folio(folio, b * AFS_DIR_BLOCK_SIZE - folio_file_pos(folio)); + block = kmap_local_folio(folio, b * AFS_DIR_BLOCK_SIZE - folio_pos(folio)); /* Abandon the edit if we got a callback break. */ if (!test_bit(AFS_VNODE_DIR_VALID, &vnode->flags)) @@ -417,7 +417,7 @@ void afs_edit_dir_remove(struct afs_vnode *vnode, folio = folio0; } - block = kmap_local_folio(folio, b * AFS_DIR_BLOCK_SIZE - folio_file_pos(folio)); + block = kmap_local_folio(folio, b * AFS_DIR_BLOCK_SIZE - folio_pos(folio)); /* Abandon the edit if we got a callback break. */ if (!test_bit(AFS_VNODE_DIR_VALID, &vnode->flags)) From patchwork Thu May 2 08:49:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13651434 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 945CDC4345F for ; Thu, 2 May 2024 08:50:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2667A6B009A; Thu, 2 May 2024 04:50:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1ED646B009B; Thu, 2 May 2024 04:50:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 066906B009C; Thu, 2 May 2024 04:50:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D7B566B009A for ; Thu, 2 May 2024 04:50:24 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 8B0B6120DBD for ; Thu, 2 May 2024 08:50:24 +0000 (UTC) X-FDA: 82072834368.05.1554E67 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf01.hostedemail.com (Postfix) with ESMTP id E12EF4000B for ; Thu, 2 May 2024 08:50:22 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Rg7RxUR5; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714639822; h=from:from:sender:reply-to: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=7HU2SkQDR4mMrV58+lW5U65TL0KC+HX+uRYg6Mar4vo=; b=W8aR21BP8xLaXpquI+tPAwmbrLuxxfaMwwldrpiikenOgXT+fhNdc0+r5LFoIyJpZY9UB4 J3y+I/NPCFbK7qS8NhN4bOof2ALG3+JNxOf6Hv+9ukiy6XMEWzV+sI1tkQzoxYZFa6chkO 2efNvy8ZAcMTaXyzTcuHkCguvrKeI8I= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Rg7RxUR5; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714639823; a=rsa-sha256; cv=none; b=Pfppeh1RhHcpDXN8qxbC34MNF3gXGg3faDyB4fYVuq5qUIpIapgrDuazquystc4gf7/Y9o EFaoetFIH80VjBFUtK67LEenK7v7ZfDHw2fTN3vLMIqKBPsJNKK8QPxhUmMDk8PjWK2FNw NkFHV/GIbR8wto6yiMhSZLQXsF6Bpyg= Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1e651a9f3ffso39781735ad.1 for ; Thu, 02 May 2024 01:50:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714639821; x=1715244621; darn=kvack.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=7HU2SkQDR4mMrV58+lW5U65TL0KC+HX+uRYg6Mar4vo=; b=Rg7RxUR5cXKm5DMXEmyYsBnRX+9PMnO78h+s5CHSgwMEYR8bFJ7xKCEPQBDZue1zE6 HU9wdQkGjlRJkDZn72n+oY+cOajSTpwllQ+pUx3jJzocE+Pi+I7W0ywE9GJ+3yvGARsv 3eae6FNVghIio/LGdOZBOwLMtT9NVeVeMXTTzoXotxwNBrr2txtlw60sERmQvvxdIiqp UBMHG9nPa+NoY2+nFd8T3iBgN95DF41FRPQVrJi3+XJyELPP/Fev177AEGDjySW735xf oGDi+N4+VVYCuhUp83AxVCbyCQpB2DB8S7qHIQmVFFdZL3CUnELkR4+N2//xOiontT4X xsFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714639821; x=1715244621; h=content-transfer-encoding:mime-version:reply-to: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=7HU2SkQDR4mMrV58+lW5U65TL0KC+HX+uRYg6Mar4vo=; b=sQYilh6btwgBmjhNvmisBdxc0CgszBxTmHUkYUl75YPAe+CIQL1W7TVnV3CdE3beXV zC/z0EsQJstSYNxcejFJPLSzYHbJbgzthiGgttBZrgXu2irQ+J31bziWRBgJWsyp5Yqd V+/kOABqqX6V+fhJAHJ3ERxQqMIVuE/B2Y3VHVYIMt0JecqYel7rxfhuht7+5o4i/bKs OgkiOw3Q7TbOOlBK1whmUCYHpn4wZmqxL78uh14OvAITLfBtxDHeciG6At0Ks7bypjbT geraZ25ZKSVeRB1n9yXTARbuQD1ih3n+EgYAIEFQz8zOp7ENjL7oUA54DKk6eM2N0Qfs 9tGg== X-Gm-Message-State: AOJu0YzZqdrug7EHqiTNX8B1EFavyOzR/wxgdwQjF9m0tBLUB5FG4V2E 7KKZXRN7w2LGk+lMnBZHrNpqvpRBce8TjSfZT6fZbJ4fsOG7LvOqEGh8h+XCUx4= X-Google-Smtp-Source: AGHT+IEum/YkVi3jfWr1OA1pFH3dJL22MujEcP594sYqp7lP92G8EsNoWMfK9ZCNtKjcgZkH0nMekg== X-Received: by 2002:a17:902:c402:b0:1ec:c7af:881b with SMTP id k2-20020a170902c40200b001ecc7af881bmr3321063plk.54.1714639820550; Thu, 02 May 2024 01:50:20 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001e43576a7a1sm737712plh.222.2024.05.02.01.50.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 May 2024 01:50:19 -0700 (PDT) From: Kairui Song To: linux-mm@kvack.org Cc: Andrew Morton , "Huang, Ying" , Matthew Wilcox , Chris Li , Barry Song , Ryan Roberts , Neil Brown , Minchan Kim , Hugh Dickins , David Hildenbrand , Yosry Ahmed , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kairui Song , Trond Myklebust , Anna Schumaker , linux-nfs@vger.kernel.org Subject: [PATCH v4 08/12] nfs: drop usage of folio_file_pos Date: Thu, 2 May 2024 16:49:35 +0800 Message-ID: <20240502084939.30250-1-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240502084609.28376-1-ryncsn@gmail.com> References: <20240502084609.28376-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: E12EF4000B X-Stat-Signature: 1qi4nsch8m1x8id1jqbkyqr3pqa4r655 X-HE-Tag: 1714639822-527930 X-HE-Meta: U2FsdGVkX1/zzk0ouRwoP/eeLYhC/rJivCZ7i7f/kuTvt1a7rISYsaEYgal9StcGd7vNSHRvfx1O61J3BQzcvg6JugJYbcFfDXQQxltWvF3te0+3ji3DAW/Gf0ekL/nYfgBF545a0ZXX44jWhVS+9FVsxOFPagyNhRLNO0EmOkEmi/jz7q7+y6wgo9XoG+TSJEAQOiBqrOckpmEEx3tH0K/yL3BmFOpKYuPEXKSMKHUjqsX35gZCEgATcEi5akvPoSd00kMno4So0VnzctuZR9yGIXtEdIHP3FavwhMPJyJTvAI0arS3ywCSY/Rt2fSsks3omWRGydxgEI4IvjeeNRZnFb2NHDRynE7KnB8CKlqRItsNQ7ghVsn9z/9AfCL9445BIIbc3fka9mPaq2C3Jtz2VixnwRsbqprkQaMzXIbtH64uJdfriLsXcfj81ntcBtvn7pgxLaN2O2AjgjThdvKWHI3wRBUfhwIdikIN9t0TUDuQagAGLG3z6nKaH96Tjzi2Da3BobbuUgFmG3um87KXKn68C5MuMIXiJKZej37gI2GqrRRCXeTIkUkrCG+MTGZhjLPKbN/Ua5LQ4QG9LT+nHkigL8vfB9jXiLP9lplXV0KihQsTHQ8kMgNPAqJsUg3Jve0ZRLtfSKnikx9+srS9oeuGe0HW+aKF3AwNg1JJ4te7VQ+aJvhtIzRECI0J2TzOVTdI1gKWb8gWNbOu9QFQ6bXzK7pm50CDyvLVV5eZ9oep3VVt4pL1YzoiRdxix6LuDCfiCDaH0tE5JU35hFUeMuE6s82vCDUhVejT31qHezxU8HVcx6B+hEfA2e9wYOnKLLUVxpPJqrrDSNirmdJ/8m8t7fFireOql5qQDHbCNnT6ANc8mBgDNQzHgJPNJWFdMgfEKvyB9v4q/PGdJNXEl+L3AyVyxnRMQSQjwYrW2UvujBgKcl3a/t/YIqIVz/BDSFGq03n2aR/qVWz Ir3+ZxtA nf0pgKJHNaHkYBXLyfQxOL8hG4K4my4DF/6mNE22caadJbxj7T7/inEs6VsD63bRheEr3kyhp9J8vusLrpZyJbaFoT7CrV1ZNJpZEo1wS7aPJ6/dwvGekiPlsQ8zFfHlRhUlaVJVpBUcmIFuIcUEo+RV3V0C4iP2WZOKBnQZkeleSPPvkb7Drj6p0KdR2gpR7FQJOEy7Ti6CfL+kYVLZXsD8sDnXJbuV9AhZCR2J4ivXh0sM9WODaKfgzbPl1e6N31mXfEhQhSG/33Bkc646+IPgBCGj8Ocdf518C2fUlGdANUneeBHvWu6Tg6g== 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: From: Kairui Song folio_file_pos is only needed for mixed usage of page cache and swap cache, for pure page cache usage, the caller can just use folio_pos instead. After commit e1209d3a7a67 ("mm: introduce ->swap_rw and use it for reads from SWP_FS_OPS swap-space"), swap cache should never be exposed to nfs. So remove the usage of folio_file_pos in following NFS functions / helpers: - nfs_vm_page_mkwrite It's only used by nfs_file_vm_ops.page_mkwrite - trace event helper: nfs_folio_event - trace event helper: nfs_folio_event_done These two are used through DEFINE_NFS_FOLIO_EVENT and DEFINE_NFS_FOLIO_EVENT_DONE, which defined following events: - trace_nfs_aop_readpage{_done}: only called by nfs_read_folio - trace_nfs_writeback_folio: only called by nfs_wb_folio - trace_nfs_invalidate_folio: only called by nfs_invalidate_folio - trace_nfs_launder_folio_done: only called by nfs_launder_folio None of them could possibly be used on swap cache folio, nfs_read_folio only called by: .write_begin -> nfs_read_folio .read_folio nfs_wb_folio only called by nfs mapping: .release_folio -> nfs_wb_folio .launder_folio -> nfs_wb_folio .write_begin -> nfs_read_folio -> nfs_wb_folio .read_folio -> nfs_wb_folio .write_end -> nfs_update_folio -> nfs_writepage_setup -> nfs_setup_write_request -> nfs_try_to_update_request -> nfs_wb_folio .page_mkwrite -> nfs_update_folio -> nfs_writepage_setup -> nfs_setup_write_request -> nfs_try_to_update_request -> nfs_wb_folio .write_begin -> nfs_flush_incompatible -> nfs_wb_folio .page_mkwrite -> nfs_vm_page_mkwrite -> nfs_flush_incompatible -> nfs_wb_folio nfs_invalidate_folio is only called by .invalidate_folio. nfs_launder_folio is only called by .launder_folio - nfs_grow_file - nfs_update_folio nfs_grow_file is only called by nfs_update_folio, and all possible callers of them are: .write_end -> nfs_update_folio .page_mkwrite -> nfs_update_folio - nfs_wb_folio_cancel .invalidate_folio -> nfs_wb_folio_cancel Also, seeing from the swap side, swap_rw is now the only interface calling into fs, the offset info is always in iocb.ki_pos now. So we can remove all these folio_file_pos call safely. Signed-off-by: Kairui Song Cc: Trond Myklebust Cc: Anna Schumaker Cc: linux-nfs@vger.kernel.org --- fs/nfs/file.c | 2 +- fs/nfs/nfstrace.h | 4 ++-- fs/nfs/write.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 407c6e15afe2..02741c32e114 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -588,7 +588,7 @@ static vm_fault_t nfs_vm_page_mkwrite(struct vm_fault *vmf) dfprintk(PAGECACHE, "NFS: vm_page_mkwrite(%pD2(%lu), offset %lld)\n", filp, filp->f_mapping->host->i_ino, - (long long)folio_file_pos(folio)); + (long long)folio_pos(folio)); sb_start_pagefault(inode->i_sb); diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h index afedb449b54f..d249741452e1 100644 --- a/fs/nfs/nfstrace.h +++ b/fs/nfs/nfstrace.h @@ -960,7 +960,7 @@ DECLARE_EVENT_CLASS(nfs_folio_event, __entry->fileid = nfsi->fileid; __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); __entry->version = inode_peek_iversion_raw(inode); - __entry->offset = folio_file_pos(folio); + __entry->offset = folio_pos(folio); __entry->count = nfs_folio_length(folio); ), @@ -1008,7 +1008,7 @@ DECLARE_EVENT_CLASS(nfs_folio_event_done, __entry->fileid = nfsi->fileid; __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); __entry->version = inode_peek_iversion_raw(inode); - __entry->offset = folio_file_pos(folio); + __entry->offset = folio_pos(folio); __entry->count = nfs_folio_length(folio); __entry->ret = ret; ), diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 5de85d725fb9..fc782d889449 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -281,7 +281,7 @@ static void nfs_grow_file(struct folio *folio, unsigned int offset, end_index = ((i_size - 1) >> folio_shift(folio)) << folio_order(folio); if (i_size > 0 && folio_index(folio) < end_index) goto out; - end = folio_file_pos(folio) + (loff_t)offset + (loff_t)count; + end = folio_pos(folio) + (loff_t)offset + (loff_t)count; if (i_size >= end) goto out; trace_nfs_size_grow(inode, end); @@ -1362,7 +1362,7 @@ int nfs_update_folio(struct file *file, struct folio *folio, nfs_inc_stats(inode, NFSIOS_VFSUPDATEPAGE); dprintk("NFS: nfs_update_folio(%pD2 %d@%lld)\n", file, count, - (long long)(folio_file_pos(folio) + offset)); + (long long)(folio_pos(folio) + offset)); if (!count) goto out; @@ -2073,7 +2073,7 @@ int nfs_wb_folio_cancel(struct inode *inode, struct folio *folio) */ int nfs_wb_folio(struct inode *inode, struct folio *folio) { - loff_t range_start = folio_file_pos(folio); + loff_t range_start = folio_pos(folio); loff_t range_end = range_start + (loff_t)folio_size(folio) - 1; struct writeback_control wbc = { .sync_mode = WB_SYNC_ALL, From patchwork Thu May 2 08:49:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13651435 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 283D6C4345F for ; Thu, 2 May 2024 08:50:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B17DB6B009C; Thu, 2 May 2024 04:50:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A9F906B009D; Thu, 2 May 2024 04:50:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9195C6B009E; Thu, 2 May 2024 04:50:32 -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 6D99C6B009C for ; Thu, 2 May 2024 04:50:32 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 2A2E9160ABB for ; Thu, 2 May 2024 08:50:32 +0000 (UTC) X-FDA: 82072834704.30.41A6170 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf09.hostedemail.com (Postfix) with ESMTP id 38B21140031 for ; Thu, 2 May 2024 08:50:30 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=j9Uxt1pC; spf=pass (imf09.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.179 as permitted sender) smtp.mailfrom=ryncsn@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=1714639830; h=from:from:sender:reply-to: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=6hBewYHOfG4Y6OYspQ+5fYKJoHCclq56Vlvet/Fbb20=; b=otRnElAr8VxuMA/bBcn2hKp6XomaVbF+V9Lykr8n9JeUr5unoY77mOtAs0KxfKsxMCXPJg 4miHZrB3KGl0btXijH7T78+FnR2LD6qUfeTPUaI428GRp4uVse1dU+2LhZ5sZhyO7gKiiQ +sBgfoi9MXYq0y2EIK3dkEoxdhAhNhk= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=j9Uxt1pC; spf=pass (imf09.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.179 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714639830; a=rsa-sha256; cv=none; b=K1vEGzQDdBFqIwO1XmJMoe7aQKgrt3cTtWhmjpf7fcEeuQVR+1/f2fXO8oXu/cG0zbVbZC 0Tc4M3QWM7xyosSsXI/KlVvlA8YiFdQ5+NKANeVWPykSH42Zlm1imPlhJTvgTHNDsLK0Eg 97CsxlPxfrTDF1deByPWhXNwHMX7fSg= Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1eb0e08bfd2so40093265ad.1 for ; Thu, 02 May 2024 01:50:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714639825; x=1715244625; darn=kvack.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=6hBewYHOfG4Y6OYspQ+5fYKJoHCclq56Vlvet/Fbb20=; b=j9Uxt1pCOw+QoLT3CnncIKP5xwchi0YR4R16U3DN+zTQ6pl2tpoj8SPMgemJeVVY/s 5Vd2SAkPT2mYBrvFtHkCaWyDlYHE+Md1pxVYXxdLDKoU/OIx9L2y2gfXAYax02a7/rwB mTQpuFdFqraihzYCWp69z49R2g1ZIpnN3rTBnLex3cNQebXzJftSkhtxhq4SSdR72eJJ KgV6o7rzABTuxeCXvjwI282HhVwVmBxDQoMZPaUVr+nQOz9gNP4Xo7XqCm8tAigRUueY lk4tpf0RpYw7Yv70qjwO1LkU6vyd41uaVG+lzfsDQTthQWieafxkpTf7Qv+ix0LPydLG Ut4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714639825; x=1715244625; h=content-transfer-encoding:mime-version:reply-to: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=6hBewYHOfG4Y6OYspQ+5fYKJoHCclq56Vlvet/Fbb20=; b=QU8SFqhiM0GhNXviZHXtjbT6KdPGvrPyoR/7P2zT4n3+H6VKswvztJfYVvjFmd7YGE uwUyNm5+assvOS80b9w97MwaC/yTGe6BT6rdc4EpEWW6Se1VQyfVYuIlsmlVp8Z8bGHq KDZAQYjWKjRTaKlIra3xyFGYulBaRWuwonmL061C4VG6XVsmg0A+n+e6CRW2I+LyNoPW 4yjk9pCBiFdoeaFW1NKWQRYMFoDjHwe8ecy3J0xrTHvIiSq7iVomoRqBd3tvaVvtVgGC qfMRUxZKVxbaSrMDjMCjHOuzBRyDH6WUZHdqFD0oGjSMXnb36NWlBZswS/+Oh5XquJ2/ dDhA== X-Gm-Message-State: AOJu0YzF4GhNOTLglbtMc7PiY7ETJUmsqTD1wUvAMPABskyPmS+kkihW EwGnX5uUtm8v6iizuDNgqdm+yLia4rJp0uuPXy+Ha1nDB8UqTytQTgpxwWdCWZc= X-Google-Smtp-Source: AGHT+IFwlpgfcGprAqZdcSgM1C0FcJW03lvq1L6XneBaZZ8VDethVtsd8vo2+hwdnNRHKZqs7qydvw== X-Received: by 2002:a17:903:298f:b0:1e6:40f1:93be with SMTP id lm15-20020a170903298f00b001e640f193bemr1586793plb.27.1714639824889; Thu, 02 May 2024 01:50:24 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001e43576a7a1sm737712plh.222.2024.05.02.01.50.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 May 2024 01:50:24 -0700 (PDT) From: Kairui Song To: linux-mm@kvack.org Cc: Andrew Morton , "Huang, Ying" , Matthew Wilcox , Chris Li , Barry Song , Ryan Roberts , Neil Brown , Minchan Kim , Hugh Dickins , David Hildenbrand , Yosry Ahmed , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kairui Song Subject: [PATCH v4 09/12] mm/swap: get the swap device offset directly Date: Thu, 2 May 2024 16:49:36 +0800 Message-ID: <20240502084939.30250-2-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240502084609.28376-1-ryncsn@gmail.com> References: <20240502084609.28376-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 38B21140031 X-Rspamd-Server: rspam06 X-Stat-Signature: 4kiap4xrqft5e19eqeu79gqi14hpfrhc X-HE-Tag: 1714639830-366073 X-HE-Meta: U2FsdGVkX18+hbPeENBQe1Ex8NwrwmADKYQRMZrA00UHBuedbtaum/H8/QcPN55BmnXyfD59mMCFzg+g86ucIJo4nBQQH3bbWKGXjOQ6//SReBr62ZhZi1m0vBCUBEyB+qIUj+8Kkr0xVHu+7y6HG7/VM6ptGqhzuKeTGM+ihH3ctoBxQojn7i+GSyKt6dc09zf58TARVKeIi8IgHNvgpMZu94LsA2dfmhohTd1UE4d6OlnOxMwt/sIzJgsWILzEy661RIH9X2RrL6qZjEJdI6x5Cd/05Sii69xY/AWUXKeggMKPN5J++oaNmWSOC52nebch4iAcdgwl9C5mrdMpxPdfd57GtMbdk51XzQ7KtCJhg/iYQHpWu/xexZ1u4z3gWYchl/dVRoziULQaeWhOSXuyvyI7wEG6DjFRwVm+rD+HhC7TWDvviyXTXmTJjjU8G4hLGy1/4BTv7BD6XazoZVRizubXhgQiiX1tWwWL+EVM6auMMgEW+hQUwQbWTDGle38rYvIfLAbxyzzGqJkjET1fz3rvRg2GfunmNW8SwbdoFVAbxR1U/fuu6FL1vexy599b9LzF2WvVS0XmfPyut26ZGN0eR0AqBDVkBJFZc6K7OL/DdbvO9tLmWBJu/1Ixt99uRM095SGFmXwdGYDNivvWMctR4uQoUteFvARPdiWQW6lMg4U/sz7p/xyzQkJb/EsDXu55AkeVN424/Q+ewrXAg11V0TPEMIl3owCdhvd0tlXOJON4SSkUbTy/DtkasFfqWh6vtUZtnkHwFojhODYv7zdnX4FbpnwIY4WUrx3plz4pQ/TyBhUcfxg0AZTVEV7XCP/LLxjNVwjK8/hvuFcDOV2NNf+mzZG/aCWl7ViIm6VbiekAHOqCrhZ1e7o15INpVX7gHzVvDys88Pip2zHotkbBwB9nA9G9P274eD1UFHdzBtSyHObAtDnwYhd9dSFAWT/DqYzgr2x1HLs CmJVQFIh KheGV5yiam8afuI0AzPGN2ilOuP2LltJ+7YuSvTXYuwfbvKYMBOhF6Q/u2nXESEZ5oPOTDajrz8js5SXY1I1E9Qk/a/6L6OBkfYnN4Bq9g95AaHe4JlUo4fxomm4tCH9qSFf/ZzNMKwMDKb84ObucynfTCfOPRYQ/+dE3GOrNxBXEkAbhtIiKABh+iDOMERC9jEC7+6qzKTu4a5SWHnEZh+YSBPr9W5RTNbw/f1L3vA1QkCVPkyQOSoPy5dPZfXXdOVp8s8hnZA4VRZ71MLp19MgESk2wV/Pa9oNzAqp+Jn78ZfgilYxLRkKiRFdOCOxcyoAc79XXfB6Fmq2rKkAykCnQCtDcvBmZAASQa2n0Mh1s30b+BkXL9Rzj7l5UUcni2eLBplPAaISwmf735raqxOjlcfPG1hjbRmMLeurzajBPAzVjKonJmFoRnXdl9p6SJHBnL37ZLjlNE7z9Tbdp38N79CtVHQUITy0e/ZeQ9DyiL4D30Oi4t2YrUREMo8vDRxw50ak4X8lwmwdhe77ePlsharYWAQVYZ7rmTOv7lonTmESt5VEGC9DXtOLkxF9an6Y8fmhLvIhZ7YyteOBhzF6W1jSmJs3cnvImJLG4zfclORWDml6hA5302NF3n9zEaKIh 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: From: Kairui Song folio_file_pos and page_file_offset are for mixed usage of swap cache and page cache, it can't be page cache here, so introduce a new helper to get the swap offset in swap device directly. Need to include swapops.h in mm/swap.h to ensure swp_offset is always defined before use. Signed-off-by: Kairui Song Reviewed-by: "Huang, Ying" --- mm/page_io.c | 6 +++--- mm/swap.h | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 46c603dddf04..a360857cf75d 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -280,7 +280,7 @@ static void sio_write_complete(struct kiocb *iocb, long ret) * be temporary. */ pr_err_ratelimited("Write error %ld on dio swapfile (%llu)\n", - ret, page_file_offset(page)); + ret, swap_dev_pos(page_swap_entry(page))); for (p = 0; p < sio->pages; p++) { page = sio->bvec[p].bv_page; set_page_dirty(page); @@ -299,7 +299,7 @@ static void swap_writepage_fs(struct folio *folio, struct writeback_control *wbc struct swap_iocb *sio = NULL; struct swap_info_struct *sis = swp_swap_info(folio->swap); struct file *swap_file = sis->swap_file; - loff_t pos = folio_file_pos(folio); + loff_t pos = swap_dev_pos(folio->swap); count_swpout_vm_event(folio); folio_start_writeback(folio); @@ -430,7 +430,7 @@ static void swap_read_folio_fs(struct folio *folio, struct swap_iocb **plug) { struct swap_info_struct *sis = swp_swap_info(folio->swap); struct swap_iocb *sio = NULL; - loff_t pos = folio_file_pos(folio); + loff_t pos = swap_dev_pos(folio->swap); if (plug) sio = *plug; diff --git a/mm/swap.h b/mm/swap.h index fc2f6ade7f80..82023ab93205 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -5,6 +5,7 @@ struct mempolicy; #ifdef CONFIG_SWAP +#include /* for swp_offset */ #include /* for bio_end_io_t */ /* linux/mm/page_io.c */ @@ -31,6 +32,14 @@ extern struct address_space *swapper_spaces[]; (&swapper_spaces[swp_type(entry)][swp_offset(entry) \ >> SWAP_ADDRESS_SPACE_SHIFT]) +/* + * Return the swap device position of the swap entry. + */ +static inline loff_t swap_dev_pos(swp_entry_t entry) +{ + return ((loff_t)swp_offset(entry)) << PAGE_SHIFT; +} + void show_swap_cache_info(void); bool add_to_swap(struct folio *folio); void *get_shadow_from_swap_cache(swp_entry_t entry); From patchwork Thu May 2 08:49:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13651436 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 43585C25B10 for ; Thu, 2 May 2024 08:50:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CC4C96B009D; Thu, 2 May 2024 04:50:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C74BB6B009E; Thu, 2 May 2024 04:50:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AC7D66B009F; Thu, 2 May 2024 04:50:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 8E1D36B009D for ; Thu, 2 May 2024 04:50:33 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4531680A30 for ; Thu, 2 May 2024 08:50:33 +0000 (UTC) X-FDA: 82072834746.23.2AD6CF5 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by imf22.hostedemail.com (Postfix) with ESMTP id 8C222C000C for ; Thu, 2 May 2024 08:50:31 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=WBgiw+at; spf=pass (imf22.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=ryncsn@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=1714639831; h=from:from:sender:reply-to: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=hRYCaxyc5VxJ2RJEf4Sa/SOe2k8+YTvkzKGpn4vzx7s=; b=ZEv4qb59EdUa3U5KA5NsaOXtKQPKbdvhuPgAjGu/6baxy8tqEaHfUR8MfAeN8WXMy2uqh6 yYyx8uj3vUg1nLsB8caujD3OncZtKIhsmf0ck5oPysPpDu+hvpc0ug0+TgMMpYgZtU0WEx 4BNJuIwP77bhHmnlAs/ko5XCRfRLRC4= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=WBgiw+at; spf=pass (imf22.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714639831; a=rsa-sha256; cv=none; b=oqPhb7NS9YT4jD5vcuLXdEk9vLkSn/6PXezWniyuZ2rSAIjf8lStRyWqDodwOCp5IZ47/K QGt0w1wMutPnu9m0Im9xqri5c5GHxccS3poTKPJM52Nd29nmeAr0EW0Fz0VNc0WEveRsnS rFMCUgT75STy8fnWwnWIRi1Nat6E6kM= Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1e651a9f3ffso39782805ad.1 for ; Thu, 02 May 2024 01:50:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714639830; x=1715244630; darn=kvack.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=hRYCaxyc5VxJ2RJEf4Sa/SOe2k8+YTvkzKGpn4vzx7s=; b=WBgiw+at0cnrgOA3nOVRRX9wJvaAaimXgKQ9mR2UyfHyoFOPJPaQfGOCcbNVdgdot/ /f+9mSnEB6tNlwlY0AG98ta0LNN7J41V3sMoPi99jld8Wrtj81QAYtHGDTVsBQEjSRNE x6zQbfdLvGrRkax7r/vu5khjzUJRCP/Zl8lChiZ+RcW4xoDFwiRI07ibsq+McQBBNHPC XPgzSDcuzLIsKBAXjzs0lFSj+rjfTuh6pURfmMqZ0suNne0WB89HlXXq2SIRVvQmFbpY 2uACsTk/i3OG7BFDD0JzK2PqqexFo1u7hws/Cp8nXD1gxmnEzJbLAH3egRAH+Nf18uDb XxXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714639830; x=1715244630; h=content-transfer-encoding:mime-version:reply-to: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=hRYCaxyc5VxJ2RJEf4Sa/SOe2k8+YTvkzKGpn4vzx7s=; b=n/5nFcEks5SmITT5aU9zdUZArUPBpLYK9IGbguKXlNLE7xHZ1HUgv5KCsUF/c+xPdP dnbU56XgMsb+puWEClplPMNjRClIdBTU9lNSG4Yu4RBnB01g2u8WENgeUNZvgsKSMb5s CGiGT+zTcTUsL1/qc39s5drIUSwK40zN13HL8ICD6X8zBAkLGLnXcxBlTF54vBqNXbp5 5y3RMCTrMYN26N7Vf0NhUbXwAh+zdpLAHQH3i4LwS6TYnWbQvx4K/Mx7S2Y2z2yH4DhE 3XDTR3TYflFesgjVcE+n6UZVR0oFz1BLq7K6aiyaxqMU/J39jeakLU1laEjdJshnf2GX JOFw== X-Gm-Message-State: AOJu0YzXjgfjCQzZFdSKEvUBkb0EuzBkt1BbK1tBllEcPWHzePcJZ4Sj pFdHNroUTYs+ps9eOTwykjRRQ0fqZ24FYlhbA3ey0PV+GCUOQLsk0Kw5qKD8P6c= X-Google-Smtp-Source: AGHT+IHufI+b2KEWe7q4ZEgCWkfvkErjirIAQy1x6ZDt9+l/U2kkILUWyLVdHUQcPqggeeFX9lCXKQ== X-Received: by 2002:a17:902:c3d5:b0:1dc:a605:5435 with SMTP id j21-20020a170902c3d500b001dca6055435mr4637953plj.31.1714639830052; Thu, 02 May 2024 01:50:30 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001e43576a7a1sm737712plh.222.2024.05.02.01.50.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 May 2024 01:50:28 -0700 (PDT) From: Kairui Song To: linux-mm@kvack.org Cc: Andrew Morton , "Huang, Ying" , Matthew Wilcox , Chris Li , Barry Song , Ryan Roberts , Neil Brown , Minchan Kim , Hugh Dickins , David Hildenbrand , Yosry Ahmed , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kairui Song Subject: [PATCH v4 10/12] mm: remove page_file_offset and folio_file_pos Date: Thu, 2 May 2024 16:49:37 +0800 Message-ID: <20240502084939.30250-3-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240502084609.28376-1-ryncsn@gmail.com> References: <20240502084609.28376-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Stat-Signature: 8m565jm9yyyg311f1a85t73q1rhqqs16 X-Rspamd-Queue-Id: 8C222C000C X-Rspamd-Server: rspam10 X-Rspam-User: X-HE-Tag: 1714639831-534526 X-HE-Meta: U2FsdGVkX1+i+v8n/l/OtU0zSiSUOGjNkst7a7sGSBbHomjtO+m0mCQ4/YBb8Wfma3M7KeHW7Y4iI3b5UjS/RmzbF6mQDC/P6j8l/jLk2S/3R763IS3oIYSXiGWPa1gMtH/GRyoQ6f71Ppn+XEtmeQycjWzsVFYkT2mERz/HINmpcp4Cb1am+hV8tXGhfeiNb6ABXGxJYL25EuadYzesk/Q5JtdbxsqHR3al2bA24gVL/jPw+yBHZP2IG17kEA9EvNVrAF8DrNoWQG6hQd+7ih+N3gW1h6Q/CmGvnOd+RYsSHm4mWtL1UP7X46OXxxVsVWOf5mWfPloZPE38+SzyF5Q80KzTxT6ZhouiCpwpC9OtzGQW3iVxd2fSY42hV3evaJ0rm/F6hMnG6XGDC5ocjW1hWIofFhrPh1CLNRLCksZTNKIkK0ucJ2tLrsP9g1P9Dh6YHJW6+UPX6WjfUVa2nV0AmFj1aSPRb+zYgqdVDb1IvetDgz7lFoOuplrFAGpicWwptnNfHFqpolimMNvDZppgDZk2TEL+U5CR7Yxs1BiDv/ubqWVUHllInyxlv58iVLMVFLGv5NoMlhTRCWh/YLTHbu6ikMdY2ML5T5/TnbCaOpPx4R7aC3xvZcVJDEVXxg0RMZ9jwxqw1h1C5JY56Cl+RIB20We4Y0NceDBtoxZOhCxXzmw9xPzK4Fzl3lYTPaBr4B8n4jDwRBkPpN3ZGWacbsWbgJaRFlUHuGCCFGMtpzJRICVnS+Yb9BNgO6+8yZKr1SpgUbi+/ApyyDhrqEHLZT9M/odMbiasUVRkX4JIQpBtoh3xEgoVXm/v3mUqBo28tTIDTMSCbOX/LXiSD6hbLoM/Sh/oy9BLVqWWHLsxJRSiPRAJviTOtbUq6btKYTk+4UFXT0atV7YeWyXTxVhJGY2xKEJZIDejaGtCoHTZTx+WpoTLa3ZBxtI4EJ04L3tsZNlZXGqc26YjVFc dRLTMKlo byg2xTfZxEmz62B3F8wr8989u4MmtzDMQ2mzgYs+DSxOVkdl9nH2/1oUEwkW2fUJii42KNzY73vnhhR3ChaK5grQeKVqrzamHubdI4/u2iZkS0I0SlcEjfdlo83Jw+VYfQBi86gzrVf8tgsdg3pW2jGl9jzcMPnHrUltrFz6pWXXCIH+WISNbD6cpT2OMBPsHIYwTFUZ0kPbL53Si3qd84GWrwZ3AjAueWTirj2Cs8Y01L1r6KiBkKH5h3RuEFA4xdn3iMJCf96w/nCcttuYH1XHbREzhpc7MQXCMm7P4sWQzgvyEprCcOZk7+g== 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: From: Kairui Song These two helpers were useful for mixed usage of swap cache and page cache, which help retrieve the corresponding file or swap device offset of a page or folio. They were introduced in commit f981c5950fa8 ("mm: methods for teaching filesystems about PG_swapcache pages") and used in commit d56b4ddf7781 ("nfs: teach the NFS client how to treat PG_swapcache pages"), suppose to be used with direct_IO for swap over fs. But after commit e1209d3a7a67 ("mm: introduce ->swap_rw and use it for reads from SWP_FS_OPS swap-space"), swap with direct_IO is no more, and swap cache mapping is never exposed to fs. Now we have dropped all users of page_file_offset and folio_file_pos, so they can be deleted. Signed-off-by: Kairui Song Reviewed-by: "Huang, Ying" --- include/linux/pagemap.h | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 850d32057939..a324582ea702 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -918,11 +918,6 @@ static inline loff_t page_offset(struct page *page) return ((loff_t)page->index) << PAGE_SHIFT; } -static inline loff_t page_file_offset(struct page *page) -{ - return ((loff_t)page_index(page)) << PAGE_SHIFT; -} - /** * folio_pos - Returns the byte position of this folio in its file. * @folio: The folio. @@ -932,18 +927,6 @@ static inline loff_t folio_pos(struct folio *folio) return page_offset(&folio->page); } -/** - * folio_file_pos - Returns the byte position of this folio in its file. - * @folio: The folio. - * - * This differs from folio_pos() for folios which belong to a swap file. - * NFS is the only filesystem today which needs to use folio_file_pos(). - */ -static inline loff_t folio_file_pos(struct folio *folio) -{ - return page_file_offset(&folio->page); -} - /* * Get the offset in PAGE_SIZE (even for hugetlb folios). */ From patchwork Thu May 2 08:49:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13651437 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 266C1C4345F for ; Thu, 2 May 2024 08:50:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AA1996B009F; Thu, 2 May 2024 04:50:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A2A826B00A0; Thu, 2 May 2024 04:50:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 87F016B00A1; Thu, 2 May 2024 04:50:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 611E36B009F for ; Thu, 2 May 2024 04:50:38 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 115EE1602EC for ; Thu, 2 May 2024 08:50:38 +0000 (UTC) X-FDA: 82072834956.05.A704A9E Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by imf22.hostedemail.com (Postfix) with ESMTP id 61749C000B for ; Thu, 2 May 2024 08:50:36 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=g6bDI16S; spf=pass (imf22.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.171 as permitted sender) smtp.mailfrom=ryncsn@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=1714639836; h=from:from:sender:reply-to: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=Yc7f0BGrdGPhDGlU0I7BQHsZ8DqIMKXeboNv+kAHs2g=; b=7yBuGFOcl3hT3k1ZGLAcCocV5ton+HcI/5Y2v7c///QajxwnQPa0cCMj/26yzamkAzLtqe lFdCLnNxoSLGmj7rK8m460vxELHVFV2bDl2UVFzMWKMAwJDvf9jNYjihMnzY0WQF8qrEJ1 Zs5kv+yIyaWzYnCd4A7D2003ODhck6w= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=g6bDI16S; spf=pass (imf22.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.171 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714639836; a=rsa-sha256; cv=none; b=qUs8CTo9eOcDVzDO4uwZTAFJz1HiJ/DGo7Fo7OAFFhcrTq09+ivJHC89YqzkX0p02Puywa xJVocDzRChCg9pgLP9dX6J7q9nX9f9f8yJf17MfllRzv+rhZF2tfqpYF2tDErbM8LEgemT 9vZuru1HqIUMiep+DdBO2kqt29HCDh4= Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1e8bbcbc2b7so69621475ad.0 for ; Thu, 02 May 2024 01:50:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714639835; x=1715244635; darn=kvack.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=Yc7f0BGrdGPhDGlU0I7BQHsZ8DqIMKXeboNv+kAHs2g=; b=g6bDI16SGtIyuRUT9stKfGNQpD9O08ozzn0si3lNoYbtZSiqpR+QFjnM3Kn+GVUo0Q frldJAIOjm4VC6h+k/lYdt2rVUoVU63dpCHfMdUjmphb7Kk8vi56zxiSRn5I5DEAD4Jr dYGc+fgAucv1UUEYq/hv7Ch0ZtXFfHTFRzga0natcHSPvcKAOL+wLlpdbAbYxUFzRr5i ZLbDXU693WIojm2e5gBCFtqre6D3cVRPJdR/B3KQpMdkN4eusxYLIxMyXyfNjrKqpLLz 8FwZsnJwEe3NyMfCGhtCL2XLCTDjiI/sBGQhEf7eS2iZQTuzVOeilnR7daoyctG4KOnU 13Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714639835; x=1715244635; h=content-transfer-encoding:mime-version:reply-to: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=Yc7f0BGrdGPhDGlU0I7BQHsZ8DqIMKXeboNv+kAHs2g=; b=AdP+HCBlOFPPYq2o1EP8SVIQkNbclt+AV9+DZ4SM6f02JGVe8Ti6ayJrpuK3unRK/1 oBOjhnvLhOqGeg9AJGIgCSxfN2DRDapfzuuV3BOwxlVyXSXAcjcO45n0c7SC9UMlo7uo hOy11bVO0AoutARj+zXasx6BkYSxBcjTnsCr5UiuMWgnf5to+c0MdTAcCKeG06hRGQIj 5dTskJULhUvicve1H6CSF5HFdOPVeZhR+vRcwOQQu3sNAPQ3KJMxPLsXAbBzFcIQvDk7 fr8BU5v0gc8v5dYkCa7Fw/7S4Wf+MC3o+AxfIvnznte57UPNqQk+2SS4rjdgZkZl0Xp9 O1RA== X-Gm-Message-State: AOJu0YyMaU2qM/uQh0HIMkL+lL96k0esRrekw9gMbr3j3sqMpCYb/MRy GQp30p1Ia94vxjNjKe5f2lxdtLmZ+EtbeEkorMbQ/0/MmVpwr0oOvs7UGt8wStY= X-Google-Smtp-Source: AGHT+IF8JauY0lS+CclTlem6YP0P2WISNCLiZMNb+dGq5Yq+NqFjwzPOoTCiT1f3BMH1TlaypNnwnA== X-Received: by 2002:a17:90a:fd81:b0:2b2:b1c7:74cc with SMTP id cx1-20020a17090afd8100b002b2b1c774ccmr1628463pjb.26.1714639834668; Thu, 02 May 2024 01:50:34 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001e43576a7a1sm737712plh.222.2024.05.02.01.50.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 May 2024 01:50:33 -0700 (PDT) From: Kairui Song To: linux-mm@kvack.org Cc: Andrew Morton , "Huang, Ying" , Matthew Wilcox , Chris Li , Barry Song , Ryan Roberts , Neil Brown , Minchan Kim , Hugh Dickins , David Hildenbrand , Yosry Ahmed , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kairui Song Subject: [PATCH v4 11/12] mm: drop page_index and convert folio_index to use folio Date: Thu, 2 May 2024 16:49:38 +0800 Message-ID: <20240502084939.30250-4-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240502084609.28376-1-ryncsn@gmail.com> References: <20240502084609.28376-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Stat-Signature: byrr5nghmypka51ennzi4u4jxqtjnixu X-Rspamd-Queue-Id: 61749C000B X-Rspamd-Server: rspam10 X-Rspam-User: X-HE-Tag: 1714639836-663208 X-HE-Meta: U2FsdGVkX19zFSelHyr9ytrHfsSZkHmXozbU2xCrYtyx5jqPLZY1Q7VmXP4eJJn8k/gEiz1wp6ZLBj46dbisV1Of0HjCHxwA+efdJ0P8MG91zj4a1gcMwkPRzJFnfUg23XvZCuOqXVicjkM0fwy1HbnC9m2uBNICBtbClCRTLcTjMscLyG852ESeG0hmpjeMPujgaA8axZCkUZ3UDW+3Z5oM1/i4/trFhV/pgk1DntPc1pToNvx4MyVHJwa70l+lS9mSw/ukiqcJVSagdsnn9WSnzxsSW7oMvv5nfkDi0t3pljbUtu6OEwLrZ625Q28wO982bA71f4QLDoHCDaSjG5to0v0QndmhzkFWhtLR9+a/Vn2kiMfgOIFuQ8DRtLOQG3T9t8qhK1Qu9zpDRN6ji/BSaEWK36ee4N9aKYL2b8+ekeJyE0IDzDObNq0qnh1HVBnn3Gk4PJ6Opafpf7Par7P+A2OmyYa6xjo00Fjo2y97xvXRyfcdOpJsMxkfaRAMDFkjctodV01NgbIUd0AlowU2PBy5+8Lqh7Ss+3W9MdDqoOLE6kwJypOCes1oNO0ZjC7z3qPklnj8PMF71nw82O7gCR7ykoqeFZ51YRlDQgL3tG4dAdI/SnPQmvqEj3gnWmKYuB0JYBWt9+8ySHnY3PhV2LKgxjUuf/J51DFyIBnrX0qTlQvTxr07Zk7P3OGIa2Z1xy1JCKZ9NRgxKE8WZuSUY0iDoT6J9q6UwwBX0cS7KWjpA1O4M7XoYi5/ZhUuzjCmhNV8AaXQhxirZADaZubCJxb7ApbBZkhynQ4XUDQ70rftQtcamUpeSLgN6LDrnjsD3OuyUrYgEv/CcoSGH1+Ae1yRqn7gYerMtlc0yFi4HvTECa1fl4C9IQcm/KRDXUZVVOlUSKx2bTs0vG38GZKAhHj1U61uzOsJb7v3IS7Om+D/2eQh1j7lpN1RwGChFOoPq6CA+AYzdSBqm/G 3zMM0JH4 mbST9W6CU1HwzHg9zQNnk8senSzUx3CKBhQeudJG68rD6l9gdrfopj+D0rIKDoKr7OVX24n202kkp9quf88LPQEMxYgDhuUD61aWnMNsv/wmFthU05N/uqWnk/EnVeOC3E+sPRhSto//A2zy4TbakUPMh1TQgx9xgzXj3y/KEhdX80/x2zcosYLqaMxrsguGVbX3y0NcmrXlpzob134drSunazDRx7ZKd5WX2HqOqjkdtCWfqR9C2dFxYAlkyQzRgkn9FQlChq0esherSpgBcPV69K6k7U9G0JFiFN71kN9atZ2XM5jbAwzIOAQ== 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: From: Kairui Song There are two helpers for retrieving the index within address space for mixed usage of swap cache and page cache: - page_index - folio_index (wrapper of page_index) This commit drops page_index, as we have eliminated all users, and converts folio_index to use folio internally. Signed-off-by: Kairui Song --- include/linux/mm.h | 13 ------------- include/linux/pagemap.h | 8 ++++---- mm/swapfile.c | 7 +++---- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 9849dfda44d4..e2718cac0fda 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2290,19 +2290,6 @@ static inline void *folio_address(const struct folio *folio) return page_address(&folio->page); } -extern pgoff_t __page_file_index(struct page *page); - -/* - * Return the pagecache index of the passed page. Regular pagecache pages - * use ->index whereas swapcache pages use swp_offset(->private) - */ -static inline pgoff_t page_index(struct page *page) -{ - if (unlikely(PageSwapCache(page))) - return __page_file_index(page); - return page->index; -} - /* * Return true only if the page has been allocated with * ALLOC_NO_WATERMARKS and the low watermark was not diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index a324582ea702..0cfa5810cde3 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -778,7 +778,7 @@ static inline struct page *grab_cache_page_nowait(struct address_space *mapping, mapping_gfp_mask(mapping)); } -#define swapcache_index(folio) __page_file_index(&(folio)->page) +extern pgoff_t __folio_swap_cache_index(struct folio *folio); /** * folio_index - File index of a folio. @@ -793,9 +793,9 @@ static inline struct page *grab_cache_page_nowait(struct address_space *mapping, */ static inline pgoff_t folio_index(struct folio *folio) { - if (unlikely(folio_test_swapcache(folio))) - return swapcache_index(folio); - return folio->index; + if (unlikely(folio_test_swapcache(folio))) + return __folio_swap_cache_index(folio); + return folio->index; } /** diff --git a/mm/swapfile.c b/mm/swapfile.c index f6ca215fb92f..0b0ae6e8c764 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3474,12 +3474,11 @@ struct address_space *swapcache_mapping(struct folio *folio) } EXPORT_SYMBOL_GPL(swapcache_mapping); -pgoff_t __page_file_index(struct page *page) +pgoff_t __folio_swap_cache_index(struct folio *folio) { - swp_entry_t swap = page_swap_entry(page); - return swp_offset(swap); + return swp_offset(folio->swap); } -EXPORT_SYMBOL_GPL(__page_file_index); +EXPORT_SYMBOL_GPL(__folio_swap_cache_index); /* * add_swap_count_continuation - called when a swap count is duplicated From patchwork Thu May 2 08:49:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13651438 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 13715C4345F for ; Thu, 2 May 2024 08:50:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9DE1F6B00A2; Thu, 2 May 2024 04:50:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9672F6B00A3; Thu, 2 May 2024 04:50:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7B9846B00A4; Thu, 2 May 2024 04:50:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 5B8026B00A2 for ; Thu, 2 May 2024 04:50:49 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 2280F1C0C14 for ; Thu, 2 May 2024 08:50:44 +0000 (UTC) X-FDA: 82072835208.12.E535637 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by imf07.hostedemail.com (Postfix) with ESMTP id 47D2340020 for ; Thu, 2 May 2024 08:50:42 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KN0h02OV; spf=pass (imf07.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.178 as permitted sender) smtp.mailfrom=ryncsn@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=1714639842; h=from:from:sender:reply-to: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=3PiDuUAmL04AUzqx0Yl3XvlHAjrbgNtWVpZDxU2pdrk=; b=krqMYp3BfjG/E0X1/SKCDZ0iDx79MeLkwIxIxpMz9YVnJDTckAS8ew5Nwc1TRSHeaehfee Zdx4cExN+bpcwFidGvfC5w8ho11v/wvMpRlUuHPeIB9KfYrUM1NP4tEMHwhykHH8cpMvtb EwEhKYBhTXS2f6oeERRCtak9X6+ztXk= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KN0h02OV; spf=pass (imf07.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.178 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714639842; a=rsa-sha256; cv=none; b=unoEj9aYf7TNpyGMpKXVMDBmUGm+cdH+NnZpnjvZ7hVMXQaVEQHTT9oxCrmLVeGaPT/Bfl u52Gp5njhlKXE0rn6iTQUZzrqvE8njfrB0lIyM8hgL1aaJ0tDM1Ftangfu6zSz+KDiATUo DigD5VHtkZEcLqAmzQgNSZ/PAC0lGYU= Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1ec486198b6so22128715ad.1 for ; Thu, 02 May 2024 01:50:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714639840; x=1715244640; darn=kvack.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=3PiDuUAmL04AUzqx0Yl3XvlHAjrbgNtWVpZDxU2pdrk=; b=KN0h02OVKUkV6tl58KwmKsVkBeVlCefrxbtVDml2QWqKJkPC6GbQqHzc0cYj0TgYWa 9fjnsXvzcMr57M9ET5yru+aciIQJyWimbkmVxStN00PX2FeYeq163b5HAn2qeffCCGJh 8U5OmLcJSv2cdsQdKJY/5VDLrYmn0j966nc32R9qg5x35cXjjp0jIBoMPW1SIV3eHZn4 DFXhrP8OT6IxdV7bJV8KuAn4bI9ZL/rNYdlEyhMJ01XhnfD/lk+Y1ky4ase/IdFKspWg RNuWnVWhuT3o7uyUU3a89SRE4jVTtQKd9lGrohT97iwJKiZ58eMzo0JVn+C0L9gf/28q n3kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714639840; x=1715244640; h=content-transfer-encoding:mime-version:reply-to: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=3PiDuUAmL04AUzqx0Yl3XvlHAjrbgNtWVpZDxU2pdrk=; b=kAJsdBDGZgkcTRarBK9i+AjSTVPoKvU4xgH/LBU3mYr1bJOju3z0aKRGsc6S/EOZuN Z8RF9oKwS0RAJlVctMDEcEqBtS+8W48j7em7UK055EgCP5V489xZ0BhRluLrZc1vP1yD +5jHe7LmHHi37OD9o0v3cCQSWfZW9t7qMtGkhYKOOFfgcdTUWJ0ZK8M7ZUrf3FfQvluY ViuArFKmQwyBOKKepeuLWi645vpiH7LzAlZkI/jWdlSakcm6mVFns147XogZRvTFYl9b 6a1bRFsSIKylBh5kLihAUz8GWxKXdHttt56YC5b8dqGt7y3QMuTwA1SoyeT6497TrGXm TRjQ== X-Gm-Message-State: AOJu0YxKEFChFaT+X6tdAQdlYZRIl1MOScS2o02Xe42yqJKEeo2Bm6vD ZsO5fhnF/wtHT3WmJFn2+K9JC8QdCEUdR19+J6cLKbqXBr+hvni1xZpl36UaA2Q= X-Google-Smtp-Source: AGHT+IFQrOIhO4DW3kC/6U9SsFXYwY7es2c4HumW8eBEkpYQadnethvvJ5+C7OMiTTPsFpu/GER8Pg== X-Received: by 2002:a17:903:246:b0:1e7:8d21:7fd7 with SMTP id j6-20020a170903024600b001e78d217fd7mr6287081plh.28.1714639840392; Thu, 02 May 2024 01:50:40 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id j12-20020a170903024c00b001e43576a7a1sm737712plh.222.2024.05.02.01.50.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 May 2024 01:50:38 -0700 (PDT) From: Kairui Song To: linux-mm@kvack.org Cc: Andrew Morton , "Huang, Ying" , Matthew Wilcox , Chris Li , Barry Song , Ryan Roberts , Neil Brown , Minchan Kim , Hugh Dickins , David Hildenbrand , Yosry Ahmed , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kairui Song Subject: [PATCH v4 12/12] mm/swap: reduce swap cache search space Date: Thu, 2 May 2024 16:49:39 +0800 Message-ID: <20240502084939.30250-5-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240502084609.28376-1-ryncsn@gmail.com> References: <20240502084609.28376-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Queue-Id: 47D2340020 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: nqsewzbncr1no8keskbzqzfeqdexr37z X-HE-Tag: 1714639842-416211 X-HE-Meta: U2FsdGVkX1++gajPFJ3TYJ/OXV7wdzPsyXq/dShObCZmDvwLatAK/hg4jyeEZf/y5670Ba4aPl72i+SAO0vSflLSOcoYMOxWcIloGm3UCci/CssOizV458QIOWoiUV94OPv5B9p909hVscqJrBUuFwX7oiCFoBbYyRJ8XQZHqms/8UoFhGokEx1/U3MZmFH1mK2p81HRlEcOVwGp9efWu9+iKkY833d9bsL1gJFSn/RDDs/XdSspt67e8ztky4ie+SZKP9smVaZfkaTJ/Lbkd2CVqqH17vG+xPhS3aZ9aZHjXpNoKKBwq3MTdRhOf+vgi/2rNVBHCcQS4KffgGNFE70m9Jctxa4zNbKyByDYHf+YljFx1rbgUAzigfZr03qGwI9TK+MLYr4WsnsUDMGR/WU01BB9AwzuQ9JJWYly/AZ/CofcgufAzfQKjZLCpLcTndJ5yKezCIl0Q8XoxgZcwmUtqBgYqgvyRuj5MTlV8JrpMBj/k1WNzclWOp52IC4svrNbAsXPycDsw8CaUirJlix2IUrMF37Djq4NZWpJ0G+54KiiudgQbZRwJPfTOyk8lDIGlC3NfuqGuSOIzip5dE5wHeUHaLQNw2Q674BN+WAtNABQQaGYV4YM/dXXQF8WJjmnEZwk9TFx0LbeOfhGnYpYRWktEqk7YzHr9165KYsx4Ywvk3LIaCI8qBsxb/qEvvhgIBkMjAs1cR7pwz1hU7MhlZmkum7ED/8gIEqDkUc0XAMO40+aZZjosrUS3nIRsJhSDhPbTW3zkQkNxrpoxiNy+G7007UQkP6eS7MPkxBQ481FfwK7ck4dN86hLH4OqLAB3k1DmeWXE9W53mComB24fCKGvVvlXsJ8I82foZXw9F+nZS4LwEzKdTrCAqghEaSnEGPSZz/yIldd1XdEQLLZGJkC1Zv0DkHR9H/lVIGMhtKQqxjFHPvuQounxIi+66vP9Ph76vnpRI02Xx5 VTPX5G9c LRcS6gfOLtcxYRhKNhMpVPvSRBeLClVTF6YJHGefB6H5s3wtKOvHzWtzeOFzof6YtawZ0VlAe+vlE8RkOtlItJou+IObJ4Jy1zLCk47WtkNCo0F9DlyO4qPW9z4FT28tEc55zEpWk33LFJnm58CYsWg+m72Tt3Vpd+YM8Fc3sthKZ4H6ekwYXqRjVyMDq7QyD7Bj/7xMSeOmATKVRtfPaoDI68M+BJ1f6Az8l9XWpurBqGR5ZvxKIrViQH5MMQ/sChcZevoOU+Jkn8E6M+oHG6a5Z96aQxXPbWC4g3oqP97ZvkQBirQHP+mLrFutUmGze6Apz+Tbf4hQBVDWqfm1NlhPRMhtvxMdgraE16yF/bCrFMTqbBOseC2UyZBqt6FUJHzNys0gm4gdMe9BqalfduvB10WC+o2Ii/mBNecEAJdC8vV3DdYFNn+w3oGQRtNNXp3eD/Q9yn+wR1FoB65UW8hVkR8a1xm0rQd8YwJOCh8/i1bYxwBXQowMeIznV6J5+hjN2u4fRa38//1IWCHJFCieUSlQ1MXgGWK4hlwaKC4OXBoo6ZnhACNCF4F7DdxdyWfDNGtFeF31pYUxZDqHplEQ6SqnxZM1DALEnlg2+VAOQ0mBT7qM1cqWdko94RtSbVK3J 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: From: Kairui Song Currently we use one swap_address_space for every 64M chunk to reduce lock contention, this is like having a set of smaller swap files inside one swap device. But when doing swap cache look up or insert, we are still using the offset of the whole large swap device. This is OK for correctness, as the offset (key) is unique. But Xarray is specially optimized for small indexes, it creates the radix tree levels lazily to be just enough to fit the largest key stored in one Xarray. So we are wasting tree nodes unnecessarily. For 64M chunk it should only take at most 3 levels to contain everything. But if we are using the offset from the whole swap device, the offset (key) value will be way beyond 64M, and so will the tree level. Optimize this by using a new helper swap_cache_index to get a swap entry's unique offset in its own 64M swap_address_space. I see a ~1% performance gain in benchmark and actual workload with high memory pressure. Test with `time memhog 128G` inside a 8G memcg using 128G swap (ramdisk with SWP_SYNCHRONOUS_IO dropped, tested 3 times, results are stable. The test result is similar but the improvement is smaller if SWP_SYNCHRONOUS_IO is enabled, as swap out path can never skip swap cache): Before: 6.07user 250.74system 4:17.26elapsed 99%CPU (0avgtext+0avgdata 8373376maxresident)k 0inputs+0outputs (55major+33555018minor)pagefaults 0swaps After (1.8% faster): 6.08user 246.09system 4:12.58elapsed 99%CPU (0avgtext+0avgdata 8373248maxresident)k 0inputs+0outputs (54major+33555027minor)pagefaults 0swaps Similar result with MySQL and sysbench using swap: Before: 94055.61 qps After (0.8% faster): 94834.91 qps Radix tree slab usage is also very slightly lower. Signed-off-by: Kairui Song --- mm/huge_memory.c | 2 +- mm/memcontrol.c | 2 +- mm/mincore.c | 2 +- mm/shmem.c | 2 +- mm/swap.h | 15 +++++++++++++++ mm/swap_state.c | 19 ++++++++++--------- mm/swapfile.c | 6 +++--- 7 files changed, 32 insertions(+), 16 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index d35d526ed48f..45829cc049d2 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2918,7 +2918,7 @@ static void __split_huge_page(struct page *page, struct list_head *list, split_page_memcg(head, order, new_order); if (folio_test_anon(folio) && folio_test_swapcache(folio)) { - offset = swp_offset(folio->swap); + offset = swap_cache_index(folio->swap); swap_cache = swap_address_space(folio->swap); xa_lock(&swap_cache->i_pages); } diff --git a/mm/memcontrol.c b/mm/memcontrol.c index d11536ef59ef..81b005c459cb 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -6165,7 +6165,7 @@ static struct page *mc_handle_swap_pte(struct vm_area_struct *vma, * Because swap_cache_get_folio() updates some statistics counter, * we call find_get_page() with swapper_space directly. */ - page = find_get_page(swap_address_space(ent), swp_offset(ent)); + page = find_get_page(swap_address_space(ent), swap_cache_index(ent)); entry->val = ent.val; return page; diff --git a/mm/mincore.c b/mm/mincore.c index dad3622cc963..e31cf1bde614 100644 --- a/mm/mincore.c +++ b/mm/mincore.c @@ -139,7 +139,7 @@ static int mincore_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, } else { #ifdef CONFIG_SWAP *vec = mincore_page(swap_address_space(entry), - swp_offset(entry)); + swap_cache_index(entry)); #else WARN_ON(1); *vec = 1; diff --git a/mm/shmem.c b/mm/shmem.c index fa2a0ed97507..326315c12feb 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1756,7 +1756,7 @@ static int shmem_replace_folio(struct folio **foliop, gfp_t gfp, old = *foliop; entry = old->swap; - swap_index = swp_offset(entry); + swap_index = swap_cache_index(entry); swap_mapping = swap_address_space(entry); /* diff --git a/mm/swap.h b/mm/swap.h index 82023ab93205..93e3e1b58a7f 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -27,6 +27,7 @@ void __swap_writepage(struct folio *folio, struct writeback_control *wbc); /* One swap address space for each 64M swap space */ #define SWAP_ADDRESS_SPACE_SHIFT 14 #define SWAP_ADDRESS_SPACE_PAGES (1 << SWAP_ADDRESS_SPACE_SHIFT) +#define SWAP_ADDRESS_SPACE_MASK (BIT(SWAP_ADDRESS_SPACE_SHIFT) - 1) extern struct address_space *swapper_spaces[]; #define swap_address_space(entry) \ (&swapper_spaces[swp_type(entry)][swp_offset(entry) \ @@ -40,6 +41,15 @@ static inline loff_t swap_dev_pos(swp_entry_t entry) return ((loff_t)swp_offset(entry)) << PAGE_SHIFT; } +/* + * Return the swap cache index of the swap entry. + */ +static inline pgoff_t swap_cache_index(swp_entry_t entry) +{ + BUILD_BUG_ON((SWP_OFFSET_MASK | SWAP_ADDRESS_SPACE_MASK) != SWP_OFFSET_MASK); + return swp_offset(entry) & SWAP_ADDRESS_SPACE_MASK; +} + void show_swap_cache_info(void); bool add_to_swap(struct folio *folio); void *get_shadow_from_swap_cache(swp_entry_t entry); @@ -86,6 +96,11 @@ static inline struct address_space *swap_address_space(swp_entry_t entry) return NULL; } +static inline pgoff_t swap_cache_index(swp_entry_t entry) +{ + return 0; +} + static inline void show_swap_cache_info(void) { } diff --git a/mm/swap_state.c b/mm/swap_state.c index 642c30d8376c..09415d4c7843 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -72,7 +72,7 @@ void show_swap_cache_info(void) void *get_shadow_from_swap_cache(swp_entry_t entry) { struct address_space *address_space = swap_address_space(entry); - pgoff_t idx = swp_offset(entry); + pgoff_t idx = swap_cache_index(entry); void *shadow; shadow = xa_load(&address_space->i_pages, idx); @@ -89,7 +89,7 @@ int add_to_swap_cache(struct folio *folio, swp_entry_t entry, gfp_t gfp, void **shadowp) { struct address_space *address_space = swap_address_space(entry); - pgoff_t idx = swp_offset(entry); + pgoff_t idx = swap_cache_index(entry); XA_STATE_ORDER(xas, &address_space->i_pages, idx, folio_order(folio)); unsigned long i, nr = folio_nr_pages(folio); void *old; @@ -144,7 +144,7 @@ void __delete_from_swap_cache(struct folio *folio, struct address_space *address_space = swap_address_space(entry); int i; long nr = folio_nr_pages(folio); - pgoff_t idx = swp_offset(entry); + pgoff_t idx = swap_cache_index(entry); XA_STATE(xas, &address_space->i_pages, idx); xas_set_update(&xas, workingset_update_node); @@ -248,18 +248,19 @@ void delete_from_swap_cache(struct folio *folio) void clear_shadow_from_swap_cache(int type, unsigned long begin, unsigned long end) { - unsigned long curr = begin; + unsigned long curr = begin, offset; void *old; for (;;) { + offset = curr & SWAP_ADDRESS_SPACE_MASK; swp_entry_t entry = swp_entry(type, curr); struct address_space *address_space = swap_address_space(entry); - XA_STATE(xas, &address_space->i_pages, curr); + XA_STATE(xas, &address_space->i_pages, offset); xas_set_update(&xas, workingset_update_node); xa_lock_irq(&address_space->i_pages); - xas_for_each(&xas, old, end) { + xas_for_each(&xas, old, offset + min(end - curr, SWAP_ADDRESS_SPACE_PAGES)) { if (!xa_is_value(old)) continue; xas_store(&xas, NULL); @@ -350,7 +351,7 @@ struct folio *swap_cache_get_folio(swp_entry_t entry, { struct folio *folio; - folio = filemap_get_folio(swap_address_space(entry), swp_offset(entry)); + folio = filemap_get_folio(swap_address_space(entry), swap_cache_index(entry)); if (!IS_ERR(folio)) { bool vma_ra = swap_use_vma_readahead(); bool readahead; @@ -420,7 +421,7 @@ struct folio *filemap_get_incore_folio(struct address_space *mapping, si = get_swap_device(swp); if (!si) return ERR_PTR(-ENOENT); - index = swp_offset(swp); + index = swap_cache_index(swp); folio = filemap_get_folio(swap_address_space(swp), index); put_swap_device(si); return folio; @@ -447,7 +448,7 @@ struct folio *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, * that would confuse statistics. */ folio = filemap_get_folio(swap_address_space(entry), - swp_offset(entry)); + swap_cache_index(entry)); if (!IS_ERR(folio)) goto got_folio; diff --git a/mm/swapfile.c b/mm/swapfile.c index 0b0ae6e8c764..4f0e8b2ac8aa 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -142,7 +142,7 @@ static int __try_to_reclaim_swap(struct swap_info_struct *si, struct folio *folio; int ret = 0; - folio = filemap_get_folio(swap_address_space(entry), offset); + folio = filemap_get_folio(swap_address_space(entry), swap_cache_index(entry)); if (IS_ERR(folio)) return 0; /* @@ -2158,7 +2158,7 @@ static int try_to_unuse(unsigned int type) (i = find_next_to_unuse(si, i)) != 0) { entry = swp_entry(type, i); - folio = filemap_get_folio(swap_address_space(entry), i); + folio = filemap_get_folio(swap_address_space(entry), swap_cache_index(entry)); if (IS_ERR(folio)) continue; @@ -3476,7 +3476,7 @@ EXPORT_SYMBOL_GPL(swapcache_mapping); pgoff_t __folio_swap_cache_index(struct folio *folio) { - return swp_offset(folio->swap); + return swap_cache_index(folio->swap); } EXPORT_SYMBOL_GPL(__folio_swap_cache_index);