From patchwork Mon Apr 29 19:04:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13647541 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 EC02CC4345F for ; Mon, 29 Apr 2024 19:06:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 753E26B0088; Mon, 29 Apr 2024 15:06:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6B0BD6B0089; Mon, 29 Apr 2024 15:06:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 52AD76B008A; Mon, 29 Apr 2024 15:06:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 333646B0088 for ; Mon, 29 Apr 2024 15:06:55 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id D64BFA0FB1 for ; Mon, 29 Apr 2024 19:06:54 +0000 (UTC) X-FDA: 82063501548.24.79AA975 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by imf10.hostedemail.com (Postfix) with ESMTP id 0185FC0002 for ; Mon, 29 Apr 2024 19:06:52 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=i3B045lV; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.177 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=1714417613; 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=yiqGRbrHVETWRaYu10ga0OW2pGQ8vpr70qPlaFnsEasVYX9HCopQkKAWio92z5Yc/FId0N YagB7UpQGpTJH7mltPP1XtaibGFrN+kKIlv/l4ux+DyQvHrbE13AKtF7x8apsVTpXlYB62 NAQCKrsP0Cth2H/gadWIbMFaF1V/zPo= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=i3B045lV; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.177 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714417613; a=rsa-sha256; cv=none; b=zBbD8wD48l8rxo5edihOTJvMl0uHGhzZmBP4akgx120pG6hu580052lbc9hzWUc94FtLH/ 2B/t0BEvN0DB9EpoEfnKBt1BfDU38yR0k3dEocW38dU4/9L8FqXxmoVDU8ly/Gl3r0M81w Egx1UQE2rGEWKtDWoc7QjV7EZJluKco= Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1e5c7d087e1so42076735ad.0 for ; Mon, 29 Apr 2024 12:06:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714417611; x=1715022411; 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=i3B045lVFuMfK7Cbc7XteY1mAAperUgpdnmXcQEabImQUBFv85tylFFVFugeWkQz4m Yy+Dst82q5RtgrbemhnkA+YBW/PrQGINCLe3beGGgmx4MV7ik6ZNWgkek9z93p5Yoy5S UNHJ7WiM9A7/g3zpCyeCySFoFTIlDvB3ky17n/EEtxH1pOsivgSN8edJna5UHs8Fc5OK B4uNzM4hOVo6y2b5hfeTH2nXcs3YHrlbpbeewibEhiJG+qB4rGuS1jkKA5m9T/+zQUX1 X/RkP8YPa0W1jrl+BoN1PdKNPYg18ld8GAEBW/QaV+nznnlRHbeCmb9ynTnmxawBX+zO ZuQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714417611; x=1715022411; 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=iUM1zICAZvl3bEB8qeOcrNmPfzF1FbQL3UZfdaDHxDal3oejlNTcPi+hsgr3Stcrpu svkG/I9+cSo874KbqZRpCi82RT4erHQy0PRwqmf/9VCyMY1XIif+T3T5xKgBrbSm6E4P IwLzcRQl0f0Qo7JxsJHIATZcH4mQxz+GISMEDAI8ToPMBpnFvZ4oXLWqEsHn4MHSBPq9 yyn8vKnJ9zpIyybx5E9N60xnlL4tqV2XvdB+/04I5suhuQqIcrNvweCFRgEdpjRq+mkR GBhIAeVTxUPePulY+rE1j/GHdlzbxewN4vJgBL7RL6f5AKGzf3Rp/gzeE/Pb2U9bvIhp fH6Q== X-Gm-Message-State: AOJu0YxLT3+hNtXK8QLcghuGMGBUbTWjC7F6pdHL8J7MyoaiKa1fcdi8 2xieXWsGAv/iXq364DecdkuoM2+9KuAyEKXHfbTSX2+gCVEDZqQ/pLtkUlA1a5w= X-Google-Smtp-Source: AGHT+IEWWyXjXq5qxQK4Wj2h+dXwYC3HBxH2tY9g+B+mmj2ONuL2mZBA9D6pxjlnJqOR4++MfTCr9w== X-Received: by 2002:a17:903:1249:b0:1e4:b1eb:7dee with SMTP id u9-20020a170903124900b001e4b1eb7deemr13466540plh.47.1714417611389; Mon, 29 Apr 2024 12:06:51 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id y4-20020a170902864400b001e49428f313sm20619356plt.261.2024.04.29.12.06.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 29 Apr 2024 12:06:51 -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 v3 01/12] f2fs: drop usage of page_index Date: Tue, 30 Apr 2024 03:04:49 +0800 Message-ID: <20240429190500.30979-2-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240429190500.30979-1-ryncsn@gmail.com> References: <20240429190500.30979-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 0185FC0002 X-Stat-Signature: kgk7nhnqyfgcm897rpomyoaf8sjh5o9u X-Rspam-User: X-HE-Tag: 1714417612-365392 X-HE-Meta: U2FsdGVkX1/P0pEqK74bAcNTB6vK7yTgyQbkJJ/nKW2VM+Hu797mazQhzaXzURtT31CXa6rX0mGvwc8bUWsvaCt8SqXI5OAHcnfGfs08WQ7UVCTdolSFSvm7WFqtpQ7qFkjLevIBPeLiGZBFF0JlNBXqvbg0c+q84aH/pqPoBqIBoOkF5LLCpNhw1irwlFJizs3k5Q7wsvFXWHro+Rq/hD/XAFxrIV6C5IfZApdGXnt6qVyPigwIcPSHXhl49/TdiEoSTT4NsXobaS3LBeQd5Xe1ah7j4r+jrg7GVdvwbwiRHjaew1b2r/x8a9JRjv/vY0wQrw9Thvr5DVNTRFErMioBgeW8RWcaM0UR7Si26PA9HayGLMOypDfpWNk+VhTz/8ySC6oI+61eoosmW5Dc3P5AMbUZP6k6S8etbiFbbTWeGDg840I1Ng/SfXRtdlxMK3BZU/6Rb1CLT3tPRvCvhowEFDkV8YRVnVY+DQ9tBFSFGtvgb3gY5j6PAXJ1RKSEwPFOSq4RAFNU9jJp6SQdmWsg9ilRUfuaJaB5BEuo9MRqIPNdhrwR3vMPO6jTg8hTvEfK5eYFhvaJOMjIlZpccTJLYDQrBvYGOWZu6ItMbluvtp1vy+RRyGbl1lJJ/RVdffP5a2UrLEUetEYyoYeSSsrTQznQsrrkD7ENprhM7lJl+GUuWaIwe4u5M2qwU5Svherokk/Tn6ilKKsmpdLfosiS2JXABWyi7rmmeSAP9VrPak71tpHR1jor9a31IdXsgoJJNc1WOihLLl7Fr7IVWhPiE3EfSa2FLUBGVrCg2j9vrjGVNkybJ/vj+rs1yfMlF32BxMsoKE4AB6MpNOba+rkt1jU1Ukaf8T3oBNFyL3ByAYD8GrH2awL0HW2W/Zqn2l1GtifoXBLsPjpFY3oZGQknyI1mtQBC3zv6Cfyn96GISNKQLbUK0NsIii66/0FBCcWfMvf4bR1Or4iIEbN uNhpBTCa Ykneo0DCTfIj1iX2HfNgngsCEJASGb6jqJrJlqUy1hdXG5lvdz+r+4uuxqiiffLJaXFRAUfIzSf367oYO7SAtjhoqkSQQ/45BqBUAjMY3z9RSibhz9+yFnodJw2y4BiOExMqUw2TNmf5LfNHu5OctJA3/3CFgz7O2pY51WK3yz1AP9HF+MM+a0tqWDUt4Mbrl2tbst9hCbxbBe8qFS+n1QBURnF1tedQzoMKZdnJdwL7qst+qSCmotgYVK6jEd/sfO0zcHS/cCF9ikKCcM9JMraHo8wz4yq+3fhAj8vcL542gODIKHF1KP6mgz9ZkJE8aEJ/y5G3mMTipPvrwqa5GnI8hhEGWK3CPIFtB1nyPVxE6ACgGg0eSOnh+43smUUTzdcrKNt4nFMRFog3xEJXHFMG6Wr7xbb89kuBXaGbLCy9zz8I90sQLWNJmocwqufajuUglLyJQv/sj0lJ4a4dtU7ajyMFrxxT6YA7hMyrWfYGkt8f6mCF2ZHFKP+HBv8ybGIESDossagm8r/rV7e/xWe8yLFs7C/yfQKfzgA5ZCTNg9XIFtzM/iy3bA6gdVj5f7hnm8fFnxXb8T9YlLZJqdGvYnQEgFIhTrC3B3tCbYICA8pvUJgCdPkPZU8ZbUEx6ZQnVSVzJVzZe9ejPTzoHftyo7x3X3+goveTLrNLHHLOvzExX/dSkcXdsJdUJVEoSVABa35o3ctmU4GI+cG3iRbH7yAIj4CGF3Uxnr7ttQfUmyPF1UonzMN/0IPZGsNVaRg/M 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 Mon Apr 29 19:04:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13647542 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 5508AC4345F for ; Mon, 29 Apr 2024 19:07:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C574B6B008A; Mon, 29 Apr 2024 15:07:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C07C16B008C; Mon, 29 Apr 2024 15:07:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ACF9A6B0092; Mon, 29 Apr 2024 15:07:00 -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 8EC686B008A for ; Mon, 29 Apr 2024 15:07:00 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 3C19B1C087A for ; Mon, 29 Apr 2024 19:07:00 +0000 (UTC) X-FDA: 82063501800.03.7F66722 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by imf02.hostedemail.com (Postfix) with ESMTP id 6FFEE80003 for ; Mon, 29 Apr 2024 19:06:57 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=X1OLVryt; spf=pass (imf02.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=1714417617; a=rsa-sha256; cv=none; b=p+sFnPmesj9RjbLE8mU1HFOkxIjfMCA8F3mQLzPVuYVuhxe86SZ6xkD+9bEDXB8vfPoTel IhVViXH54PU2DvIdd9fNIxclfaZ0oxZHUM2pskBMIggUBEeaj5hODyMxvjMV6CmMCK9L86 /DfZE2gbX0tfDUXwEnxKQHX16mUXvI0= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=X1OLVryt; spf=pass (imf02.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=1714417617; 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=yfRM+qHBl7JEmbJr1xydN14sHfEFiHH0LtWIzSVr96Y=; b=pPGWTIPz0lCfLO1u6BT8UL4slkqptkv5R+EKwMl9Kt7swFIUl5OJrYdceVa5RV2ACk3Lzo WVDB8PnX8qDfo3on0kbQuWhiUYSjLQFOuLO/d2+WAp4WdeMXb/b8FubgYwJZLDw9JR2ae9 NhBLZN1k3YFVT1oLYwLEMZ3FZ7chJmw= Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1e3ca546d40so41080565ad.3 for ; Mon, 29 Apr 2024 12:06:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714417616; x=1715022416; 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=yfRM+qHBl7JEmbJr1xydN14sHfEFiHH0LtWIzSVr96Y=; b=X1OLVryt9EA3jHQ1IYRPFugxob8BgG+VDIDNOZtin9iVvd1aVGSaYFlwgUOzRBz63m sYF6OuX+Cxh0nO7TJzqRkle9Z0YtdioJR8AlEOxexoQxps0iHb+lqjClflioiUuRM1Ik hkbN9jCiDAZQ500FC/Hmsy01Y+P7SAoeuXxdeiUlFiZWnYn+E0/sxT6seJSk5bw2SdeA 3Yd4voRIcKjY2IFkiOBexGDrNaG9wulhFHDzodPEFP52WS17TmzzSHR9T7UAnkqT4ktd 6Bne/CunT3bxmCgTIdRx2mpuuUTBDk5v7iVewd/xcBK+ieDZBcRCXjj5f66qYStKu8YE y+xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714417616; x=1715022416; 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=yfRM+qHBl7JEmbJr1xydN14sHfEFiHH0LtWIzSVr96Y=; b=a7S/qZHZ5AE/92d2kQmAeLamPCXv8dhzKNgVg+dcps6gWgKAL24zMqh5VdtsV4yLSa lIj3M7L5zNsxDAxQ1J4EfurC4Vs6iu8gnTewaTUuJ3/cN8gShdpCxnOEbWC9VGufF+4X oT5q2KeQTa6TlDlxqQysEmqZdq0NkNU8uENYF0G59qUM3areLyi92jQba/yPxBKPbzH9 81N3tyk1YUcMkebdCaENAB0eAphgUTyH07rZgG/M65rLa0Tm8PLhrCD5D7PRbut7KrIx o6I1ZAckOhqrIGYJCTjGwy+WMZIHp3dxkztdi+m5Gksy+iXzYxNHqK+ngCFZoyzBkmSn UjUQ== X-Gm-Message-State: AOJu0YyM9GIgiRyfcc7NfdfQ5yELlckK1qKRChzDqmFRNEfu26XPpUHa Bdqu0zk6jA24o6Bj3XzlNLVSOftKfASyiJMSb2jUg5ChGTclrqXX9usc69fvRq8= X-Google-Smtp-Source: AGHT+IG6o6kI/bGN72Zio9V9EuR0QrMbdLin8hBig6iTqFcceqUVveJSWOkf2WaT/c9J9vt33sFWsA== X-Received: by 2002:a17:902:f681:b0:1e9:4f9:8478 with SMTP id l1-20020a170902f68100b001e904f98478mr524594plg.42.1714417615896; Mon, 29 Apr 2024 12:06:55 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id y4-20020a170902864400b001e49428f313sm20619356plt.261.2024.04.29.12.06.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 29 Apr 2024 12:06:55 -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 v3 02/12] nilfs2: drop usage of page_index Date: Tue, 30 Apr 2024 03:04:50 +0800 Message-ID: <20240429190500.30979-3-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240429190500.30979-1-ryncsn@gmail.com> References: <20240429190500.30979-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Stat-Signature: 4err8b9ettxmigf3ybrgjxehabdnggs3 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 6FFEE80003 X-HE-Tag: 1714417617-442454 X-HE-Meta: U2FsdGVkX19J1QR3qhuGLCFMVMrNZUQ+fkvdfRTOmC1FHaCdbGA7WXdavYXmXGO1mjt/YX0YTW+oT2mzxXuq/m1ZnsjnX3Vsw9BIQ/G0bdkK/aVXvllLfyBoWOgdz4um4kQ8t60GRaY4rIOmVrCEm0FjKp9XZ6W28bwgi3583K2C9migzytnb7y6wMZNpnT3TPbAkulUer2XGWSEao8A/2x1JKtzXoYOnabn8SvKABmBRZhjqV2xCBT6h8tDgCQqgwyGtNiNLs6TQPfhaQAigCNxkV+ZXVi4p5tvSPEYsS2YAI3F8f6MB5bQ69jkj2XfIzdtWz+SeuMJJVio8N2rqbum9Md2nQGHY022KKBdn8mOMJRW6i2ICxPvxZnR4GD+MmlXP39ri9SxQOIjeW1JYlTqcQwdLenyKr4nRZLP9WYgNTXWwm9uC6CnSqp+lSETo0yHJ+Puv4co8TmJ/DjEXRKNcTZsxitdgXY88vNQMeICsssTfyrEKVZHrdgL8rh606wOkSiMEtD8yV/Rhl+xoM8LY13G7NJOr8qUh5y8JcZkSjw/Vx4NgSrqeR73CaNU7SQeikbxF/HPj3aZwizEklA5rOf1Xy9u1cLqNJWysC3rlT/Xj28Q2HMOHM1GQY0oElQpGX7FSxYYbDk2GaBNO+PfWI0tgJ0YgzUmt4iAOE5KBfwv1rVIlYCnUFyKFNnopmecy2TkjLmqDPBenLUqOHffR7mbQKCgGB7aAm2+cRH/Yz77NHiIb+UEfD9fPJc5wgrxrxYWyJQpGmNnTvZ/PvLcjgJq9CNH2QR8UKCVL7jnRu7qoDOoIda1e66jocK1TJv4Qq+B5Dnknty2nnVX7dmTaZMGwfa1lUqFqL6Ufvx+QzA9KKOgdY34E9R3V+vVCGdQXHxqrg3HiSy/yXhEPr2S8/mmPID/PJqTRgRa9KyA6+51DpfneQt5N1fOQcyBzfFI8p/n5MvtXIQ869/ PIHu+7Vv sNULKUnLTxMPuNlZ5siOzHlD/A3v7xbF60M4LjkyiuelJaANj2wMz3C+mFvVNk1WyPEm9rqaTzvwEdMlcbnQWx9/ydTdPBd30rbc4Gcj/UzWe8YYBbSOH4tVB5xLRurShygIYaDHc8KXqFnr5yvgvpKUFIbKWDLSIveWIExRMJTaGyBR9fwwHIlOPaYrpKsNjDA7fRDRchbN83Hognb+1y88nN7YI7GDRMp+1xaACut72TBe5TlMNb4hMahbJoNKExhqrg5VqR5oGwj+D/tV2BUe2yPrhsOWpHg0wo79ENWKJ9FrvWyfqoKkxgVf6y9tgHCvVSdJ3Eo65tjDZRKYtZ5LT3ZvqxYJQLaNWSf7jkY26mnQm1Q9BNs2+lsPNIVjj0cXrrBQM47oWUDqhj0G5zsCHn+x8RyveRXVLrJGvKUIo4B+G8xC1qAI21blShga+v/CslcDjKc7eWNWi8wmvbd6tE2irNRhKxt2jvlohU6oR5k5CHN2jyQMGuMDqo9JuyvhjP7LaFH4FLkD6v6OXHGlQKF0GFRUzud/2WqLCrdQWTqoScQ/OIfUUPoYltf28hWKy6pWdcZQf/7Re8J6wg1LX8gcPKWBWc/5TFSgg+ctaaOVc2yJucSdL/Xjk/wT0rmRTkK8wiidJAizDvdY3DYeES8FnFVjv60SrmL5s3zAFfdfP2ra5970p0RiEmNmjuCeyZfPJy5ls4rvZAkjeiq9FmPzw2ZHNNaT/e4Huri6C27TVrkyoJYgzqFqGdqBkR3MSLFpjfXEElwo1u1SlHhbZ0L+gadmZS5N4WRGAbKY0lOf22B0eHP2aLYkdgg1PLaix5CkxHKSNc1s= 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, also convert it to use folio. Signed-off-by: Kairui Song Cc: Ryusuke Konishi Cc: linux-nilfs@vger.kernel.org --- fs/nilfs2/bmap.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c index 383f0afa2cea..f4e5df0cd720 100644 --- a/fs/nilfs2/bmap.c +++ b/fs/nilfs2/bmap.c @@ -453,9 +453,8 @@ __u64 nilfs_bmap_data_get_key(const struct nilfs_bmap *bmap, struct buffer_head *pbh; __u64 key; - 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 = bh->b_folio->index << (PAGE_SHIFT - bmap->b_inode->i_blkbits); + for (pbh = folio_buffers(bh->b_folio); pbh != bh; pbh = pbh->b_this_page) key++; return key; From patchwork Mon Apr 29 19:04:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13647543 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 05C97C19F53 for ; Mon, 29 Apr 2024 19:07:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 79E236B0092; Mon, 29 Apr 2024 15:07:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 74CA36B0093; Mon, 29 Apr 2024 15:07:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5EDF96B0095; Mon, 29 Apr 2024 15:07:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 40A746B0092 for ; Mon, 29 Apr 2024 15:07:04 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id ECBD0C028B for ; Mon, 29 Apr 2024 19:07:03 +0000 (UTC) X-FDA: 82063501926.08.FFBBED3 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by imf10.hostedemail.com (Postfix) with ESMTP id 14A88C0015 for ; Mon, 29 Apr 2024 19:07:01 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=PWsl6gGG; spf=pass (imf10.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.172 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=1714417622; 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=Fy5y8I54mBo5kE7jLnxojP9LbOBHxwCS0QfsijKJ/osEtKF8EY63EI09C9X4Eb5qhvfN1L UOiBqe/yeTepQRcAHEuJ4/5PJgfP3Jsl7XQkNLT9jTyc4g9o6b/2tc8qfs/F3QY9sU6YFz ocyYN8bY9b50iSyRpo/erO6dtPmmfvs= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=PWsl6gGG; spf=pass (imf10.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.172 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=1714417622; a=rsa-sha256; cv=none; b=uEBpzAvx7RvQV4WZ9E/tGeURYsd5uIFhKYnxuqyCmi+iyJz/y0fCdBBtf5aGBMk6lmw+MM CmmE4wS7RX6rQ0GPTuWEVzKn5+aJFbXcLEANwIwGnNpLEc0Fa1OjeKul74hGThiBYXpIE4 /1x6i+5YdhFOnrqUEOT0YilLcSMLJmo= Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-6f043f9e6d7so5004858b3a.3 for ; Mon, 29 Apr 2024 12:07:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714417620; x=1715022420; 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=PWsl6gGG9UK8HLIk2uGwa71yidhCOrZEMjTIBCS9HbXP8aoQnvK74Lq4Sl51Ji7JRf B1Q4P0wFe1nUwlfxmUDijyF4R9naS9lu/D2IEgo3g5DLo9CNBrNkZq08A2Lv6IGMeFm/ ReBPmg4Pv1ST276ufDumxdiXQCx7JFluQNrswniVr5hIvRv+6A2PHKc98intZbJy93BM BAE9nVArtblB9UzpGETKH2UXHMtUBtJwvJ+YJW1WrbdUBqGUfwtaxqd6CfHg7fTJErGq YcZkoDRbXvcCQgsz9NhihDkZdNPn9jTpi6XweNtvOPR9Q+6lyS9LkCBHWyqsurO5U9FH DTkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714417620; x=1715022420; 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=jBX5QScpV8H6YSwirioYc6QMTRSMDjbA65rFYNP6oVR88xKQmus4Uvoy3BAL8KdzlD TEmhhwbhOhfvPGLkz5wKYfOESOVwh/hf6twyZhMWTiwYk0FiHuWiaylMVGzeVi5E9QvY GdufawY+YIqQHok5SdAaVOUiXrG/iEE8oZRdF1GGc1259dWCvb9taHom+8Up3fQzrbZL hDkGPTsAfqv56k1tE5wgWJdV+4eoJsHQshXCBtRMhUBwum3eUykip2iRaPwhKbcC652N C9qLnR5239ZcJaSSZY3rKqj0ypynwEaO4D8uRCjwul+Q3fLQApIHPbkTGCEzgtAGCfZB USMw== X-Gm-Message-State: AOJu0YzF2/JPfoRkYUp40TsuflYPS/AKpJyIUg3N/E0O5OzDfF9kiKOt A878k6I/szn6DpPnbZrE4PeIGsTf1OrS5N0iIzCXFrKAIOXCjNi6vYHkSANluo4= X-Google-Smtp-Source: AGHT+IGvkma+YPu9xzUecSUUsFD1l+4n7xw1LuJ9VLq1yA2mCnKc5mpq0XVMSd8n6uL8gi84MJzVXg== X-Received: by 2002:a05:6a20:f393:b0:1ad:682d:55b3 with SMTP id qr19-20020a056a20f39300b001ad682d55b3mr555060pzb.3.1714417620501; Mon, 29 Apr 2024 12:07:00 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id y4-20020a170902864400b001e49428f313sm20619356plt.261.2024.04.29.12.06.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 29 Apr 2024 12:07:00 -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 v3 03/12] ceph: drop usage of page_index Date: Tue, 30 Apr 2024 03:04:51 +0800 Message-ID: <20240429190500.30979-4-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240429190500.30979-1-ryncsn@gmail.com> References: <20240429190500.30979-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Stat-Signature: 8b8sbgoqzk637rhsansfmoqhxfaq716d X-Rspam-User: X-Rspamd-Queue-Id: 14A88C0015 X-Rspamd-Server: rspam05 X-HE-Tag: 1714417621-937844 X-HE-Meta: U2FsdGVkX1+a0whs9RAlz2znPO0ywrlle9YeU8EJx5R0TWoBlrArIU4aLBpP/z3pl4VyZiY0sulnUvIfaSGMz1t0dTCWTM2OJuAGdDkgyJmhRXI2xy9ZtAkdVOOADnDurTwnE9BVNw1ptSxHyF/A3oMxRX/8KLs7kf2XinUVYQw+ox0rV1yFoUYDaAR7kEfVWf9sYhk68nJeXxWIQVRpcT5dxLPFgwNEfzfl+or3STTDXxba9am4oWJA5dvgVC9vRDo3JzvAO+dmX7gdJv+Opp3WXrfutQN0MNh2D97OZZDu2of+ZjEP+OXK79KQEbKZvhHGIbSQfubWCS4u4A0Jm7eM+sQfgBiboTQe5Z2yFSmMHpEOUlyIJqGot2+PvGDGsQ+gpKAW/zkOQWz/ZqqvudyAzzchqw2bjKvMHlHDt6uMAK2M6Yc6Q6pVTjNLtHPdxz3FANeVdEF6MoU1qzgdjf6jDlqYTLvDJfGIKDmsSrpxZwPLie6AM2sNEc41FLQGvAlL6yL712SdheG2IuQ5mqf5qeDi8qXIlZRO/xjS5WSUvqNDEHTOkZ8M5AzkSZxRhNtfvobtkQ7f24+L5L8Jjrr/T55GO4pAYy5fa9nHsTPOUOah8cK1J6j5LOjw8xh8rWVTW4eQUqR8ue2eo5IQrH+DkY34fuLc6CsXJLrdsdNI0dCMPkrml6xjTxZ/sUQNQwWgF7UPJNY/2OEWTYKF1pYBNB0dobHSgnIxMkcS7XL1MemWeW+R0WfnWoXf0q1SVMzwx6J3jr2azztS7MeOBvDGK+283vVWXtrtKswlU7HMJJHFzEgdYGaj5kqvc0vtJq0OUdIfuM0M2/bkXwNwwRYRrL+IuE702trbhriws1r4hoOr+HSKgJ0mdQIuIXsqRNo9NQ5t6hEbk+QAUJlGFz0cG2weHAKgSUTalB6W2BeapaDvAEIiBn4fQc6nhCsCtaWbwKf9n5ms+tOkfJ9 iysDgPot gTsNzoMWMwMsv5WeIdCWXvMFvrrBHgvaBLEMIaP3rEJU0wdHpjvD6n2CgS3FTOlOyroSyeWviXaj4twmEzsKkYKL7WcZ67zKDFMTFJJIXD2ZshliFiE6TsEWTububgndt9g2BsOjAR7O0zmcv6QQUw4nG4whjPdDc0+fw9cCWv7SwP1cU64ceDlbwDB/vLp/PynK3MtgyDuAkjUXqF2aKvPlJlB2sFE+Ju5T9RI0nOoXDDQ1gKRDWESbnLNHf2SF8i4BWu0vvgQBk0jl+mf+AY3/NhP5sNV6T8tGCuMeN1WYq5vdxjcbodSpUxMx/IlIfakhWwX6QPATX9lyYeVDigf8Ttf8kOUugpv1uaYWq2ekKXL56AdwKtYnV7horJDOL/GOxQ+CvRFDmIEdV+MeePhJumsVDNVTPvPovFWsZsHdbzLuaoGh6U8aSqu9T/u2xmQR7+IUU+rV5ugpvNwXGTiG9T381LvHycs7IvxTZzNeBBDppkZjriZ2BzQ4z7+A+YZkf91sgU5rV5INO5mVK4vJesyxIt2iz+00PhZRrZ7NY/JJkds638dYZ92+cLDU5SExCHf99rLAleh1NE61RX+zW+1lGMAcrbfj+h3Xs9PGY+mOc2GPs5n0F2sdooz6ALTxZUFWr8Q1HE2oZgcwyLl0ZrtGu+Uudsgt9GwcFCmi1zNIGOI/4Ps66d7J+i16vuF/IihHu6/k/6VNjqwelJfSiBjgiWCi84AzrrXlGt288YZl7eGAevvnVsBHX024lw3f0ff+hVsEXB/qjWQzOtKodgga54UfgwGBZXROiJes5SpL+0APlTpQL1tUb5nSqDB87cNUM2YTn8juQNyJnMp+zPHgqjDpJEgrBpSZfLw2D3xY= 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 Mon Apr 29 19:04:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13647544 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 4080AC4345F for ; Mon, 29 Apr 2024 19:07:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C315A6B0095; Mon, 29 Apr 2024 15:07:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BE1096B0096; Mon, 29 Apr 2024 15:07:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A82156B0098; Mon, 29 Apr 2024 15:07:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 881336B0095 for ; Mon, 29 Apr 2024 15:07:09 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 52E8D1A022F for ; Mon, 29 Apr 2024 19:07:09 +0000 (UTC) X-FDA: 82063502178.23.CE333A1 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by imf15.hostedemail.com (Postfix) with ESMTP id 79796A002B for ; Mon, 29 Apr 2024 19:07:06 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ngDmeRTO; spf=pass (imf15.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=1714417626; 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=MW5Cr6AoCvwlxaVVxPUKfPkbTSxz56R94Y8DRUGuhni40oFh3A8Nvp8AytOZp41gddZEGw obCC1ZGWyOZ6AbPOeVPRy/LeD37uCAJW7eo3sKSrMEpgAHfFM2NppjhOMOmuysCixdTHTg 85ivG745uVl3BgQDKY9lVdqR+xXCGO4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714417626; a=rsa-sha256; cv=none; b=N3+PM/sJ0Ao+4FNn+qs18kKDcZM4+Kd/t3ChwRixSvTmFdzp2hW3DyUjqce4qZZ9cjLpWP +FiYWByUGpbgqv9OXYy9a39+x3lKPYxVaQnLgCkQ/kXdsFuHn8cVKt3ZiLfs6wFrrW3gi3 /UledSWZ3X8CR+Nvg/5B8CC8u8jRsKU= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ngDmeRTO; spf=pass (imf15.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 Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1e8bbcbc2b7so43988675ad.0 for ; Mon, 29 Apr 2024 12:07:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714417625; x=1715022425; 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=ngDmeRTOqTcPd6qG94piYgZcwVhe4leInEczFwzyzQPTActJ4oyCVIyLR/bu3FK1qJ CcoxEgbPjhbeTLm8vOg9aiIjI7SXQS/E0bX2DKyTg99DHBDRdTGYtdfNJHMqI2MFT1I9 6iR1MDEUUujCKkc/0U6LhGw0GBIY/v7fuLNIfrvVFziMTq4jAtNLgumco8vDC9HMTB+8 10MTV45bZM/NiEf9T44+PJWDnOpB1sbPnvIXE8yZ7+6j7rmYD8ObC6Y7yuBFGmxBoEh3 6XPf2pJjLSVYA+jeeNKcyttqEo6Mogn8hEsmBZsCzNMC5zChuLj13oJoXfgIoqRse+YA Ce0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714417625; x=1715022425; 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=KlAMKkKqhxp6Wrn56XyMWNrmafUcXqoeT59e9yU3HQrntUaiUJcgp3Zci80m7Rq8gB Uli9vsrBrAJ51wGQEGFqU+y3Db+sgzfarSSBCvthlEYRo4mp7Rpco5w2TztrKycLwM6z BUkxV2MHYPvzwG73wcS4A+rRrjFlTYWjlA27QJzFbR/N/O5oQ0qrlTNsSx3Wi66tfs8X Gk09tEuucCjwka1c97KglisVMth5NPzVt9vUeXA6/ojomol43l9gl9puxNECNrTNvDtq YJiBL3Z4jytZFk/OF7dcqdGKwXUye1njA9HwOnThN/pyUD22uTZdn6p5esAFdHPUC6tl hiGw== X-Gm-Message-State: AOJu0YwTlmRGUqneJRK9/k5KnISTdqY5g86DfO43HxZTxx+tjLx8oncg emiE3xHR99LMewy1X2waRGnJHr6mATr+sYK+H8YGPK3ktz5zjUnD1Ri9H6qskP8= X-Google-Smtp-Source: AGHT+IGCpCshl3e+0jgFbNefsapLc8x0wT7Iwt/SLS3EHILX+IdhnoyhK9bIf4QdB7KeidxbJ/QzBA== X-Received: by 2002:a17:902:da8a:b0:1e4:a667:5528 with SMTP id j10-20020a170902da8a00b001e4a6675528mr16722842plx.3.1714417624876; Mon, 29 Apr 2024 12:07:04 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id y4-20020a170902864400b001e49428f313sm20619356plt.261.2024.04.29.12.07.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 29 Apr 2024 12:07:04 -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 v3 04/12] NFS: remove nfs_page_lengthg and usage of page_index Date: Tue, 30 Apr 2024 03:04:52 +0800 Message-ID: <20240429190500.30979-5-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240429190500.30979-1-ryncsn@gmail.com> References: <20240429190500.30979-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 959aa45ufjtpas6ycrxbd4rrkqgj147c X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 79796A002B X-HE-Tag: 1714417626-918359 X-HE-Meta: U2FsdGVkX1+pBtTb3T1Yz5n3xZibzZ1ZN/CcSe12RsVM1ktC/OHGxGjWt170MdD9t9UF/Utu76EqeB3wfqL6L3Vjq6xIdQCLOHK2D5xJnSl7iA/Z/9VvTXfMLdtF41GZqVBx38m3unmaB6cyXgcsKrpQMExJy2absiFEA7F8dPnQDVB/5/r5Z9zkQP3/o5Ao91Vezr6w0eyL2Y/uLe6YZ25vcpy5Gt34+Q/qE2KWP57S9uGjktIQcggk3QQIO0+iU7yTS5PiorZRj5riRMMqKOJX2XGAZYQC13O2WX+ZdSM3IKQmLzk7YGyV45m0V/lk4WmGsUVZ7J6mUNPcMbiask84Pu0qdbs140o2LJNBu7cd+jlNQrF2Qf2B3wLXROCUFK8sH5DbaNZP/aiX5RjNTywxeYbAVM4c09IidHwZfEP0uUPg0TmzcrwCp3jWYVJypC6AyMRka7Az7alNhxnV1KjwNO7JnkYhBWcxsHc4aagn/Egh67N+RmSIDKOPp/SWFKY9zMy8GgHZHwhkWQYa9jjqwMl1VN+te1+vAR5PI00iHezKeAm3sYMpc061zpyqfPFxe3IEc8n24E71IpKfqC8hZIRhxKA3w5NE6ScdNdTnsIX9keMb1fgOcaLWxxgfRsDnqKcM4o4qfCxvDMaNPN9qgsrxQm6M/UeDBK+212R4wmqMnJryttvW1uktaYDB2SAjjSmbIm3ZlHqKfutiid1WAR6yDUS69PFddq/nFDHi/8VQsH4H5tMosVukXj4FZtIwWvosvwXbo/mjS91bO5n+QsQfu8Axou2DbW0jcxo/fEjg0a/+MdH0bZ5dmE28pTwrX3iDnbjtdxvRCqkMCdqpIiLbpDXQ1Gb6zyLgg5XZlZlPpoSFEzakv2uZC8dm9BJIRnJ1KsGzl9ApyBazm/9bPTTPnLCShJZhJE4VVkoOiKfpkbeuKP69fs+zSSAM/Cri57FZcEvaE3C5X9B qa+0FCJo s9z6ZqUEJqDP3COrDoCruyRDVeDj3DarpwVhwa/FhF5Nr2TGTY2mCcoGQ6m/Srlx/0lPdmI4BVydOSNSjidtVFnqCTnM8UwTFLubhYvsEFmBflitAfDUwl62/z3yZE7ifPRHxATzC8AY5/MU754c7hk5ObsNX5zWlTes6kHvz9J0/DqEqhXjsZyHtyaU6S0fL1eGxaq52Bbpv5Plrn3dwqWz2y2T+YaEqqNMtn1q0S8n4HRo7DQBPXPaGVrg5fDMGPXqNv4lNcwHaAyVWgSabOrsbrODB7i53H2EDok6cGTbX84zmu1/W3U+5ueoNwQrUxMkYmvDaVBZMLrF/QjrxjaBUXFBXEuM58iQOsA7D3GOxh7BQ102T0C569rsPVEoPk1lc/7d/RjTe6wko6/EgjZFt336LUIfJs3HT3kC4kJb3fM2wgMTdHL3WqB/66VwHQEbzJjmqBoN9h44qAwb4EYF5MrGnt82q86rXlWlqZe11RCTq3YkABfqPBr/9YVKgkgpROCr4UWvsEgNuON2gis6FAL4URMGZ+yTXIEKbwtdUTWDDOgQ6YPgnkl+9Y7m9MkUdqneoG7KgZbVXnYAr3bGZCaSKN7LouHljWMzjN+NOAMDYE3hCIB4vxdHbQFW+Qsk3aTQ9H0m3MbHMBMiS3vSdZEN0I/7Rua8/4ZMBXnG7KM5naFgPpo0Kc7Im5dJVrK/MUINImQ4cQMmdqQROqEG+e0si5EDZDd9Xr3pWuuneY+8S0qS7MxV5EsP3ush5WR1SUPH+BNkH6PlL8USmJOX1r0siofJ/R3sYabNvWx8xYqnuTliZkcQmT54hIfCcBxm/ZopPWWRpgbuboov8m40TvaNVtbtd0+q6E+OuwqRRq0L2EfANQLLKNA== 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 Mon Apr 29 19:04:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13647545 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 DDD02C4345F for ; Mon, 29 Apr 2024 19:07:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 728BB6B0098; Mon, 29 Apr 2024 15:07:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6B0F36B0099; Mon, 29 Apr 2024 15:07:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5519D6B009A; Mon, 29 Apr 2024 15:07:15 -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 394F26B0098 for ; Mon, 29 Apr 2024 15:07:15 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id C2E22C01EC for ; Mon, 29 Apr 2024 19:07:14 +0000 (UTC) X-FDA: 82063502388.22.FFAB363 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by imf08.hostedemail.com (Postfix) with ESMTP id F28AB16000A for ; Mon, 29 Apr 2024 19:07:11 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=WuZy39FV; spf=pass (imf08.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.175 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=1714417632; 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=xZhQjIqoZ+Dzvi7kV/KmeZKZ39va/VtfWTmYeEwmXIdCW7c1GYRlGrt6w3bUEYw/LxjK0x Gtfc/yF6hCS1Hy1MZSwEk8YS6aiUNy8hiRuYJDKus7s1C3iEO2gY8mcPIWzc8APRFCnkC8 2WADWEQiluqUWuKwJ9obni0Jn60swV0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714417632; a=rsa-sha256; cv=none; b=JCmc9rGqEglKRbXhjd6hh7gpmfGc8TFNLush5M5Ijb6Ce8MGoTev4XNO+DunOUvAKtmlRG 8txHvY54Df+vMrin3i7qmrYQZh4ry+S9qTydWrpfDZmu9/+HV78VAeVDMBrtdk7zINV22M HCkIdQrto+NmBeI3qXGaEetmJHYNwnk= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=WuZy39FV; spf=pass (imf08.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.175 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1eac92f7c74so37677055ad.3 for ; Mon, 29 Apr 2024 12:07:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714417630; x=1715022430; 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=WuZy39FV/m7nohuUjMVZpheoq1ldkQ56D2dXxkG05TfIiPnf1bU0Vg9uxfAxlAiWce hJdG+d9j8MAj/jJ0PLBaZ/8QLx03XmIFjA9YkfOEGh+RGKixjdygYUTVuHAEOV7Yn1O0 nPIRuhF/9K4Y/uevGrs52Kwwdfy7iNKWko666cg6vOy28wCyQQqXr0KfI5LS2ne2qKrM 6d3kOc/7ZLFo+KphPOo8cuFXCViYMTrFHV4cHxrgePBc1s17oB2ymmW5Wexr70X0s+Lj ZMBLc2eKFsSvxYkgZM4DDeaoYQLB6GOuQbnni2s5mEoqMqXdZNd5V7wJenRrVePamvT3 oNWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714417630; x=1715022430; 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=MmxRb+hCqgFkn7c1JMztw1MTWv4pM+5pzQswcVlcVYFrP7dWmYsboI0wKRl0B6xzrE p7tygTK8Yf72MN0JNx6rhTWvTlIi3VtBovrvKWCPgVbEtjSDsUb39j3WunTT6Jjvk5mf COt+UzGPXAYYXEwbphjUdMwD1xhbX/5u980ObZo6c1pyDWWrujUrZYJ7z2wmAyMNjUIh P2bsKRcd+vI5Iq3N4BsmTUChrcJEisTyKV3eBfWcS/QPaApRxi6ow3CH6NuF5TS5mhl3 TMxC17MKMK2Xq/0R3Nu8SplNTsc2yJsMgHze2PdZWEvdWuI6JanQI2Hne6fCbLAtgE1j L08Q== X-Gm-Message-State: AOJu0YzKCwwn8U6yDXyJsuTmsJoktjhhcTG+jXIW0tQLYkt/ZoHhcULJ G2AZ2Do/Zfq9Px4YP+jPZn9J44BqUEcB/55l97wV1AhAaEYr5I5/rmF5uwRehKo= X-Google-Smtp-Source: AGHT+IHTYDIYUhd7xIT9MpX0t66Q+G0hrqubyFH0j3AGRIM7zO+0pTNEqaULQZkZmC4aZ0qNTe1Z3A== X-Received: by 2002:a17:902:da88:b0:1eb:5a92:c939 with SMTP id j8-20020a170902da8800b001eb5a92c939mr707490plx.29.1714417629601; Mon, 29 Apr 2024 12:07:09 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id y4-20020a170902864400b001e49428f313sm20619356plt.261.2024.04.29.12.07.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 29 Apr 2024 12:07:09 -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 v3 05/12] cifs: drop usage of page_file_offset Date: Tue, 30 Apr 2024 03:04:53 +0800 Message-ID: <20240429190500.30979-6-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240429190500.30979-1-ryncsn@gmail.com> References: <20240429190500.30979-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: suuhnoainfgisjeetzz6faqga9gmcaxn X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: F28AB16000A X-HE-Tag: 1714417631-926072 X-HE-Meta: U2FsdGVkX18WuJEshVo1dsZzXP7WikMUhMnOMEFHf9LdodnZKOGUPQJMkhBlyus99qjAPawihXAzR06jXBeJhK32ujvr9YJ62FLhGGxtz0Cg0+n59a6sH9EFV2L84QLESfoaKYRFoDKhRgVj9nQU1eGmoZftM17k2964QarGgzKamS6WH1A30Umefjme5jnzex0HXm3bKFxnyACOYCBMmfFslBitBVjpFYcyJigX2sV2UvKJdjDDc4SHJYmIdaOqfku5LEi4ce27+pZcS9EO/r5/S7rV2VAD0wWa1XnkUzs2cFpmWYL6/oKdoDW7Cf+8Bp3pCrUv9vUlCjN6j8jll48tzy6HV4GM7kRHuXPqB1kgtPkTow7UV+pwm7r93UW0t2rlvLMoeW+X2cZwydC5/4QkM8U0D9IjAxxagKiX1rTaoxTepjsqt2XOYUNKaJ4RtX1BEtryG2rfQBOaiso41Epj+qdqgNENrf7lBYtw2rHUUgG4BoE9aesGrhmw8M3ZarIy9YmaBTy60F5JI5vblrGjHmxbmi7grWpwi0Pd57a1PTu5Kl/6uVO7akUcH5GgaTSjKqhoDC664xxDOzHY6+b0xjQfUTVEArq+6wP4AdxkJeUQyFb/mBBv3/6sdlv1mca9FwnCw9O7rycr+9RKGNtoDRTaZJRAfvD+i1FzdKy3m4/1+XbGyCsPmuF5Qp5XTq5uRN8uuTNWS2oEt2ZKFPUvTHkME1TPfvzTgsl37jpTbKQKamKQHlRw/RenD/lbzbUAg037F3i32dngpk3hF9lp7njksvAwWZt9kVeyp2bSs+/OODnvHsLe+HA9447qYe5Klc+EjUvuTNODEW4LRKVbxz+JQiecoL4VswBANnbk/xMog7PRJ4yGbZ+dwKiU0Ll9pV9t7cAqX6cU85am0Y00Ri6MJOeGfgPMA7y2WLNZxdGPB/kVrYHhrme495JOzzYF+BHdmdpQDnE/FYJ GQHFOpEZ lU0C1uT/WQTJl7cwMO6XtZWs44Lukb08EX8XyKHlbMDcjojtLPDn9LR+pMq55yzKIHvUHcS1rwlgJpOaLXwMP4wRchGESEUDn3YU7VdgeCm6Tu2mxWzQHjplfmKSZczr9m2R2B1hQKalxaapvlT0Mpt3/MJaYJITB7reig//yVI44aZZMZz+4UUqf+56MwUNNx3EORYmQCgri9Zycdmc/Sx/e9C0jTQRzKV9laXdgucecWEnrwlOfS3SEU+MI7gXP71RtfSa4caGcw0hpM036EgM3hQu/V623oZDsG56HJpzukiL0d8EG5l7AtWbR3wcOBXuLupd5HbGHT3PE5lofUpeEMQQHQ9K0mhwD6AS+98F5ROKd+/K8j/jAheDoXF8A2sNNdPRU6jGRz1C2JbtVn53CaS1UGt7aaeulyGZ5W8MdDSgzCv13bhpl4EfghaJRV7XzcxPfc/gfk3qRfbkT3v8MYHuMW2WwBnINCiKZpWzKpfWbxAv2PS0ilbLiEs8HzyGkcE6/eLvcX5CPKbv87FUqY+bP44IO9aVRXgwUErpFi4sDyL5gYUiWhGg8NUYNrOahCvpu26teipj6bOSAwTcLXXwQIAuwvU8sHswDm1B51pgf5Z8kDnzT/K2tqgWdKK8kM+0C7CyEcEwIwlKIUmiHt/6v9x0rTIif4LLhzVK0GWTAl95CfVyPJzzW8EqktzGoynEGa23r/nP9Poj/YJd4nTc3TT+YjCymxjCOUJJbnhydTC424rZ7J4vaeXCuAiz0qbhMJa9W803TPujRaEfy4gTFh+8Nryi8VoYwJzzr2xc/+LLHbX6gnA== 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 Signed-off-by: Kairui Song --- 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 Mon Apr 29 19:04:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13647546 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 5105CC4345F for ; Mon, 29 Apr 2024 19:07:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D90A46B009A; Mon, 29 Apr 2024 15:07:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D40E26B009B; Mon, 29 Apr 2024 15:07:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C2F6B6B009C; Mon, 29 Apr 2024 15:07:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id A30B76B009A for ; Mon, 29 Apr 2024 15:07:23 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 2B011C0221 for ; Mon, 29 Apr 2024 19:07:23 +0000 (UTC) X-FDA: 82063502766.06.AA374DF Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf23.hostedemail.com (Postfix) with ESMTP id 50F8C14000E for ; Mon, 29 Apr 2024 19:07:20 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=lIV15d0o; spf=pass (imf23.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.174 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=1714417640; 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=/ZAdz4nacsjUfg+kmWc7WaK5L40TR/d1vDMSfySNIi0=; b=0E4Cm7X930woVwOj/v2AwIZAo1tCI17zzNKwucRDEWne4MY29gbzpnKgbSNJzXX45skqTk RM4u6TsCywcP5OsoVQ7kSQNvGrnwKzKXb5O6NBeE1e/ZD2Jvfw7ob79HMpad6Yx/2197Xt ajrbt2pzLPIMrsmOJAoi+OK0iOL0vkE= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=lIV15d0o; spf=pass (imf23.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.174 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=1714417640; a=rsa-sha256; cv=none; b=OlegaPLEiK1X8+hoJvokgV7H2XPGKmh5pUzMUmjE8qYX4jFihN4f86xdyDk2u/LmjfUN8Z vZygbJG8vpVS0Okn/NTqKOEIuwxyQWm4bWjSjeVSYtP1lhXyd0v/fvd6dvkrG3p3HOfQAz EBBX20fFAgiOyQ+UCwGMu6B/72eUpFM= Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1e4c4fb6af3so33046585ad.0 for ; Mon, 29 Apr 2024 12:07:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714417639; x=1715022439; 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=/ZAdz4nacsjUfg+kmWc7WaK5L40TR/d1vDMSfySNIi0=; b=lIV15d0oki8whmpM9/6491Z39Ubka+1H5NEDLjJGec9YE1Uh9QvBvpcLL3221YpsAJ QNrmBjPFnL+UYCu82LUWTxtPm8J5nH2NO8i5KFGjegeW7wXVf94MAnvtoCBzzyZup+lp YXKtfnqIGXM4T/5HVf0g3kmnxbDMZpvf97kg4XSlzZ+3BJrSk+PLrmcTXKGoEdlDvMhB Rnd0AGw/nyMVJ4wKwtY8zCUtSaRt44yWVrURkXwlDlRbBcQmUFLy+H8Os0C5G90/HLwl IuajdJMMhFEcKaL60QFOwvfXW53FMz8RSruDsPQaeZ1j1waJnlNrQbg506Xjn7vc33kG M9Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714417639; x=1715022439; 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=/ZAdz4nacsjUfg+kmWc7WaK5L40TR/d1vDMSfySNIi0=; b=w6iQTohLUFD2M4kjDWByv230nmxMv2BK/zqF8lRIRv/pzCe3WKfMhu8mvf5alWNscv MIWqYPp2LmcrbiVVBdzX/b7nDZK9TsCBal7VsL84wv6i4uSeW0NBA40kqhDcexEHBnfk mAWLMohLRXJ4EbJunzXpjsk1IpogkbLek6TVJjg6DADkGAdxuS4PZZ5CAAM/DY3U9tQ0 yo6RJr/KUbP67e38kzS2/Z12gEcv/EMKB1EzCHTgFyNUhA4gqF+Ax3TSwF4tYF6KlYzo rKY1T5OeyWuEfr8LzD/rTpzbjdpYlYmE4lmiK/d/e4Tzj7qVkBv6TcqfOGhWTfJX2Kb1 PY5g== X-Gm-Message-State: AOJu0YxbnGqjuJTylW6rqblSp+hUGsJ4qM2+8RDrN7dy/RX61R5CkveX CxHqvEhIx8jVfo9BxUAI4bZVZfr5GIKC4i7/GIQD2uXW/QOTs61T66GyedCce5w= X-Google-Smtp-Source: AGHT+IEmVRDgcLWQ+6tPsCb7ZBjy6NSNZhmYZz0nvDiJO9htXZ6R1aiOcZHSzS635P8dLMc8xNX3jg== X-Received: by 2002:a17:902:d489:b0:1ea:964f:9b0b with SMTP id c9-20020a170902d48900b001ea964f9b0bmr870204plg.5.1714417638707; Mon, 29 Apr 2024 12:07:18 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id y4-20020a170902864400b001e49428f313sm20619356plt.261.2024.04.29.12.07.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 29 Apr 2024 12:07:17 -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 , Jeff Layton , netfs@lists.linux.dev Subject: [PATCH v3 07/12] netfs: drop usage of folio_file_pos Date: Tue, 30 Apr 2024 03:04:55 +0800 Message-ID: <20240429190500.30979-8-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240429190500.30979-1-ryncsn@gmail.com> References: <20240429190500.30979-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Stat-Signature: z3pt6atf5h4e56x89bd1ibcn85msf1gw X-Rspam-User: X-Rspamd-Queue-Id: 50F8C14000E X-Rspamd-Server: rspam05 X-HE-Tag: 1714417640-809980 X-HE-Meta: U2FsdGVkX1+dBu27LWBs3jlmoMStrXrUStVmZbMw2GY9nEzOu31fsKAXpaZ54GYoihVfgQpUFrMVBARnZUUwgStnaLrKL1AvvGu+Y0DAIAwyRPwNLxs2XVJbGl/2cpdsSa2+lvJ7c0eijlgKJWCKO1sP1hgau7o2vV0B5qP93i/itRXVpJMpe0NnNhv+1E661Fdi3loZv3LosOcrWkM/2Zzwac6P2huBjB6KFXyVdd3x/ZwdiEAGLaF9A5z7ioZ+meGIWlxDiq1mlnt9WcqH/blwHVc/GR+RwnF1djSiG56n3yxsufZMypZ78Vz5qVFKG+pz2CiYeoE7SCDyrBnVwMjcJHtBEw/O5AI5zK2yoF+K3qS5/3QRbKYxymHsHhcFccgtvtGIDiUcYkl7D4nSeLmS6uNj4U5+lQwXbMCnbMWh9YimD0kSDGUvluv4hkWWsXmAqzgsTL6IqUtpQjXef/gPs0AxU88Zt2xn3EHc3Qy2NbpaTklGzvjTnGGZ0fG5yvwSsSmF2nGZAe9O3LDYNTdfI+TL8pCvojH6pZChm11o8PE5LPcLoIfrAg5Wk45ikXG0SgTAQksvxRkwDnbze6vUkiBVhzGGWf2B8ko4VKn/4momD/1XlzB1OXUH92NOOfW2tWRyUf1JjPDtObmpyAZ/1NnBtUWgd86Pst5JIKx6uaHu1Yxe5cRI0zBODMOtqpfbWSIxJZLaCyZ7cXHsSDh/LiMy6I3GClkI+7/V8PH/b2eYVVonFEuPAlhJx6yiWztmrUhIBKnoRzEOiqqjd/7TeYKMJqR1jpkxlsyftJalsgH/c5V3F3YxWMpdmot9C6C5/X3v2rlycE2Hy7lAcYHZOKwUubS0QFqY6yNx6WlDu65g+WPlm8xwiDFrW+xKM/BCeiLONMwDzoHTnpKsXqo5Lp7BeYjh8qKsJ5KpbsaocXmnUYY6EgpkbqQjmUyK0uC88H7YilKzCjAdrnl 4oxeRdYe 4vlQzMj8XRWwQxF7/h0yU9q7I/kV4RH+ulXVldkbU+Bz260iNNFZcZtUfu7zv3gOw1LpYnVtlnWgRj54oaCqsvbP0wFU7P7dARjF1i5ySU99ypjorJSa3fYQQQ8ul+bzOh3FPXibtQRPUhmXoypJqi+T0sKpH6FcAj97O00HGnt6ALI77P6GNh+8NTQq6NfY0ZMwQ3jp9vnvNPXFrBsP+KOKWL7vrPgDd2vvszW+WG/gnqZ2QjiWOTAa8r/oUqgyXZgNMILfrTwVqkOs96I5zQrgJpuO6Uu6UrQeujt5sJSAD4PHWEf0BKRq46Cmxs0rq5VFoZWulPB7H5UVwWDQIkIWYcrsKlcMGtWB413KIDRm6Z+cqHcAGE7/S2GQkGf0gljwxbAAsZYvNCUK5UxXz36OWdbWKjaTrbYIgCxGvrpv3zOJEtPdJgja1tvJhhNUJxpxGilTYg1IrM+lKTVpFucZyUAFDWmWvDKQuzUjvCBphamCVqVouF3W6QRudNnyzt6TPXDDc+cz+9tcrI3vRG41DLjwv8dIXfKVSJohvnojfJM4iZAK64ZjnWqLjeovlIeD79vgzfiI8A1zzQ6su/wV0tIHgQ2sRtScxpsIUW0a+1YF5eAaK983oOVlBBde9v5YemoNEin7ko1XUiI0WAygk8InK2HbOYEUhqZqF3OAEKNZJZ7MimiBZQEc8wS7QoWviQiKKN/cbLKGk6J/V7hoCFm8tM0G5JnvqMbkkRZQQBcKBsqZ15fKCmtXp9NoCDnIP 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 cache is never exposed to netfs, so just drop it and use folio_pos instead. Signed-off-by: Kairui Song Cc: David Howells Cc: Jeff Layton Cc: netfs@lists.linux.dev --- fs/netfs/buffered_read.c | 4 ++-- fs/netfs/buffered_write.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/netfs/buffered_read.c b/fs/netfs/buffered_read.c index 3298c29b5548..d3687d81229f 100644 --- a/fs/netfs/buffered_read.c +++ b/fs/netfs/buffered_read.c @@ -255,7 +255,7 @@ int netfs_read_folio(struct file *file, struct folio *folio) _enter("%lx", folio->index); rreq = netfs_alloc_request(mapping, file, - folio_file_pos(folio), folio_size(folio), + folio_pos(folio), folio_size(folio), NETFS_READPAGE); if (IS_ERR(rreq)) { ret = PTR_ERR(rreq); @@ -454,7 +454,7 @@ int netfs_write_begin(struct netfs_inode *ctx, } rreq = netfs_alloc_request(mapping, file, - folio_file_pos(folio), folio_size(folio), + folio_pos(folio), folio_size(folio), NETFS_READ_FOR_WRITE); if (IS_ERR(rreq)) { ret = PTR_ERR(rreq); diff --git a/fs/netfs/buffered_write.c b/fs/netfs/buffered_write.c index 9a0d32e4b422..859a22a740c3 100644 --- a/fs/netfs/buffered_write.c +++ b/fs/netfs/buffered_write.c @@ -63,7 +63,7 @@ static enum netfs_how_to_modify netfs_how_to_modify(struct netfs_inode *ctx, bool maybe_trouble) { struct netfs_folio *finfo = netfs_folio_info(folio); - loff_t pos = folio_file_pos(folio); + loff_t pos = folio_pos(folio); _enter(""); From patchwork Mon Apr 29 19:11:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13647561 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 F0645C4345F for ; Mon, 29 Apr 2024 19:11:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 863C06B009C; Mon, 29 Apr 2024 15:11:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 812F66B009D; Mon, 29 Apr 2024 15:11:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C75E6B009E; Mon, 29 Apr 2024 15:11:56 -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 4B9F36B009C for ; Mon, 29 Apr 2024 15:11:56 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id ECBB3120122 for ; Mon, 29 Apr 2024 19:11:55 +0000 (UTC) X-FDA: 82063514190.15.34576E7 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by imf24.hostedemail.com (Postfix) with ESMTP id 51FA218001D for ; Mon, 29 Apr 2024 19:11:54 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=chTAOcak; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.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=1714417914; 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=/1bORWOEMtQqR5EeJUVgL0AX3aI0603PhY0Dzu9DVzE=; b=dZiQQcMQxn1vag+CeIYOXx/TRdSi32VwHIoA84asXJ6X0Ivkp1QBsvlX0ya/7SRZGSGdpE 9J3QegsVDfLHFnY/lH6a3hGjs4fgA0g16t++qU7/CcNZGKDTjmpAo6qteE4wThIG6Rryt5 sqJSBcmViB+IU1+hOft/F3AHIMnXmN8= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=chTAOcak; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.174 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714417914; a=rsa-sha256; cv=none; b=HWi2307C0YjKobdtjcGmLJTlvNpJ3jaeXACYBuKGE4RAGS8kFzBlco+AovJAjjx4mLO3r8 2A0xKL0fy9M080a8THoV+Csv/2TE5wQ2Wde0iTzsaSlgEfLGaB3C2odP964SDdC0YzvvL5 08gr0QV/ULEg4RjMfrZQ5UUrYFGILJI= Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-6f0b9f943cbso4028556b3a.0 for ; Mon, 29 Apr 2024 12:11:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714417912; x=1715022712; 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=/1bORWOEMtQqR5EeJUVgL0AX3aI0603PhY0Dzu9DVzE=; b=chTAOcakKSyLRN9wU8CKjPyPor5Hzl/tEyE0mvxLMYpr0kxUZBKLKQz07JJZZY8lvm R+fMJCJ6poZmyprOlZPRjAX/BDXcV/XQE6UDAWcXCMxEGWqzpstP9xNogdlJIC/5UaXr v/WnXpy6SSsU81VHWpXlbb9drnTnLQfsrKarfSWP6HEhMoc0lNNQtpci9EtoFHAopvbq 0HAacXrlGdsGTq0YOnMbLj97UU0nH4RvwxWkI2+LyKh8gOBfqNDB4tMUlLqlHZWIxM+H 6JZtGpB0r1ouxt6wRyyW5BiekU3r+fzbEtRgpb1IlkCIH82diUc6/6q/neid1Nr69qRV vpnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714417912; x=1715022712; 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=/1bORWOEMtQqR5EeJUVgL0AX3aI0603PhY0Dzu9DVzE=; b=M+TIEPTOCnQnlxSix0ILz7KTbM3hugtnZb7HTz53aoi1oH6ggaOW+9Du7NQQieNvSO sqVooTCuu3VIkVAPMTFMEMSkKGySoUzrt762/54GDYm5rWCD4noQmqqXMkkW1NaJaTiq 6MnBlfQ8hLCdmidA0T0QBM7sM0qDbxj7I9LyY6uZqceF99xUcucAlUquLCjABgRrP40I 9aAPh8/vaF2r1uFopjBhowhPnOr99nv70g9iniy8xMhvpdrLJeRXRDBdtplLBbTC7RVo l1q192IV6ITWJ4rYt5oCNX/fjD/nLaLjz108c6H37YxTXzc+ndBii7R/Q2Gct6Uiym9v zJ8g== X-Gm-Message-State: AOJu0YzwzTljOSELjjBbfHspNC1Q4JNZSEQF5QFb8+WWViemZIWk8l7h Fac9KlIKS6v9hVqKnhQ+31MuP0MYDK7QDrJVCtcafcGf+exzsZxTCW81gQG/woc= X-Google-Smtp-Source: AGHT+IGx8aY8FR50gdhXj18Vz7j7jddJ8qW0aYfCyeOPPSYXuiUjoJ/c7FOQYDIpxGDCtkTEqeM7Ww== X-Received: by 2002:a05:6a00:2186:b0:6ed:cd4c:cc11 with SMTP id h6-20020a056a00218600b006edcd4ccc11mr431263pfi.25.1714417912024; Mon, 29 Apr 2024 12:11:52 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id e10-20020aa7980a000000b006ed38291aebsm20307988pfl.178.2024.04.29.12.11.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 29 Apr 2024 12:11:51 -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 v3 08/12] nfs: drop usage of folio_file_pos Date: Tue, 30 Apr 2024 03:11:34 +0800 Message-ID: <20240429191138.34123-1-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240429190500.30979-1-ryncsn@gmail.com> References: <20240429190500.30979-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Stat-Signature: x4wehoarykjzj8ygtnp351ugwtxgeywu X-Rspamd-Queue-Id: 51FA218001D X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1714417914-379546 X-HE-Meta: U2FsdGVkX19HCMB1ROhjjkilHXnpC7flY7Ps469oMbz78mZWxzLPNazJknfcSsL4Si/ngDl2zviG4XF+DFxTI2NWCIB/7VFPX8AIfUPlZZilm25K50sgiznfNdgHkivMxuHgfg6OTCSP59MOT6rs8BaM82SVntfSko/nJLmRTYi8gQRIGiWJ+rLrIYqYawSNEZtxxKAwaG+vy7VsD9D65/R1Tp/5Zdp8H7Evlq2PtSnFLYxXjCQ+E16nlBj4GG05osRXiTEu7xRBehngrMW0LZ7jMbH/tw5EjiY6QwUj242KqvaGtibMrbNEfzrjmZ3zXfPebnZrKxE5A7Vo5AX6dpJEwXvlJO92FvMhCmaA5z2Q7V8UiOxYP2z5vD4g2cXjPAzyqP5Mc+FiJmn1SXxQeDeZgVO1O2NppVvMeQqxedveGIiEU0thb+c1BR8RYYF8WQvQfapmblMxUeaIA5GsynWaBD3KxbVTvNw2jsiCdEOBwduveO0P21qTO2L1gxsAGl3yESITGj8xs5LjeRa7KEBLCcL3bxsYEdHp1rSrjcwWrNxl08aTFwapNwzUMwIuHqPO324W9O/8orRff+4n4PZrczPAiatYJgUPNPBA6F2ylsrKjgPrYB41sRndFUlCyTxzUBs7jGnfToUzjL6LXlnR28hQoYP7Mfv1iloWNL6Z9T0dAZIvhLWuBZt6fxQA/HnuVzFSVYLDJJyC+QbTlWBIOMEbA2qM4eVs5xHtxIgzcnupcb8ppVkfP+HdauIHMrr801arzQDia8TA74xIww0jwke+TuTuvCSu5Qxmibqq3BzkLrQESmI/OCW+CYuBxYHzTaXgJrEhGBjDi5sLcfM/IXDTjRDovlWrui9kBMi9bOTw60onDyegFgTjE4HK1FQxeD59RHWdjl2npT6CJykCFi/NAhFSVNwjSujgOp5hi4r4zv/Y90Tc4RIqeeY1Q6EHk3JGVv2jI3xBuJV 1aby0cNc 9+iaUT2Kuzk2I1CsJBUk0+OgGS03gyRhI5u9g+wp3FomgLd9216+FFYrymZBM7bPjMN8iMYJwPAm1oT+jStQjARJQwotPX9hH7zgNxHc5T2hPUmHo3lHnuxVyxli9g9Jr4WQ8fOT2jI/tQ7irbOrDd6IsG9c+Ifbsp77sM7zhnwYdMVp/1YsODQBQHRjTgQCsdDef8QROoSkvUAFh64J6vvV7Jl0vLgzi1QpmtgnQMYgh+sZfsiw33YMoTShpWlAvGr2TV6NimqAsyqZ50PVgMqlPgYYliK/bEZMMFR04jkhVoRPx6Jmi66Jidg== 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 is never exposed to nfs and it can't be a swap cache page here, so just drop it and use folio_pos instead. Signed-off-by: Kairui Song --- 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 Mon Apr 29 19:11: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: 13647562 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 3F47FC4345F for ; Mon, 29 Apr 2024 19:13:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CD1DA6B009E; Mon, 29 Apr 2024 15:13:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C81236B009F; Mon, 29 Apr 2024 15:13:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B49256B00A0; Mon, 29 Apr 2024 15:13:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 9766C6B009E for ; Mon, 29 Apr 2024 15:13:20 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 3DF511C0A5F for ; Mon, 29 Apr 2024 19:13:20 +0000 (UTC) X-FDA: 82063517760.27.D22E35B Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by imf29.hostedemail.com (Postfix) with ESMTP id 5C45812000E for ; Mon, 29 Apr 2024 19:13:18 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=XWfRgnK5; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf29.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.170 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=1714417998; 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=54tBEeL3WLk/xvTe7LsTeIRT4DqSpvAgzssbqgMQpYw=; b=TEexZQOg2n/zqt1Um5KEpC+L6J8f9+2zAI84zWSkhUtlIi7RXVYDfYJcronum+Ij0nFH3c GmhLobSA4b4xE/E/01JfZ1SOhkPmF053ZmDLSSQZJDCvwLuoApXKd9sgIKsTG3Ed+OV/ik El3cNLU9BCvn3S6E9n4aUsTZWfRQKj8= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=XWfRgnK5; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf29.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.170 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714417998; a=rsa-sha256; cv=none; b=xB/MqKoC4oDddXKJPlr5yFOAR5cx9pi4DZSP+gns7Yh0X3TiHiknzdFxRgFjwTVUu+GgBM DWAovDCZ9UpOo1EgZxwKhLoQQOS+exVfAPE5Ai2jfZ+DM0KlkDZWYn/L7W4xsYUv2w52je I4GFNSKpKw1Obf8636ykeSfrNKupguo= Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6f3f6aa1437so1619480b3a.3 for ; Mon, 29 Apr 2024 12:13:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714417997; x=1715022797; 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=54tBEeL3WLk/xvTe7LsTeIRT4DqSpvAgzssbqgMQpYw=; b=XWfRgnK5aSMhFgz1Finb/ZOkBdoGlC76CJEX9vX0U7K32wF1GOWB9p5rL+RFSS6EQj kNMSVt/hvRR0yHBPhriCUV1SrficLvqsuoLX5A0ocG1YDnV5oHqtdax1qT0vJJbTP2uZ +5bKj7jSBqA7BMjuoSbQgyhODANMaDfHgbHQlEkeYO2ibpNrvy2YtLgCcxRLabzHkN5f uWQ4erckYXbe8cma+ksWRTZVyi859dgwsApTL9xrlX1zrsk5pxH9IwNW+7jQ2n6DKwba tXtKFj0yH4v0FsMAJGmjGS54KhnvgZDMkqVk+8rFPhC1VBbmK/HrYwEwJJwKDhORCZQl wTVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714417997; x=1715022797; 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=54tBEeL3WLk/xvTe7LsTeIRT4DqSpvAgzssbqgMQpYw=; b=KIio3s75sb3q6eVReBPA8rll7+KcUv69ryv5uIgwdzPP+eB5/hPZbC+MN74BU6EBcy bSOToBw/4sE8G1IHhf0JDR36iXaxrh1ndVvFocBvbJeFg7lecrzS3X4J+UC8Tdmqc6HT EGEj0RwYD2ZHx9vrY7cknymlXTuq7B/q1D1iYTToyPGY11f99EJQ+/J2OpSGcoQ5KFh6 TD6NwdV8r0xPi9HoURTJ4V4iVF1jDdQFUw1LXlhw/uHM4eHBWqRi97yKzdAXFjkHOeuD gEmIOU6e6TlvCV9uB/ECaYSRWZZkbZJhk+hOQSyCfTXmgmxIXmRSmtUMv/nFAZQRS4TD 4Ziw== X-Gm-Message-State: AOJu0Yw+cSfXxUlzTRlWMG8Y/xE5xCIlTH7Xs3ooD/QWtbxc9mHahq+O kCOtQM5X6gb5URMZnfCS/dfLx4kNDd5cm7aBmUfZ8HQlFu9h0h/EzHdBPpkba9w= X-Google-Smtp-Source: AGHT+IEkukKzFyXvcUcUCBcg+pFFl4Blb7KQzrcsvkEmMumk82TvVZAkxzMjSXvoKBD5ECjHeKmIeQ== X-Received: by 2002:a05:6a00:3a07:b0:6ec:ea4b:f07a with SMTP id fj7-20020a056a003a0700b006ecea4bf07amr12308186pfb.34.1714417996587; Mon, 29 Apr 2024 12:13:16 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id e10-20020aa7980a000000b006ed38291aebsm20307988pfl.178.2024.04.29.12.13.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 29 Apr 2024 12:13: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 Subject: [PATCH v3 09/12] mm/swap: get the swap file offset directly Date: Tue, 30 Apr 2024 03:11:35 +0800 Message-ID: <20240429191138.34123-2-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240429190500.30979-1-ryncsn@gmail.com> References: <20240429190500.30979-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Stat-Signature: fy71jxxjmbgb5m9wkob7fxhc37kumk7t X-Rspam-User: X-Rspamd-Queue-Id: 5C45812000E X-HE-Tag: 1714417998-149830 X-HE-Meta: U2FsdGVkX19GYK8kh0cUNL8xtgoE8HB7zb57pN61VuJoP1jewkSH79DJZI4hrj1ytgq1VLyNHZiEd6Z4MEC01Jl8kJ4qVUz1oDsRFcBHS40OPqv9eOpyfkik2+LACGsF241Iadi9y2qJiOVelAdJMq65nmcL3lJb1e4rnxtbIvODHBTAo2wZ+3oIkSw30+Ht6rVmYpqr/+NznPAtwMK8mKHAm4efLLTzJ5yESKxSsTsrxZKjUpEkKpy4w7IerBtC3XxSwR6nYi3IUi202zqvIOCwfwa4xSzBTQA5joV4RyZi25hRvCWrraHSRlng4OYyrIGmsJgvRtdJUr1A6U2SGWIkZI//mDB5q4qrbCCXrSwdOfsmGS9kw58iXeDNGbU3equKU1+s6lrxoupFtrW3rKI0OvBzI2NWPUvCDAXKcKAIFu5jwihndhYcintZy6aewuEwd7nMJlBUmdHlzPeREl0yzAljeXr9A4k3RgRD9vKns17Wb0VOQ7LPCEMQo7s1jRRVUyKAAly3zY6a9ON4ZogqRNeQNbEv9qcrZflE4XWwFmUAIsgQJd9KnQgHNNV5eRPao/ZEApR8IRibgyOea5FU5vtO2DvSI8ISMRrQ0jE/0WhyCfKqkLmx20QrdRyv3DnVXdvhcU/6DcWl651nSGBAfbwgyh6xSOAQIl0e74mO9DyXGo1lzmboCDn9/6AHks4NH8FdVggcZnTLQQQiiYPKl756dCRuGNl9bME66Z9yHwfVpnCDTNNtVS6rWsjEu5AmrwZ9f/eJcKFBi8J3mF4fzq+uOIge66DgRWs6p1SyezEUWa9ZbXLjR23sGty9+h0L4SRfAcS2WLZ4+EtesfkpwDULr7jANfkbSpswk6FDp3rfk0KuVdCr11Euceqc21YcIbUf4Tukkloafll5mp/Vm71sLmt8NNAQnKp3zfMvalMw6mzaj6+t7anl3Nlrx9jtSAhKnCoV/yR3f4F WYCswqCA wJZwFSacMQnCjCRjtQAbpqNQlbOKD2bhX+PA6jkC6Y/ELTMBJP+jxVL7uZHAjFfJUN2G+9y8mhBp91j2lLKog8nJzhP8m7pXDwFPFhEQq4du7x/6LJOQsaj3hf4s4fGLKm64Lp3VM1UIs9J+06CbLlOqbEZ3OEn2XgfHW6eVVcwDWwO+y/JJh5XFd1q/GFz2VpDbd7BsiaDsH80KPeXqmt7VPrbTKnC+EUM3rDOZA222V0npe/1C6qCoUzfxwcI+IfzpkOf7/pO1Z+jyKlbxUIB51D5V1AWr+Xs2Qot2cRddPrSKzVSPD2wVBww/HAbOy4xFTA1faU7xYmrVqGybOkdTK0ikU5n3gWr35iFIXgxcx6iag14jMwJHpDMK6As0lzr53qTNmVR8FyYVMTnw7lp5WZMI8FPOGo+7G3oS8WneP0h0bTKiFNa44Hv0lj2a5iZwgivjubKbt8Ima4+Z6WO8izqeewP8PHMbrSf3XuRurEzgIK7if/nYKRCZOp8g9fFjPqZNBzRb9es2ZOWyXG6AVQP2xQArxPClbl8+0PoIQv37PZZZWrSPmyJxQWDqweYttvvnlEig03RRsAU5cSE54LDEctmOKH+LJ6ptDO9UruDe2eub0vAbBVfto7zOPHhHk 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 file directly. Need to include swapops.h in mm/swap.h to ensure swp_offset is always defined before use. Signed-off-by: Kairui Song --- 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 Mon Apr 29 19:11: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: 13647563 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 4A300C4345F for ; Mon, 29 Apr 2024 19:13:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D210A6B00A0; Mon, 29 Apr 2024 15:13:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CA9416B00A1; Mon, 29 Apr 2024 15:13:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B48B76B00A2; Mon, 29 Apr 2024 15:13:24 -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 93BCE6B00A0 for ; Mon, 29 Apr 2024 15:13:24 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 45977C0343 for ; Mon, 29 Apr 2024 19:13:24 +0000 (UTC) X-FDA: 82063517928.30.B79DBDC Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) by imf09.hostedemail.com (Postfix) with ESMTP id 6E1E714001C for ; Mon, 29 Apr 2024 19:13:22 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=gZ6szn0S; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.215.173 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=1714418002; 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=hcA4nZ293WdWUF1yQsfhWEusCPbJDpQqrWzNvwMbGT0=; b=Xp+LLLTQzGaCAOOmh98+gbQB17ceq56L04A7x+WW2rcCl8nZ49d+8OwfymzFKyiuiNBXui qpaVrBo4f3kMSunVdriox+0ZfJIHyg/0xX+ploJ613skJ9kZ0GDT3p7VokdZBvNanowKj1 J7ukMYOygmAuunyTG3dCA9YrYHfBtno= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=gZ6szn0S; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.215.173 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714418002; a=rsa-sha256; cv=none; b=GYJRjbgxw8hAQ9xjYjwzILWF9uBNI+WmRw0QN5KLFk8td0M14VLTxI1lhawYuBvS+VPuF1 wRKw7Y97fI3KmJZAvc36BtElwPsaIFmWPumiWxLdXX8w5lSDWAR1O6xr/0J1NSBKlDvJfg io9lE5grNdUY9llMgFXSx1JLQV4KmAU= Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-60275a82611so3564618a12.1 for ; Mon, 29 Apr 2024 12:13:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714418001; x=1715022801; 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=hcA4nZ293WdWUF1yQsfhWEusCPbJDpQqrWzNvwMbGT0=; b=gZ6szn0S5+qFJ+5GxfPBPOJlqYadP86hbayu5E3xPxb86fnqBTeVvD4RC8EWkN1JIw +imccwEjJ2K84kCkNG3EEtCdPuDs5zHNtGygSfGkPaHlVKmYDwuPiRvCqWuUDZAYtgRU X05nCQyjTmh75TwABvr/kvqGitbn4ZXfSKr0CCvUisxrfU7HGCb/R8GZ2KkwKZkn+rbt gQdEl8pkK7zxXvj2P+4qw5bb6Tzs+wczSvdje1l/A5DRZ96bvwwLOm0aTQjqOkrOCdRt iNhmbYDJbq2VizAWHDE892/K7uTBFBJW3ii18k71D8ARA7ppPziWFo81A9u3UCs8oyM3 YA3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714418001; x=1715022801; 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=hcA4nZ293WdWUF1yQsfhWEusCPbJDpQqrWzNvwMbGT0=; b=dsmISWNYvLAK3q4tWk6mEYGBq+lr7wNeZmjbgZJz7JG7H2jLkI+n/9mjXb+rreyXgd 3wqUbQQ6jiZDJSUN43NJj6VRcKLOrwDIPzqG/KTuXHw2KyUnQggjsvpDdk4MqBhL2EBq n+lhd4z9e3olci+Td0Yoc0JeUygjUHtgKLQj8WpNOHgvWE4vC4jIXjrbI6uj/KQ+x9fM z69UZ+/t43i0g1jhlMaFMfgFct/6Rd8G9gJN2AFER7YMIThu2Hk6WXw18WbTghWaLOJA 6XJ79E4/895oZ/8HmTSWEqE/A0kNUTFvYVejlYfdhTaxLGN89gQ4A+Pq5HZ8cTFb6rP3 /eJA== X-Gm-Message-State: AOJu0YyyUsoJBb5iG08W2YlpZaEoGIbh0qQs9Wk2MPeBA9Q3hiZdddjo UJVzyD6JzFawuo/WFwhGxX//It6xbmOsTigWO+Pohsmz8gfCecnBJfjzH+oRdGc= X-Google-Smtp-Source: AGHT+IHLvjgAnYI9Ysv2ceA6BnVwlRDqXI0/taYU8YoY6DhE56amomjz9GVryhH/eJ61mj48VwV1lw== X-Received: by 2002:a05:6a20:2d0a:b0:1aa:930d:3dd7 with SMTP id g10-20020a056a202d0a00b001aa930d3dd7mr14861872pzl.6.1714418000676; Mon, 29 Apr 2024 12:13:20 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id e10-20020aa7980a000000b006ed38291aebsm20307988pfl.178.2024.04.29.12.13.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 29 Apr 2024 12:13: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 Subject: [PATCH v3 10/12] mm: remove page_file_offset and folio_file_pos Date: Tue, 30 Apr 2024 03:11:36 +0800 Message-ID: <20240429191138.34123-3-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240429190500.30979-1-ryncsn@gmail.com> References: <20240429190500.30979-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Stat-Signature: tpekn9idpe8uohunf3gps5p694dj8s1q X-Rspam-User: X-Rspamd-Queue-Id: 6E1E714001C X-HE-Tag: 1714418002-99342 X-HE-Meta: U2FsdGVkX1+nZjZIQLPz3CTeKP5iGmOpSFwzkWn/UZtfXwg+9mUn/7jwCDYsC/Mjih8R+WOF5wHWDOVfDTRJd9nWAQfyqJ1vIuWRfP8RhIqOMTEgDxbHJuUyLULxwy7Os4z0jlhI2okM/frg9XmaFuon4Nf1A340XmTnrbev+wMy0B7/9g/fHUmMqPAVX/ZvCO0ghW+ric/Z1U+z6Hs8F/VW1iEE5RHg7v6dUwSW8hwhuNua8+BEuNzzQHyV1ZuUcwy3uNzPpwEKcT8yodEdISW+sjsrCljuRJnJYqGUg2pWEBFk8J+zTtQRZ6yaESC7Ud2s+NBlumXGuzAoiyzgDMqN15eykM4rbVu7ttSq0lXHY8GBI2MrlRdTZqUtdP/YEI38wSOR332lhEBl2d/YjpL5ZvW8GyQ8wu0ypKVFVonjf/R3upvWY4zGPhb72QPmVWoXyDPaKxDP4P9K5tvNw1rqhFLOvK6+WAIicIWt/PixrrGzX2t7bWxKGTRkm1ZSAG9WXHRPIa5CbmVL1+FhGiuX7eR10DxWM/FVuwbRMRxkExtUdJl97c9kwChGpZz3nDBWSVGHnDEALt3klPmHDF4zrSVxtQ/bxbOTbP9lp7kvcWaGOekFSyuavp2W4JrZqBJqYOv8Qpr1mKWVTsrUvBsavWCAs94IkuUaP/YOYM2l0MnRKQT47kPW4n4+TMP8qEbdZwpqjOS5BFz04JlU0Ho2280Csxad5qjVsjxoIEm3weda3qJ/Pn2VVt6nVmN+1c2NiKeG+hDXrOGK/pVARmOwoQl/Eqa0X0J5qE0IsO9Xb36YCPyfCk90uh1xWaNtgU+XLAKqDrpuPWg2gX6SS/Ha7kw/WleEW5xuhtu8nxYPaaoKJn9E36RGhLDoEoqCwqtsFvnseaOmYAQ3tjKcEx7KOCMVm2/Gy+8ujLavAt8zCYc3T4vkb8VR+eUOLxU5oi89Sp5u2QGRkYnN3Me xWv9X+Kk M8KWTFAqfMaBlwycPvm19Viv61qzRLKUVsJmbc7VIlZFCyYtZM3sDjMkndoo1NlQVN43IccpLgWe3qO9f2g8ey3cn8RVbG+bQ341ruqJburby09tgYxV8u9NRkdE8i/tCLjvznBS62CUlSMw8VRXOLglorH4IpAbTeDeUkKT/HIwytuYovg2bqH1IZ0nj4GymJZ+z2IonqCXXiACdV+NnNvlF0cOMNLwEuDt7v8HjeKXC8Srp8tmLuss8lMcYcQOMfWrWM65IedLwyhm1E13eGQ6bOvtKE0ikauQ7yvnFm1ZDBPt74G3/X2d6So/ZbM1qffFo0ly8v+qqVQbE8BbxS2FQRXE2uKMTn3h3dayKoH+gNkoey2u9R7OPG9Y9C7+UQ3WE67kD8fLy6NW1X8S/YsAsv542n1B4x+5kQVbuVm1rUyYnHpdn9oLBa0ATM5KFyXg4OP5oN7obGckkYGCeC88rJ3Rhz73ydG+MWFtAjrUgtQuBw5okTTePSVSV3Bxg0IM8lx/5f++3mhV/dFKVPOS3T1hb9mGrnWnmAytWE+8ROYBU/Kz1853FCto2c3GJFlgAxTFRl89Ko0cXWha6Eo0Y5SnPSn1d6U4XSPn5o6Lj4GHqxqjLop36R1fDdc+qCjNnAbXLPoLAIryZXPOQZOQQBSxRtMYJ1LiQtKkVP91qBEA= 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 --- include/linux/pagemap.h | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 4e85f33721c4..91474dcc6cce 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -917,11 +917,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. @@ -931,18 +926,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 Mon Apr 29 19:11: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: 13647564 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 91FD4C4345F for ; Mon, 29 Apr 2024 19:13:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 138F86B00A2; Mon, 29 Apr 2024 15:13:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0E83D6B00A3; Mon, 29 Apr 2024 15:13:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA5AB6B00A4; Mon, 29 Apr 2024 15:13:30 -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 CA6C66B00A2 for ; Mon, 29 Apr 2024 15:13:30 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 0625F16023E for ; Mon, 29 Apr 2024 19:13:29 +0000 (UTC) X-FDA: 82063518138.30.94CF666 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by imf08.hostedemail.com (Postfix) with ESMTP id D0A9C160005 for ; Mon, 29 Apr 2024 19:13:26 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Ug92qe8h; spf=pass (imf08.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.177 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=1714418006; 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=8QazdPBRgLGfXIr1HFTGvtxzzbA+7izgwNyqAiebQ+Y=; b=sTF/mWtiI+ZPm+qojlUNMkEIr6gM2whzLQZDpWQEvBxXGDoP8f45xesjanvZdQJ49i4wov Iz8x/JSoLvr/gDxym4wBu9bxwsFKxDxgqE8uH/EM+7lLg1oUCyHcPpouqai5NnAXGTKBAy b8fUaRoVlyuyZuS8ssrZq3FsRE3gKCs= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Ug92qe8h; spf=pass (imf08.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.177 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=1714418006; a=rsa-sha256; cv=none; b=wKifPr24UT3XSaFusNn7zh4GfSMT/OI3vQ4howKNP+elXZPiKA3Qkq/ZK8WnDt7swfuYIz q9bfj0QOioHaf4ufwkKZSC1KObQeZfqvK4p6bHP8vfwAcVqeLgupJM+H5hkXs+z/r5OCFo 7fBfnGSP2kJbqJCyWLNAw92CBjs1VXs= Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-6f28bb6d747so4144687b3a.3 for ; Mon, 29 Apr 2024 12:13:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714418005; x=1715022805; 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=8QazdPBRgLGfXIr1HFTGvtxzzbA+7izgwNyqAiebQ+Y=; b=Ug92qe8h7VnDkN34uLk2vx6Hkc3TbWzbI+Cgkxz3sR2Xd22fXU0+kGvukQd87Z4dm+ PMZdMBJgZ+4+EpHtt9x7xtlEe7TAoeTU3LjZDIQfo6yDr7V2vR7iCrmnCGuk+aqxqpk/ /VMvz/oWObeLg5eJNZOY85sYpobwC4Nk6lf71OXPl9u/elBmkuN8+XwmZvl+tlzSM0rZ r6tkeICinDt8bxvVUVS/hk6joV/qe/3N5UyhEjzq+Xk3l+jlymenMsHBtUeMZgB8qRmD jGuFDWK8Rgh3oui60NYn2kkL21E3CSDM57pefy7ckGUEXwbw2AhLimuCpSMOevyk6H3K mEJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714418005; x=1715022805; 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=8QazdPBRgLGfXIr1HFTGvtxzzbA+7izgwNyqAiebQ+Y=; b=BwHyQ+LQhbG/M5I/J8kX1Ne4eU74SKpQyF/ThqErIf2Dz8FLfSzqD6stWMSkbX75Id D0VSLugmuQRnUObmo2WZInBbFgcngEnEyJ43nqXvR/8iWGNBqOnd6OqFeMnL8SrJxSnq kO+O5IhFcisDTmRmJptjykd5QhlKxxDDGfO+2R3wv1BAYj+U1NfLSihdYeuY2B6NRewc NTc1Up9/NnrrZjv1GcPgvpHhoFSuWO2rgtx5ukoeHxqrG0U78rzjtFkrEiOFVgBx1q7Q Ho0NEdJdYqoIcUz9T88/aRip21Z4kb1aKhToZZpPOPtaqqYA+N13408aLVA1UVRjpAKo RZEw== X-Gm-Message-State: AOJu0YzySWFbyqyT7kgfS/S74HhU16EAtN05CyXEmfF+X3xRewQL/jMT UTjdq/VT9P4APPdB2ZfXD/jDez5YDdJcnyRaKmwyxFqlhoTWv/Gjo8ss0mtqnmI= X-Google-Smtp-Source: AGHT+IFPOFbp9pmt2653zFt0UEbOTrCGtp/cEwxyT9UheEYNDjImTX/zaDPWA1WmxxbAEpNdjTgHPw== X-Received: by 2002:a05:6a00:21cc:b0:6e8:3d5b:f3b1 with SMTP id t12-20020a056a0021cc00b006e83d5bf3b1mr11062453pfj.22.1714418005131; Mon, 29 Apr 2024 12:13:25 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id e10-20020aa7980a000000b006ed38291aebsm20307988pfl.178.2024.04.29.12.13.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 29 Apr 2024 12:13: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 v3 11/12] mm: drop page_index and convert folio_index to use folio Date: Tue, 30 Apr 2024 03:11:37 +0800 Message-ID: <20240429191138.34123-4-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240429190500.30979-1-ryncsn@gmail.com> References: <20240429190500.30979-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Queue-Id: D0A9C160005 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 5rkwogagid5r16e7g81416wqzn5twndq X-HE-Tag: 1714418006-985101 X-HE-Meta: U2FsdGVkX1+fIlaMxwiJiguidWRt9aTDKJMiQW0wacRUU8l60PoY1wVhvr7PoNqCRA9OUphdHMXe4+ZEb+vkOpFYUoZA5XvNohFccexfL1QpTlYiMzOoSGRSU4C4FU8z/EBKai7cuMvr7JaZPTe1ugKbA++D3MxewP4twSyNs8uwQ2hvyh93VgQdODLgYiH4IPghExre+Ts/3BFPMQPAB6ur73HvRa8m2bvbwOPkQZT31Eb8U1Tiekp7RteQLoC817kjNhqB7zDOhQQSnzAPuHNvXvEoGL4/RysTjXr/HLgJ58IQxiZGdcIN/51YM9Q9fuLmsOneh/1MKLWqebJBvHra74dVHrQU/SZXkIstVzEU+sq3PSJ/MYohS6FVhi3pQqZybdPIok/o6xuBkK5OmUkuZhGKtNpCh4ScLkcLLpbam0H8QPxOLhXcy8qIjrFhWSg0rNrur5tq52r06HyubLssQAoHcLGS/t/7fbqzHCzhcHBx9S9SJcAGJKDwyb09m9NqkYy7pdy9jmqa6jVTmIKpBEv8ljAkbkWj6mdZIbCiqGx3H/x9kcwQA1R8beCyNZjQfZhHO3egEezGQVpJFWwgNBsfjl5qj1XuhPcan1OKAel1ldh7TROhY0jD7ThYm8BoeZ6H4fcWIDOjkxu/Q5bFxvSblAWW2akjEfa6PF7aKR+H5/HHFjDIcLkU1Nu2Au9T+jad7qTjbwhhNyJoLF+UlqXT3CydRKCiPs1Hm8cnEGEd6l1IFkZ/1mg4PgaW8DFtDWK81zND+g1HIT0eFlQ6QDUja6j7EY2GemwB9dtB3/+/6PyAx3U3U2u9AddlNY0LiAS/izpVWV+sOeHs1RDDnYIsK+O03eO6pOpnL4Vl4SrXipTvlY2Bl7isauAehcBFMavNKNcjr6ofNEOUa5gAJpNGaNaqmTr12owqtl9bXI1g/+K5D1ASdhiMp+GNnnUzN2dydY0ixbR9fyZ 1xGhVXRZ K71FDJyc7m8flhKyUG7Vcf4jNBh0lSQp3zaO30lkl9em+Pk1dbgNT6gYiHZ8GVk33R2bhnpZJZ0MbofwlWoQBibQmaZCiy2JpFI0E6FrnjLUU8qwfC7xxFEStqoG46WUML+/4PZw0qKXkBzhrifRX91ho4e8qJ9LOsFVpWIhL3Y5AaqXTofngquF1Hnlar8BDioXCDlijqJ1kX4LMfPAU+6LElkUdc62L2urWHuydpisuWWDpOVAsMup1ndUdnBtZKb1rAGsBl2nClHmw8fxUUraQFkc4YazEEYb6olFdgJ/wb7RHZCv4l6uTu4wh/GDvvUBh5fXSfsSvdf1Gm703unrtUvYQiSW/K90X2NvmbXY+fnH5QYStswi82ufwxa1i2Awy0tpyKGIDb/V4Mc78bpVpGsSSvGwkMo7WbteAAX7lLK9h87RdmNaN/iQcSATGjLTbzi4sIR7BH36F/8YEuwq12RXjMnyrVlYbc0wb4geCnwc/URp+RIyGHoveXzECXqzIzEkU6fwTivlVY7vfn5Atf9drXngwMkbHxSLGuY90++aFEEYhwn4PAy11EI73u7sZY5W1xkU0T/KilX3H70nysevMzKn8w3sJGo6Zg/HN6TLEFhhiRbj1AW6gHUD3jD2YGPZPmmP2+OIEIKk9cHoXPY00vNYPrCJhY5Tw+ikKI3o4Q2DG8F/f0BlzsE4NmarvRmdVEHEZsLIP6BVNLSqzI04H6uDnXYAF 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 91474dcc6cce..47171bf20b53 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -777,7 +777,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. @@ -792,9 +792,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 96606580ee09..6f028262898b 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 Mon Apr 29 19:11: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: 13647565 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 0FF2BC4345F for ; Mon, 29 Apr 2024 19:13:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 94E3C6B00A4; Mon, 29 Apr 2024 15:13:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8D6D26B00A5; Mon, 29 Apr 2024 15:13:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 751E06B00A6; Mon, 29 Apr 2024 15:13:33 -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 522E26B00A4 for ; Mon, 29 Apr 2024 15:13:33 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id CFC3DA0179 for ; Mon, 29 Apr 2024 19:13:32 +0000 (UTC) X-FDA: 82063518264.21.F606C1A Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) by imf18.hostedemail.com (Postfix) with ESMTP id 2ACF91C0007 for ; Mon, 29 Apr 2024 19:13:30 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=aZCjxFZZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.215.181 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=1714418011; 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=PY7g2cpmkbLDRH/cw0JP1fam/luoqXTBgJ66zM17H9Q=; b=fRcftqzZiGDz0FbgOxrUK9jc+Uj89tENEBi2ST3CPV7OeYQg44rvzPTb9Itfe9feJMpRK8 4Mll9vwgPmS8VJAVU5TSLQBFwAUIXV5YGW5HZoXgdpygN5vXgy6OcKHDu4fQmA4msZ0HYf BnAtDeUb7HkzUwZmIyN/x7ixGfCk1pw= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=aZCjxFZZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.215.181 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714418011; a=rsa-sha256; cv=none; b=PVHpF6aeWlfLS7iYQi+d5Y+WIZXPQH68zgBJp+zBY0IaVD92F9s/TR4B6UqMdj5URHxTWr W4TZFLpIu6vhakVf1/3W/blDTUkaOVOGun9+zJtEwrPZI6hOwpfkgCCvCDjyupUWJfpbG6 ac+/yedxumfFe6+2okTKPpRN0CuWqzY= Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-60274726da6so3280896a12.2 for ; Mon, 29 Apr 2024 12:13:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714418009; x=1715022809; 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=PY7g2cpmkbLDRH/cw0JP1fam/luoqXTBgJ66zM17H9Q=; b=aZCjxFZZuAWyhCm2O2m5FbULFAjjnc5nEYzE9rd6a1retn41VR6rkl+1K8Fb6UpK4M aHppB+/zVZVEMjuqO/T5TjK8tHfe3JC6fZ5udzHt1OBWC7VBat4lsLqqb2eVDkMvse/Q hv7X9qxGZWjWufkmPXcSJRSyc+trNtzZllcpl0H+xTRmUgXDeefwdqXOoXqWUE12gZti 8W9USTuEai5w7SlWv9XxkiwMHSHrL/J+QoF+jCXmVUDcYApNBuJsdwemWETNu8t1guLH SUAIAzHWDY2SYSyYHjoB/JiunmYthn3TE/4rJIYWmnf34AWTNO3hiXDBycUQCWVuCXtL s0IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714418009; x=1715022809; 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=PY7g2cpmkbLDRH/cw0JP1fam/luoqXTBgJ66zM17H9Q=; b=hYvMXADf1OZK5RntUReuDN2KaOv2pTUdkwGfmRtJGcFFHgt6mDVP4rOU1Oj1MrJnWs rK9TGEgRhhMAnY53D5u0viiSbdicvm9EtcVq/K7PVylrBV7l1ZIYnpyxCg30Tt5N0Z4z xjEPGt9dKXXkF48cTQGokwnd8nhOcIhe02SXrC5tnXNl2OdzdzxOT99g8cQquhWeFvob FKzhtHurumhnP0xSi97oBiWzwaxIGPdCme242WK1nRj17DG/MsEe1BZLWo+wia5CGE0X Tg58XKAlaN25Zj91JF3j897UVYM3zekiC7jk2xO8qJGBRsdSBOH4XdyxpvT5wG/rGeGj BuzA== X-Gm-Message-State: AOJu0YwNoUnVSV+es3ZYwEQhrkre7L4MerhDBpwG8Sj5PyVQGkSuY93g uDip3R+2bdLTbbFsM1HCPaQbXf5W22OZWn3LDSX8avtGwO1f5rEe/Ha0puJi0Bw= X-Google-Smtp-Source: AGHT+IExOJ/p/bJW9q/f21ksPY2gdiW8nSTfaSxNTc1Poa54zyXrIO+xTyTWMo/yh/qLCiK2/+zrZA== X-Received: by 2002:a05:6a20:4386:b0:1a7:ae5d:5fb4 with SMTP id i6-20020a056a20438600b001a7ae5d5fb4mr15127477pzl.28.1714418009348; Mon, 29 Apr 2024 12:13:29 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([1.203.116.31]) by smtp.gmail.com with ESMTPSA id e10-20020aa7980a000000b006ed38291aebsm20307988pfl.178.2024.04.29.12.13.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 29 Apr 2024 12:13: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 v3 12/12] mm/swap: reduce swap cache search space Date: Tue, 30 Apr 2024 03:11:38 +0800 Message-ID: <20240429191138.34123-5-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240429190500.30979-1-ryncsn@gmail.com> References: <20240429190500.30979-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 2ACF91C0007 X-Stat-Signature: fcmpu5k8nfh58ij51fxhe81ubx9j6bd1 X-Rspam-User: X-HE-Tag: 1714418010-541439 X-HE-Meta: U2FsdGVkX18ULJNSyW4eVDpL727rRzjKtQo3/IEXPns2Nx5tkb+1uxspK1idGbodz7ihBdFvKzaaUUZ4Flf0D7xl6KaM3SVocP1iix0hhnDBRFDEEsUWAJp96fzxJFBUlJTmBeJLUK+hkdoqbPKtP/5kYyJVoNbxH/JnybyYMO+IsEZb7oiWepG6r4/JCirjlnEnH7PqXkdivlsD0bYZ/04cb3I61jL5Nw4NoBZTxSzVxTlB6/GG8F7htulOvQ3qDqFR7eHwYgG1x/z88bd3YtxFz5CSu9ysj3dPnYLR6sDNp4OCbE/x8hbjqMFctzQgw79753aSlZPCOq/TEzeGyCkf95wYGJbDENCqy5IU+Lm3U2BeKy2hqZ2HTDDdBAZhSVm4/gzT7Y3+0XDtLqqfisLTVCT/8p6hfzJVsl1GMMuhwt1IjXOJPt4vrwncSM1gaphISoRNEknfyMeKvQxTqcZANG2dls5tQSO7Wwp03VnaDpnATOjwjvrVWfZ6+BYklNqJNr86C/Totc9NRXqI7qZHA+GI0k+k3eZqPl4QUFibhBgwYuXnmpmUsSCO74xhOVengnAElIXlgjmPoLl12u+DEAIlaz11jbKG8FDQ4syOwl3C9n3SM4bcaO76oPzih4dwzrXrmFt/9MB0CJl0JxzQIpRAa79wFZqTOqlN08eDSghQE2R4a96KgofrzbmTAFCD2NtlOTXYNatRKfeh3rvax2X7y9TDT3u4G+ESiBccPy3poM8FfIqgNybPujDYaK5FPv74p90bGpTMjGkDwAc5mEha3LehcwN/G0RXBypDP7JYgboF3xB39heMccwbLMb9nm/6AtQc5CE+g8vKYqCiD8EXZlf6ydeqx+IMl4ivp4IWt8bzHL7V/oiZsUkUUrtDU7jU/PUWpoEYgKVWY2HHsRTGC1DUy2tUO9O8vC+9D30EHr9YFLYLNimsb7l4/1XvwraYNIwKI0cDX/9 MG44ydzm 7+8OMv6Jw0WR+lCx7Mk/1wocXxpplCULRr8e3eV/iYVhzo7b20fbHKs71D1Hk0KWPT+VaAQDKqOq6e8tDDvqR1A8jS5HuItkdssFj9KwyLY1xxhjF/0CBs/x/EIfFsMJi4B8zyyC2cIUNB8o5OSN9FU8Brj/9bAOWek0wxROapcKCUHQwOVE1VKneJTYbKmIGxweNvG4E60tvU6KuFbx6YDaBxV9wzZt2J7q5SwuqvYbvRw6xEf1UyOgG3jql6mrzpMJHrHAKX8gY8uY= 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 big swap file. But when doing swap cache look up or insert, we are still using the offset of the whole large swap file. 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 we are using the offset from the whole swap file, so 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 | 12 ++++++------ mm/swapfile.c | 6 +++--- 7 files changed, 28 insertions(+), 13 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 8261b5669397..d0c6d30d72f2 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2841,7 +2841,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 602ad5faad4d..8a75eb6c86cc 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5983,7 +5983,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..9994b8d17741 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); @@ -350,7 +350,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 +420,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 +447,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 6f028262898b..81bd61d0a7a6 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);