From patchwork Wed Apr 17 16:08: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: 13633565 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 0D335C4345F for ; Wed, 17 Apr 2024 16:09:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7C0A26B0088; Wed, 17 Apr 2024 12:09:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 773726B008A; Wed, 17 Apr 2024 12:09:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5EA006B008C; Wed, 17 Apr 2024 12:09:47 -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 436D56B0088 for ; Wed, 17 Apr 2024 12:09:47 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 00F0BA0EFF for ; Wed, 17 Apr 2024 16:09:46 +0000 (UTC) X-FDA: 82019509614.18.F16ECC2 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by imf16.hostedemail.com (Postfix) with ESMTP id 465E5180024 for ; Wed, 17 Apr 2024 16:09:44 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=YUkudALL; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.176 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1713370184; 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=y0geSoIc+jju+yQfcQUINlDeMzhHTaHXzJkIaR3mmqNwwcuUkM0jjKPr6ULWPFJSmQUb9q qjDsrNygPOLnFK9iQ78P5db3BFyQsKo2Xnk2OrmB2R4FHjVW/zqeeWvgRArpn7DVPomMdF YgSp42efvaBQjJrkSROHhjnENaTdKKs= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=YUkudALL; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.176 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713370184; a=rsa-sha256; cv=none; b=MeIBZ+OBMtfJCy02bLkk2tY1EpSudgvjgi01x7SkNUuPrabqaHjaAo9qMvBcXj63f11lr/ 3m9zECApdaSYGn8WZ92cb7fiEcB+KJ/+jD/7qrZyVQLyLIcOKEsrjzum8mbJlU1NmkjCt+ FATla6VtvmG6sMs38ItIbDVQQF7tt2k= Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6ed11782727so4970843b3a.1 for ; Wed, 17 Apr 2024 09:09:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713370182; x=1713974982; 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=YUkudALLPzNDj19NEYB0Rc2oLuWoDpYKg8ALok51pC2vkcQabOt524W4KyrTM59KbU 9FJb28Kv9EsjjNoZKuxaoD4UnhCp3ih2LumOk4h5zUanKqTBLxinCG/ZYFWqCr7Sl9f7 uJb8eQm2eYlElb5nOKYWWcJ1VFRU6EiMhw+acmWA2Nk5nb0BaqfiyyPF/ge0h6432UIB wwVVOsm/2vxUnqeDvbcajNUNq81MBjfASvE5F3E+TehXzuygdYZz1Of9Pj+AH7fi7qdZ J9DcUv7lZn3TloAJOfoIwHdPkkKM7T6LN3QC6kYKrADIZNIVm2YX2VEjsWHebaYdW+qT Vsvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713370182; x=1713974982; 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=PBBB/jqW7f+fM0SPPu8EXT2vIFvNzPPXv8vp888hN3KWgrFMDtu9My5bUj0+bxlluj d9SyJzP/F7NqFZYleOcj61zd2gF/dRD6aneD9zOfVPTTBD4VJ8493X2QSJah25ZYMEn4 S7Wb0Z1Ek8TEwE6muVisALufLsst1VBNWMi0SdefW+vgVPim+XUrlWyvALHT+ZqC3/KQ 8cY6J/9wU+F+TquvrQ9bCOKEAOVWuIwXPEnPQZbbBhZMVxYZsuOZTTESkqMt38Sxrpnu hEzVUaw1ctzMPl5cvQwXM60zp0zlmXhF/g3Gq1HrLypB6DU4rlc62NxLzW0fGs+TmqJK pVfA== X-Gm-Message-State: AOJu0Yyga+vWsjQ8xSuCQG6LTq8Ij/qaYAEfdFdUnyH4plQYrisqnhjb AxFO2/rTDT4PBhWzUu47EYbNGU7eeoh/0s7ytMtCeI58UA6XkPCDQBc9pQ9yc27aag== X-Google-Smtp-Source: AGHT+IHADX305+lhsZl65TBVJfwFNnUajwhJ6mgc1Rrgzv/e0DGcheSabgx4i4+AnxNft/shYQftQw== X-Received: by 2002:a05:6a20:dd88:b0:1a5:6a85:8ce9 with SMTP id kw8-20020a056a20dd8800b001a56a858ce9mr71965pzb.12.1713370182271; Wed, 17 Apr 2024 09:09:42 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([115.171.40.106]) by smtp.gmail.com with ESMTPSA id h189-20020a6383c6000000b005f75cf4db92sm5708366pge.82.2024.04.17.09.09.37 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 17 Apr 2024 09:09:41 -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 1/8] NFS: remove nfs_page_lengthg and usage of page_index Date: Thu, 18 Apr 2024 00:08:35 +0800 Message-ID: <20240417160842.76665-2-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240417160842.76665-1-ryncsn@gmail.com> References: <20240417160842.76665-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 465E5180024 X-Rspam-User: X-Stat-Signature: d33by3fzos7htz8ru7ku7atuk38j7gnm X-HE-Tag: 1713370184-220858 X-HE-Meta: U2FsdGVkX1+du/2otibfS/VuJqE2L++gIH7wHBZi5h5SCLE7v6LYXbgXpADP2w2qDl8M+3oxBt0gsbiQCSR6wJEkHnZKJSwyNTcepWQgGyNUM63Q4tvAPz/TdPdjaEF3O9uAMIlk85ExZxV0VqppGVx+kRWl+EbSMriO6iJrNUQaBqKnKENiNFvWRwvCaf6SJ2rwfHD/FfUPAtxzkVuLXtMTL8JjYZK+B03pLt059rwgW4qmwluwPob1RkJfhmyRHhikZs6UfhHZ9Qxd0k96YPO8K8hEA/b3+T3TTSGnXbgLsm+pMchOoiOOJ/i6WW97xOO3iUpiaKJQ3BKZUnscaBQ7PiXf9oc6d4ewoLJyjc0noHb0aJpDxdEXmedzBcqPKwSsTAcNLM7uO3mEIqWAgnhs3K1/v5l/vqx8kPXYRYc0aNrLivmm8HOYzVBRqULs9fgVw6rIIPr+V14rFHX1kMMP5aF8Gmv3DVKAOp7VF0l5HGIFN0TCOaeP4J+9ih1mL/iVWXHjGCHFiFRgIbGtCVKm4Ao3hRSwofZkZpegLKMyKk3vRhaYQ7l4ICVQ0iLJ0epGM4rNOqN2agYMMffikC7TTGZZ4v1YjCXWf/rFRHc8gCAZsMNxYhy0NMI5uttKcZ8ENOYGv8hivO4Xqf0A5RrqZc3egrqtF3KhxxFZLfQb8rhpaXmK6ZAn0uhIFkeS6T0cELsljUJFSG4D//Zeye/ptNSVx7BZbW2wjwtbU/lmXmYE1Pnt75XI31TtrL6z3/uBxVlzfwGArFMEH9xj6XpAIYZM7vZlbSmWgeaT+HmiTVnH1PP5SSvknPsI/uB9u1Hl3X0acWT5FaXx1OayuhlM3jaPWirHWs7lmOgIhjZhPtWNNYEJltrQ7r2AwMFrOQImhDq7YCE21FEeYcHGJ5YoNDc/aXrZP7L+HCAW7ShPfOPPEu6Fo59VI7A4uSQVQ0n4HsIUqeshww+1xCk U0zJ+sQ+ KKKmSXs+ktW4yeGozM87ETydhyNo19qIc/gvlC9XKeOAypv15A6oKwhT9x2cw6LhJmNvCfeoEIST8Cnfnti6NxfS99OErInFN52jG6c/xx0BOeHlYI9IjrkaS+NCBFWL5EkvqVmSR2CfKOq6yii6LSt9ixOiaeGp922vkSeFFkWnAy258CUS1khzk0ICwspJFTVANWvhPXq3voxB6mdnEvCOKxW0pq60Ljn4MibZKadtcePuG3ck3SSgNVJ8cebqoFQd6ntPFoOvV4/WuLATrxFzB+dt/6VFuau07I/7b8jh+4EtmeproCmzqZg== 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 Wed Apr 17 16:08: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: 13633566 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 D625EC001CC for ; Wed, 17 Apr 2024 16:09:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 661276B008A; Wed, 17 Apr 2024 12:09:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 610F16B0092; Wed, 17 Apr 2024 12:09:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 48C516B0093; Wed, 17 Apr 2024 12:09:50 -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 253A96B008A for ; Wed, 17 Apr 2024 12:09:50 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E5CAA80F26 for ; Wed, 17 Apr 2024 16:09:49 +0000 (UTC) X-FDA: 82019509698.11.2A0506C Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by imf11.hostedemail.com (Postfix) with ESMTP id 468F44001F for ; Wed, 17 Apr 2024 16:09:48 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=D8VsMktF; spf=pass (imf11.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.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=1713370188; a=rsa-sha256; cv=none; b=teXhwVr3ZWEXLjDHv42HD7p7Gotz/dnpe7QTPhnXeIO85B0wVTk9CQXqeZOew1wshJ9cE/ TurY3MPIsEVAWIRJA1GyKzrVE9JrRcoR7NatccpWccVtI7RGxUDI6axPMneu7BTwOlHJnM w94CiVKRDp+5kxP5yhGxZza70K5lEAk= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=D8VsMktF; spf=pass (imf11.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.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=1713370188; 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=EKBCpzMJJOybw3E+mN0Qu57krGqjseTa24mZvlKHSk4=; b=PxG2YxMCKNY2vTtQxWEbVzKSlBw5BIWvF3d2jKr7oez3SXls1WynBIYGCAiFN/2Y+sHOpG ABbEQD6QH6r+9TIoPmwIcn4DKi7ZPoTYas++8fdY2K0WTHBoMfyvgvfgm6Q9wNMqX7+4ja ZiVwk3NlgJGXs7TGxVhu5tc/aIq7SYk= Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-6ed9fc77bbfso4517522b3a.1 for ; Wed, 17 Apr 2024 09:09:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713370187; x=1713974987; 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=EKBCpzMJJOybw3E+mN0Qu57krGqjseTa24mZvlKHSk4=; b=D8VsMktFQ4XClAvrNmAwmlZGc8kRUhVthpUu0Fc2ckXaCH+ZHJ6HcVfRADP4wtOTkF +Phz5Wv1FPUDpjVQKTzfSRxpE2R+9PTVqqn4tF8K3CUFt+21F3POnMiRMNWB4I1mqqCG HVasy8hQrCJtB9AeQ0srMPMNGMKy1OHdhd10JFd/5lUsmpbvkRUGSgbBfVn3hPxSOaQl gq4x4DpSleqapOy7MYzgmIDAu+rQ8a2FQRtHBjhHVQ5G4J4klYoCk7sS5uMW/JTCU84m dSCHQeBMVmZS2kQK7RiYmtSEiTPZQ/hWbLJnX8sdCesi8RLwHJWnp4mlIWU1MQcYbWln 7GKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713370187; x=1713974987; 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=EKBCpzMJJOybw3E+mN0Qu57krGqjseTa24mZvlKHSk4=; b=jXTZU0Mhsy/140zyv+atGG42V0WVMab8q1U6TAZ0pW2+Y2UPlEPrvJCfeNH6q4UWM/ q4L6iETpZkI/bD1VPihavmDcfxlLcaha4NVIrVUl9g5+kCZEvTY99q/PrLsL4uZI5DHN AG5FnN8r3pEkO4C7o9AhhDDVQ2Qdg0zSl+UUlo5xhdosq/2JSfaVORe5Uh3twcgsmWR5 l3KivG5y8yvkwBjU1D5gedLjU0p+5ozDyXvUJq797UExrf+lAvk1racsgq0I/C4KmQ+8 xBdxz4fbAD8lL/TktKPi6yKkvwcSTDupETp2M9YigcquiSp1p8Zvp9sZI4Nk/EjmNstC U/TA== X-Gm-Message-State: AOJu0YwA7/+PEM6+FboK4iJm9Ik9/lclorWxOCMTGUe+7SLEb5Dl2oNa FPBfrnxux8W8nx/uhd8sU9+Fs3LAIe2lslRm5z0f9cicF5dVmmM0ajbNRTIE0IRKZw== X-Google-Smtp-Source: AGHT+IEUIsD2UfwALUBzZ9zgNwZkhBtp79KdHPB59HWhpiWeEDWZ5TAduyfuawXCnxiRfUFyeMAZ7g== X-Received: by 2002:a05:6a20:1042:b0:1a7:a21b:66f9 with SMTP id gt2-20020a056a20104200b001a7a21b66f9mr48906pzc.43.1713370186696; Wed, 17 Apr 2024 09:09:46 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([115.171.40.106]) by smtp.gmail.com with ESMTPSA id h189-20020a6383c6000000b005f75cf4db92sm5708366pge.82.2024.04.17.09.09.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 17 Apr 2024 09:09:46 -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 2/8] nilfs2: drop usage of page_index Date: Thu, 18 Apr 2024 00:08:36 +0800 Message-ID: <20240417160842.76665-3-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240417160842.76665-1-ryncsn@gmail.com> References: <20240417160842.76665-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 468F44001F X-Stat-Signature: 93doose1akkmtqjarxyh54ym4emmmdd8 X-Rspam-User: X-HE-Tag: 1713370188-183332 X-HE-Meta: U2FsdGVkX1++uZ9Nk+pmO1wSQPNUHUVE504KwZlLm4z4FFTM5trrOPPw/SsjdRtzhlSdE3s13KCNddlSn2hGtlroUmdum4HgDNOVP4A2XLfeYpZPvFANy21IQGzNVz+x0fG/WoBjbaAEj99fyVuFHMKFZw7ZyLOQqxCm+Vo87k83UWVjbB8eWy+6+OiWrECh/+vd7IinOriObn/W9E2aDxdhN44NyQIgE/4q3dhmFWS2D0L0OgvuS1x6VJAscP98hyDpjxbd+JIYxrRrG5e3+PalowUIMpw1LbGXE9SlfRgohrTRGwpEXAN2Hi+1Dx/gw9Z9cWzqVo0PHQ+AqXHPmv6DQ3lhf/+dnBoHs408YNSP1FVs0ecshq2tGCutZmJ4lo9xpbZkLHUJqHYt7UDBNAQr+M/RCUILvIedocwvHRof59TeX2Q8Bkk60/iAwYZsDuxg3mBZiXA8c/fBNWw+U7YKarDdPwYLMssY51y61W9g3B/DXeZS0xPS2+niG+LEgRzQf91z3I9Dt3vCWeI8kuvA721y1129Ytr5g3c8CR97v5RfSoh/hQ0cJLnv+pdNwx9QtoaMTHbkFtvAdzp2p/YEv1Ky8CpFkGEO135BtIIZEbS9VRjIaj70aDQsKtDrEbjxeN5W4Nj3vRzKZMGZrS/1IGCgV1UHIG0BO5CUiDY6gqnty4giqgwh9GbSEG3egePhOx+S24TOugf31voqTT09yZCoGxDjo4qfQL7y3cvDjYgjiIosbuwbm+wUjvvyeAGrY1fAd9UHCvLacG2jjySv+SunwTSroVicLhtntbiKBwuaR27qoe4tyBUgmO2NVqGJXYlaGxXUT6kZEIzyIed0SP+keBPwwgwMQZ4Hc6YqLGF6fT4JA3JdWOO3tnSzYVoNqJBCOtzGPer3dV9gC/DFLztKjEiq7ziX3CK+phLwMy0QwjrXjXKfRYAE+LsTufxwEWmPDqgTeiAJNmU ruS1zb8t HoC9oNO0UKx5OoLirWyciHTQ1T8YHtWTS9DVWRqtZ/5kNmo60lIQjfFPi0KE8ale1QSbaGmUR+5Hwp2hReSuOxtTwwWoBZyqmJoMTUVJyPPHayw6daOoF6geBeA8F9pFzbArv5j5Y+KeN90typ7Nh8pYlJI84gUCJQYwanhNca1LesEGfY+ptx1LR92OSko94xCAD7YOhglr9G4ahwx26e1idJFzdvYlnwV99hWDQnt0h6OepWeYYCEriFCoaV3OB2XRG4mFYFlI0Uy6tuufdviUnabqEWTJ3esmXWXIBfFiBnqTKlrho6AZ5h+n9Lgx/yImfA2O8oTJoG4m1AkBBw+tML79qTJSu8n3S0ZQPsGFbWg2MWvxesDmkZurKoLhdKk0C 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. Signed-off-by: Kairui Song Cc: Ryusuke Konishi Cc: linux-nilfs@vger.kernel.org --- fs/nilfs2/bmap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c index 383f0afa2cea..4594a4459862 100644 --- a/fs/nilfs2/bmap.c +++ b/fs/nilfs2/bmap.c @@ -453,8 +453,7 @@ __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); + key = bh->b_page->index << (PAGE_SHIFT - bmap->b_inode->i_blkbits); for (pbh = page_buffers(bh->b_page); pbh != bh; pbh = pbh->b_this_page) key++; From patchwork Wed Apr 17 16:08: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: 13633567 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 E6336C4345F for ; Wed, 17 Apr 2024 16:09:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5EBB46B0093; Wed, 17 Apr 2024 12:09:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 59C376B0095; Wed, 17 Apr 2024 12:09:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 463CF6B0098; Wed, 17 Apr 2024 12:09:56 -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 26E2C6B0093 for ; Wed, 17 Apr 2024 12:09:56 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id DE06E120D03 for ; Wed, 17 Apr 2024 16:09:55 +0000 (UTC) X-FDA: 82019509950.16.D3B5652 Received: from mail-il1-f174.google.com (mail-il1-f174.google.com [209.85.166.174]) by imf01.hostedemail.com (Postfix) with ESMTP id 0C30840014 for ; Wed, 17 Apr 2024 16:09:53 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="fIuEqIg/"; spf=pass (imf01.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.166.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=1713370194; 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=ccxP7TY1LZd03lAzTUSjd/WMiiw2l1TFGZjibmTvaRo=; b=hGZPnHwWikZd+xzRo/p0/IkneLyk2BBA/MYpSPlOcivtRkz1WJZGfJuhZMK4LtPr401DI+ nJqy3+2m3ZV2kYELd5WFDPX2riQ9GrzGRPU1vcT/E+8GPAa/eD41OhAP+0ym2tYvP1JABs ZJ3Kmduq0ulxuEoa31xP0wPyl6Btq9c= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="fIuEqIg/"; spf=pass (imf01.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.166.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=1713370194; a=rsa-sha256; cv=none; b=AchK6e/7x0fx9AVc8H4UCkZOvf4SjhBjNrpeqkVrDx/K62tv+WQz/jUkDULOYhxtjAipmY fRXEAyX76iXwQrBWwoZtOvqxqYJeFC9Hl/YhrOUcl9BAVoX/v4/WkiDaA1On3RV+sX8b1t dEiFCVehqpcXOs7vGGQvM4SqFUuxkdk= Received: by mail-il1-f174.google.com with SMTP id e9e14a558f8ab-36b38a2288aso2556455ab.0 for ; Wed, 17 Apr 2024 09:09:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713370192; x=1713974992; 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=ccxP7TY1LZd03lAzTUSjd/WMiiw2l1TFGZjibmTvaRo=; b=fIuEqIg/Jv0GjsbI5i2p0b5f5CuqEQnIFaStS7hTArfsO8ibrVRfSWrl/zkeKBQqUg Wwil46YEUBH5j2oFDStJKhM/PYb4OMt2pb0wI7IXMKoCNGoO8i3WIg6fFS4UTQtsFIrI b5YPmwrwifgYynOK3s/roKfA5A1gBLLyxVRUzc03sN8KS/o1A/6DuIPig17caVASi73V kuT44o8bPvHAYf5aE4cFPmcUOhhxK/4BbVXuEXLJRDlJkq3CUYur7OLMz8FpT/3J+vko c7guJJemye1WhJR4qsCMTZDBHZZNdTTnoMuFi8+wBe3w9Vc/AUGI/vlpI6NvtLsV3tnn leCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713370192; x=1713974992; 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=ccxP7TY1LZd03lAzTUSjd/WMiiw2l1TFGZjibmTvaRo=; b=OsSNNynTmNZ1CgfN8GHIYSpQB/mMvvekSKMW1f3vKl4gmvLcJOrYNbPg0o49FOqtIn JO11ZlpBCpVp2NRv/aziaqGrSxNm2Hz8SQ2Hxo0o8FFbqmlnbkFBySSD7EkBPkVFqIIg Ze1CWcOvYNG6Y9J1JKLyWOu5P7XkUP5ekC4Xg84x+GGMXcqhjnZ8Iw/XvCtqTqEqCIvi 8J+ZmLs497NGBvJC5jgaM+lThfubqAj5wqydZf5qsNtyaOwTokkYITdaAFTKWaJ2rvoF JCJN3yTD/1kV9aQ/AbcgMkPonQrgIwmJaT/joVUxTDZKgnMjdgmD2hIzi6qUeyUJBgX6 9QlA== X-Gm-Message-State: AOJu0Yw9R9BykM1lZLWXlEcs1/Ro4Fbr64jYFSOVlfMkHq4es1onCobn vEcYrnqGZUmibdyfDZKDzoRNhs54SDiCFbPro8T7YclTZfAWV8S5UwxN/ICv6gWI/Q== X-Google-Smtp-Source: AGHT+IEpyaQ2B9laiL5Qz3xq+OgAsfHl508IHieRw4jQK+zsxfoW9aDncD8KQfXYdlyhnJK/CywmIw== X-Received: by 2002:a05:6e02:12e1:b0:36a:1e27:1708 with SMTP id l1-20020a056e0212e100b0036a1e271708mr18563457iln.25.1713370192373; Wed, 17 Apr 2024 09:09:52 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([115.171.40.106]) by smtp.gmail.com with ESMTPSA id h189-20020a6383c6000000b005f75cf4db92sm5708366pge.82.2024.04.17.09.09.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 17 Apr 2024 09:09:50 -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 3/8] f2fs: drop usage of page_index Date: Thu, 18 Apr 2024 00:08:37 +0800 Message-ID: <20240417160842.76665-4-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240417160842.76665-1-ryncsn@gmail.com> References: <20240417160842.76665-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Stat-Signature: 81qjkuoijogkpuakfjtybqx38st8bxmf X-Rspamd-Queue-Id: 0C30840014 X-Rspamd-Server: rspam02 X-Rspam-User: X-HE-Tag: 1713370193-221536 X-HE-Meta: U2FsdGVkX1/nyOQNFagwAVq4qzlU5DJhj9O/8FpXqRFu0tpDqgCEr38pg66phSv5deHJUNrGkLMMs7ThJ47q9M7/MNMpMpWbG1hRXZQvKt7rs3ItG77lmVlXR0uySwBbiNRHlZfqK8vioPnoxzf0vAfXVuVRC5vYqnhJ2yFj/Uxs+/eR93A3VQ0kpyofDGV68nq/1G+sMLjkVXslxCfgTw8ikE12VOe98wg01ny1mKWSyMWJH5u6d6jqxgl0zKnkn5QtvDOSv5AqyyYBYu4LAc01ZdfpUTs8tJWDd9KjNWi6o6H2Wa6zT4VkGGbo661iI/Nrg2plvats517Q9MXP1Dk2E7R76H2eWqBK6qUylFufVofSyIVH9XgbGuzlC3RntvLrbBWWR8RQBWIXRTV6aT/Wz/yvTe0kgeC+0APEtlbmaqhS+49u0LRv3qgBZdRy+8wG8uo1L2t4QyG6G3+NQMKF6DrFojrYeCiidMTUUoh+UaYYECdaW2KkxnztWwq4gdecTu7Y1KPIP+yCXNSlieCKrjuCYVSh5hP/mFkjWv7fXhRZ2PxPp7awVITWoTgjQCEMsotelTloxm71egaDNErDhfxRAVLby03ECiDNKAuvjn6LlM/zDtolbnmQTiyDQgUwCvWY1tqyed6qWk67h3o8X/gSB/fb24U64Y12qTTHRa3DVifEoxpsNw7Nwuc0nAwsn4+DdKFnIhFySnRqYkImazCzoSVHsCNcuG6Xrpv8LKOBx9shShYHcHrlaHQJPsaHPxGJo6ixAtGIzIW7WZ9sHb5zxF0l3qNRgqqNpt1GPCiKbF+Kx/W4dxbejJvBwm22ysZnNzTqiqysqWETO9K+dthUDRAET7AHwbFfJPc9ArSVl6AGcx92YC7v+yTJTyexugPPt5G1JaPye8on9VHkB+barI5Fkafw/7BWCPi4kzryDCno2M2fbLwpOnD/1EbZ34p45n/c/YV1uwz S6WmjJws Y3RcmLtS1kH6SWCVBSzDlJEvOBz/rovcOGdSTCdVB1dCgeXyKCxvE7bUeCMDYqHk2mP95mjOuCKT6BMX9P6BPKWhlPGSjwGomkvkpADaBuPlcEg3RvwSfvXGtCIlJEyR+iJzkfrpemDpS3EUNqwfhwvb48gl5qHC0gnjNKfuTR+7JxDH1ww3GwGzMWRBtMav0ScIDHpwz/UlpG9Lro2T0ttVsL0c0v3iicOFY3ocqwxljn8ZH6DdmZxjSF9yiI/27ssTZm7pbautT9rSbeQLgb6UeRx5P/A3lY4lKOoNOlja/dnY4/G9UGtFT0Rgj8QR7+uVUKSDF/qB0frIb+ds/ap1EjMe47YFpXOx8OSo/kKyAOzQ4GnC28vXekCKIcVLK2XGesTiVHeTx0FXOJdzUmlUJaAY2qMFmom1NgYJA1xkb96BOMw2SMdcgNDLxn1oO1FNo3YZqusgF6blzINo6slTr8EwPDQ/rmKf5DL99HPCLX1E2hZBPua8D5HXLMB+Unwl/vFjt1JKGljW+X7MMEw+CpHJJ7T6FF+DN8BN80X1B1L9v3sFpQne6gjdKQlA80C0ZHTdzhLmMIxnHW9DepsjShPKWh6PF+iE8N9DND8JY6SP28KZTmRJENyaJE6qRQeAEgb+0iwsHgxp8O0wIcb56x7B+CMr8xjpV+UbL6swupwD+7grRaZWmEhqTr0iPUnkqq/60KLmlcvaxto5FoS/2XX3KjwBoC9dzKhY6+pABoOLs8NbSQBDlLNUSt9Vf3IjW 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: Chao Yu Cc: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net --- fs/f2fs/data.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index d9494b5fc7c1..12d5bbd18755 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); @@ -4086,8 +4086,7 @@ void f2fs_clear_page_cache_dirty_tag(struct page *page) unsigned long flags; xa_lock_irqsave(&mapping->i_pages, flags); - __xa_clear_mark(&mapping->i_pages, page_index(page), - PAGECACHE_TAG_DIRTY); + __xa_clear_mark(&mapping->i_pages, page->index, PAGECACHE_TAG_DIRTY); xa_unlock_irqrestore(&mapping->i_pages, flags); } From patchwork Wed Apr 17 16:08: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: 13633568 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 69774C4345F for ; Wed, 17 Apr 2024 16:10:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D41006B007B; Wed, 17 Apr 2024 12:10:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CEFD76B009B; Wed, 17 Apr 2024 12:10:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B90506B009A; Wed, 17 Apr 2024 12:10:01 -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 9AF4F6B007B for ; Wed, 17 Apr 2024 12:10:01 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5F229412E0 for ; Wed, 17 Apr 2024 16:10:01 +0000 (UTC) X-FDA: 82019510202.24.4D2B5DE Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by imf20.hostedemail.com (Postfix) with ESMTP id 6628F1C0006 for ; Wed, 17 Apr 2024 16:09:59 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="Kp/vEAWl"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.179 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=1713370199; 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=YMj4u4a16qafK5iLhLyvsa87HmnewGdq9/CAx27lOqj3qlMjBMBXYXRUBt8ZlcBtKFu1/c HLo08UZ9aOTfeYNAgUG8optCp8ZMOz1qw54Yb/b+Beoe65wJx6yu2XMFOHCTurp2NLzJSe esMYSo47Wnu3wNvhgIKH8teB2NUOuPo= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="Kp/vEAWl"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.179 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713370199; a=rsa-sha256; cv=none; b=PhfHnkESSRCk08GnH3GMKIelvC1QbBB+PuP4qatczgSJBZQoCqFOSkjo8OluhOccPGlmmi ui4f/4b6/O6NSXug9w/NCPNLOWpAY25vkKCoN+o1erDE7vQV8b90RPqZBk9d5i5SVznC2R wvEQgfR2O1XEcBli6rYLwDXkV9S9AWs= Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-6effe9c852eso2822639b3a.3 for ; Wed, 17 Apr 2024 09:09:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713370197; x=1713974997; 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=Kp/vEAWl/gjHzN7IZpu0ELLYRYnwH1rxaHHzcyfYGipf9KDANmZEDlJhRnIyNqaMBD NqPsss56tkD2hi6yMxJnq/LYTKK+q31bH2OgNrW2DQIBmEnrznZmf77gAJV+gZUYV/bJ 68nLIv+a/yAAkGuVn1DG34Y97KU7pgt5JKMDIWzm4gAXYlFuaqdKEtRvjxANr5WUm8iW 0p0UNu9Kh2KzRuvQyODQm2iiv7vwvQjzs7SdGpNGBXysJVwWtnh548/GGMz0wT9A3pUl Av2hTAxWRngNgOTFDCzloDdHkJiRWGIWghMdJMbTd9jcgOpIVrYDARyXl/ChCF3qqukI TYIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713370197; x=1713974997; 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=EIgrdSvHUWCO2dZg6ykVuMsEr3U/wyA3s/C1x/EweadeBooivrRu4uTj/00cxMBdkg s2pLnsIXZKz7OHem5pJijRxOpRzvk8VZTcyk44UTUBa8uyHY6oyOl0SqbNqsom2wJ0KV H4D1sst6gbs4B1mSBOCopgB8YfP3PRgPmLrKHWBWC5PH+2dw4S3jB7Ls7+sw3KbjLAEA JSEcwQgOONTQedQ1N5tAhx/G2Bb1a7A0oJY8Hp9EV67gw2IDHBcn3jrsOuFpamI2sESz rTB79l2G9delfdMYCx9MC2F0SIMyGQIfmo8aLmY9zCXtXt5LBd/9swGD/WqiPASKHN48 rEhw== X-Gm-Message-State: AOJu0YzGfGLiAcueJUgFnkJQHJ1H2MTG+wCAJsq5TxRIj5YkSxESHyRI cM2ucP6iJyP30LBJo+h5YcQ+YSiRKc61NmJwx+vNfPL0x/VEhrQO7bzOjwUD01JB2g== X-Google-Smtp-Source: AGHT+IF89lpxIREGckNZOeGWJiBxfqA/7WGCBHYUpnctYHo1cbqQfhXPRXtCnH1w7NEcZKTHHIsNPw== X-Received: by 2002:a05:6a21:2709:b0:1a9:eeef:f6b3 with SMTP id rm9-20020a056a21270900b001a9eeeff6b3mr63326pzb.53.1713370197257; Wed, 17 Apr 2024 09:09:57 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([115.171.40.106]) by smtp.gmail.com with ESMTPSA id h189-20020a6383c6000000b005f75cf4db92sm5708366pge.82.2024.04.17.09.09.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 17 Apr 2024 09:09:56 -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 4/8] ceph: drop usage of page_index Date: Thu, 18 Apr 2024 00:08:38 +0800 Message-ID: <20240417160842.76665-5-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240417160842.76665-1-ryncsn@gmail.com> References: <20240417160842.76665-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 6628F1C0006 X-Stat-Signature: 8b3pixsiku9zi99bjq4egh9zgfc5mdsy X-HE-Tag: 1713370199-165838 X-HE-Meta: U2FsdGVkX1+79hUntiikTwn0zrbQsk3ViEZsemQ1AYkQsRjfieWYJpsBASWTl73WuXP1APUr1t43+ujap4lap9UO8390DkZqq3Zn7I2OdptrS2/6Vf/ubRd27HN/SW3+1QRuz6V+ZdcQYhZvzz4SztqCfkaeYBlseWRerjdooLTPqU20kbIIuMKfMTJ0ZohoeCg9SLIipsOWoHuruCsZB/vwuKUmUmYeUxe+1c6vopv1Y3hwLN9bmhp2J/mGo3WcB1+0t/4MZc9bFEX6E4IeRPvp0QDGCK0yj9RmfrFzD6RdV6SH/Tlkxc2+odRGN57BV/+j+OlNdxM1JF+S4yETP6zcFGTDKHI3trn65Vfdw9eH04QUcvs6yyzTbJdME3FIFk0Sf4EG7J8o/naEWMMz6VSCDxkCViz+Di5FmNbk+KspOfv+XDUR1UBaRKHYto70BOi+jq8hLPF50EBoO3dwQC4AVv9Lf/ZG1362v07PQ25KuHlz9sZB8ihctZ9RqwHbw/U+csTgnxBTvVJM9hIVE8i374SEortHVQ6VzcESw4hYhvTZm5zr93aV0I4NWjfFVeJMbtS3ymFS/68Uw0IHxkgRZfETnLv4Pg3/gxHhS9yjUulW2Ag8VS8AoAhqU5dZG2cmJlKLPiAsXV+xxh2sxuJ1t4SXkw5Km7fo4jLHkfytdqwHAE54ZUToY9XY42mo6pJfTyLWLgCStv8PgRXesCz2jaono09HensiaMwZRyJbWfGKVwiazcBBTw2L/rxme4rMZ+ilv2nwyrO5lZMJR+HggQBxifLZg/SfqjTW+uiOQvoXh4JX+4CYeVilHsdqH/gg8vx3s765K/Uk6kwA/8RPYSRDZcUQ6HII15IHX6NC5SN3xk0YpUOEcchbiIjQx4QWDTm2bdmKTFQb7c63vJ1TYU9hegVUgkhxVbFUmr3GuVP1FbJQTsjCiIVBtggpRwHyxGlOIoacTg1YztY FIjl2u+5 fci4RZnADXHaLJu/00ySelo/XNoLvHIBdgcHM7Drs5Eg3mP+7owIBqhSHpesnOqHnpXn1P9Fcktqnizh1vVJTr4/r/2LYQuavTcHHkPW8UqOo2DLHOkox6KJW2NcKOfXYRSWLsxKkS+KXBrFPCm7bE4wHjzFqSnqg/EvE7KHAYM2YjFtHinO9lYKX2NiL5Sz7SO8nr7yF6LBcjSLafAbI9FGRwm+SKhikll9kLt+DP8IqC6hNh0dE03qrzz0gmzB+gRYnoy3/uDza1b/npI6c6tP6PR3vW59moy/N0NFPo2aLUsihj01myN7ODty9qUS6aWvCaWk1aqTInxceZw+TqnD6r5Cgh/3dVeaOVSHfJ5rqtO6RFk5peQ4wzLGRdhXqijCY1H4GKkYG9Yohp9Z5BzkZYTtihxGks9x8isnYgw82v3c0h/yU39sHUypD5D4n+nc+OBjfAbbj+1DGKigAa6BhR+ycHTXobBkRaJLWqjmm9x5TYs2RNQ/FGCYTEG2LMinOOj2zOLyaj/04h9se7RLnYy1mnVSj6PbBL2hzJ7iqGogxhgMbD5vZubFXx43jt7HZAMS/LMt90qOTCACsV+p92RJT7T/8YByhrUyytFdAiVq+Fn5cVyAc+8v92c6OkAXKjFqQmIunKJVX7O7mBbcxv3imfeYWNCyXUdeVIGivIdajHhMDlCgADinU4IM9pQDKCi8S/S0f+ra0dZpf0/eUc4skqlYzmuQbNgmI5AJwgDCd+W5PJG82K4fG9+bu2rPN6Gm1kiNnbvbeXpEqaKTwGg== 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 Wed Apr 17 16:08:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13633569 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 59CD6C4345F for ; Wed, 17 Apr 2024 16:10:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E29F76B009B; Wed, 17 Apr 2024 12:10:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E00B86B009C; Wed, 17 Apr 2024 12:10:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CEFBE6B009D; Wed, 17 Apr 2024 12:10:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id AFB1A6B009B for ; Wed, 17 Apr 2024 12:10:06 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 755AD1C12A6 for ; Wed, 17 Apr 2024 16:10:06 +0000 (UTC) X-FDA: 82019510412.24.4EB6424 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by imf27.hostedemail.com (Postfix) with ESMTP id C999C40021 for ; Wed, 17 Apr 2024 16:10:04 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=CT6idp01; spf=pass (imf27.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.169 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=1713370204; 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=QKsmOxPUvJ8jFqBm63ArqbRFjM5INLEtk88J9DbM67E=; b=DXkPE5igCtqm9RKhad3ORQUxw79shEyShX77X6jkXTck1x0StQoqvH5SU1mcS/31qcFDT0 bw9wj3vote0LeStRb6NU9jTD18RoQ1Cgnzenipotf3wscNR57lF+qEJJkRzMiQpQO+ufLy mGYOzhDc1tx7mS3KbWfvUL6yi5qRNzc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713370204; a=rsa-sha256; cv=none; b=XUqdTema+0MnPFPRqPsNSMXFL7SQ5RxwU4sTWDuwjx1q0lQ20NPNokcHbEWL8cwOnk2Age SK3cqnBxIIFwmtYivPCxjdiH7ttpNiroEiiDvDdcQUEhMgY+vdnaiQciXzQ+VpsXrFLj78 9qT2ptnN9TVH+ImJUgIk/L2QdGR1GNI= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=CT6idp01; spf=pass (imf27.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.169 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-6ecf1bb7f38so5305799b3a.0 for ; Wed, 17 Apr 2024 09:10:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713370203; x=1713975003; 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=QKsmOxPUvJ8jFqBm63ArqbRFjM5INLEtk88J9DbM67E=; b=CT6idp01IrUBR6D54siLTul8TlCsJxT7E8L14gfzY9aSe3qUEV2JdMEWtKY7swcPrv 4OJxEdHEC7CxrYLEk6s+VwLPRHAH5knu8sC3gE2qFZMwronVwXDVnj+EWIYy7P7Cvmxb az+Aq10JXy2qCv4a9vBJa4IAVlv39+M9iNTixishhmfDEtFPNOyNzCwz8NB2BvvJQdzC Lrv2KWxN2ySvnUzFSam6CfPitq10o+MvAIW9t1koHnFyCFGbUHyi9KKXNjpToybtVSlY OU3Gcp3Kbhdwnp4DCiDNXfBf53Lpx8b0MS9KOSmnsySX92BQ3cJBwgB+2P9LJysE6BLN BGiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713370203; x=1713975003; 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=QKsmOxPUvJ8jFqBm63ArqbRFjM5INLEtk88J9DbM67E=; b=pqz9cR1wA/NpUN6e6jwsAHOEqRVA9Nk1tsIZxTy4LtGxbXOwVUWY+1WlM7zzyVkYyP 55iq0vl9Et3nbvjtWtC2pwc5ajUxSU22BiNirGmA7JaYgXg05b9J7BtWwLUxIuUU1K6u 62cnbsycLFs4AXzsoXw/C/qfGIZNyaEn8DRxnWDUdARnMjb0OCJuy60zYlzzwm6bLqOF ZjSK6oOOaXwQoFIA1YQbF4IuXt8v5rGv8Vj2jjoh+J9dzwsgfmoaly7ERRdE2rxkvhJe 6c905GvAOclEzcpPdtnmg6CVwqxOkBrsCG5E9C4fmqDZmsCNWy+2xx1Dja4Lvu/lKTs3 1IuQ== X-Gm-Message-State: AOJu0YwCsz2pH6k41jOoc7bQ4eUFzVoFjzaQfwZTjxu1nXXh2KyXuwE7 YLGF3rrUUbmpb5kjPFXbxYWXD9gkfaW5TD26zI2fOE4Un9pu2efeXLOhzA/xudk9kw== X-Google-Smtp-Source: AGHT+IFJeyb4K3TlyeiLY9c8kwF5soNMLS4dioE3GGli82q9k0eqDSGM6THIcyA7JEE4hz8B0VjGpg== X-Received: by 2002:a05:6a21:8189:b0:1aa:58d9:1825 with SMTP id pd9-20020a056a21818900b001aa58d91825mr83965pzb.3.1713370203077; Wed, 17 Apr 2024 09:10:03 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([115.171.40.106]) by smtp.gmail.com with ESMTPSA id h189-20020a6383c6000000b005f75cf4db92sm5708366pge.82.2024.04.17.09.09.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 17 Apr 2024 09:10:01 -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 5/8] cifs: drop usage of page_file_offset Date: Thu, 18 Apr 2024 00:08:39 +0800 Message-ID: <20240417160842.76665-6-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240417160842.76665-1-ryncsn@gmail.com> References: <20240417160842.76665-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: C999C40021 X-Stat-Signature: enekk15bsidcanutmieqc5zts19am39c X-HE-Tag: 1713370204-401889 X-HE-Meta: U2FsdGVkX18t3J0Bza2Pr3Ri/D9+96DQDaYlqM65rzOVoq8+01iZkpckosGc5sJmVdatojc3nZKH+z/LxLjGULamVrKNF/uoSqj+OTfDev9pnGNQ4PLyz3HRG2oPYKHmQ3MI/1+DE05Ocey/ysXI0VLD2On2zX/Nxe4lLCykvteJ9qxVguH/e54ukpI6bD1qeBV7SqxlASX8YPMDT+8RwFmVEX0WzKH0mm3uktOJH2HZFiRVECE10aLM9pzGBuIAOU85ZaXql3Vq6bUxWC2QQHBmP5SR931+Syw0RhdWqN2yNzzPd/suxL/Z0M4NCJL9I9HIv7+FILePP1uavjuU+Ae/FCOdzM8sGNgri/PbjBA6Ue8si9oy0yqbHFTURc5bjw4GJ54amfNeh5kFi4y+HkCkDKORV8f5rGhcIAVC4T0KMDm9kT2fiq1/bnACQSADXgF+toaIZ7tCYbBtWzoldxsbpeT+Wfs1dnQ4VIWPhXYBusecWvccEmrbHDZMN1S4j7Y+t9CfH016te5xnup4D+cnEIkLYb/5oeo/s3sQcvN+t3sn2OcILb1D5Yjjaub3zqxhkqv6GGSrUpfmlRuAjRFPtYVggOyeA+jv5aTfbQQd2zqPmO1RzCE2Ssei/hFWoczT/EVY4zkXooY0ZhgOEgmjZIlCMSMOheMAKhYDEBbMsVfHqrNQ0EWwOvC0AwnnhrM/0ktwedQoSnwZi7x09cTAGPY96PaRSydTDikGtn67U1pkDYPB7FzpQ39O+9e4qdUggHf2MQYWgJbNL8Sx1LbD2gp6ZzroUB/pxXUXhDSvqBNtDIoBC0CK9sm/qwSdzKS8IKOFplYubrH9IjBCoeoyOkJgvP+hlXkuUxR68mNN9RRgbSAFGAPW7m+y/1eSi/QHQvVMazEyvyCV24mAF3BHUvJtIpNlmPAfAv7u4bOECPvPHAqeaBzYlaw5v3KsHSS5+Y81HgwAc/OmXjP bA09hKQx +O9M5xU2W8MMSpwHYpCqwSaSr6ECqPBiIOtx6WBPD8uUgKMnN9axljH56g/XpaL1CMHGzRR/0Yo7ZQWOQe7rDJQVxTXxkkGSkCpakzq65cTRV32iiMMrIas35tUfvenCgjXHlzJ21Ig/6s+K8IfHtfOFtGYTGiRIVhcaynHQ8Ucbg5UDyHm6oQPxnYe3whI4NNM40T/vL2S+xVpmVYdd3T1vecxleLeOdDSbO2nwxCh+9dOKyvHI/fb+w+SA+Xd7qilt3XKIFb0PLLaBWQDzIvxh4B4Y7NypJnD+8DFNUXCtRDw2mdHiTN+oQGA== 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. Signed-off-by: Kairui Song Cc: Steve French Cc: Namjae Jeon Cc: Paulo Alcantara Cc: Shyam Prasad N Cc: Bharath SM --- fs/smb/client/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c index 16aadce492b2..73bbd761bf32 100644 --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -4749,7 +4749,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 = page_offset(page); int rc = -EACCES; unsigned int xid; From patchwork Wed Apr 17 16:08:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13633570 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 B20E4C001CC for ; Wed, 17 Apr 2024 16:10:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 389896B00A0; Wed, 17 Apr 2024 12:10:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 32CC46B009E; Wed, 17 Apr 2024 12:10:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1A54F6B00A0; Wed, 17 Apr 2024 12:10:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id EAAF66B009D for ; Wed, 17 Apr 2024 12:10:10 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id B81D51C12A6 for ; Wed, 17 Apr 2024 16:10:10 +0000 (UTC) X-FDA: 82019510580.21.F1D3262 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by imf29.hostedemail.com (Postfix) with ESMTP id E44CE120028 for ; Wed, 17 Apr 2024 16:10:08 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=UoHnlEPt; spf=pass (imf29.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.170 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=1713370209; 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=Srg4dA9RNSDxQazS93yF50nbI2bCxfJ5XfNZ+0IFk1c=; b=1rY20inqIvHzyoPx+wAsCZYRvsX4ooLSO0BzdNRMIkj6tYTKmzeQm66AZ4d9T4TpaYZJmr QLlysjckxcts3TvvujV2oBHzk0SXrke+8F4NNTcSUpsWat0FoPtw6E0GgAY9CzjSCHJmS9 p537Jujah5ZIlAk2iF3J0RzXvljV6pY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713370209; a=rsa-sha256; cv=none; b=SFwXbKP2akbdmB6ufmuitVX6Vzy/T7WRgv6/xeuxXvd3XC7JGOSSAEUvzL+ssIZ5IjEzZ5 9aZzTdvLs8A/4ByuLJQPtfOiuI0Lbx6SckDlu/rHI2/aVRTouNYJq7j7Hy4e6lgNpZwAWe rrJmTQu9xu1yq+ek9LXSx8oBbkOHqFw= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=UoHnlEPt; spf=pass (imf29.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.170 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6ed3cafd766so4757144b3a.0 for ; Wed, 17 Apr 2024 09:10:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713370207; x=1713975007; 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=Srg4dA9RNSDxQazS93yF50nbI2bCxfJ5XfNZ+0IFk1c=; b=UoHnlEPtvVmMaOAgrPDVT+GVH2MtfrsfKpwCqPoJxoJ1vlQ3mjP4FRY31Fb3uNQrBB zsho1vhpdkNSOobYgt0GrdoevEOacL8LNUAjb+PHhIK7njZRoNFGKESiB3KvnQTFMXYk 7ltPrrtm8e18QCLZpP7AviIpf4eH0zNPQY4tdz9REBupUBtFLVJW0ppkLAmjAEEu4Zfk j21pEc4x8nfoXX5SI5QyxV9c1c2VDeg3zXYUNplCE4nMvttYs3o54SCO6mpaC1l2iw+2 BdLswpFf8iJXGllbEyUrklm6oimxuiU9vYxL0Iolyx/S205LuLTJlIIxEgROh1ifEjbj WihA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713370207; x=1713975007; 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=Srg4dA9RNSDxQazS93yF50nbI2bCxfJ5XfNZ+0IFk1c=; b=vSS9qBbN/QIIt62slMHayOBrYz/+7PJxa9NCepkXYHdB/lGBff+yKVd/xdHfwdV3Ie 3igHZwWXYr3LUrNSYqT+t4Xv0Cm2I/jIl4cvuWVvIoYVzUfuGGuc06Qa5Ko2Mm7Xtsn3 IgHlLEdHpj58lsFJqL3FQtcqdE+/eUR0r5IcmEzy/dEgeekNrhfA8NzsdknXpKFYx7AD pQLnwCjM7lRE9nPZ0YItoCzChLmx760e8NglKtmKFiWWbFmdqHyBis7GmtybsgelVns6 CweZDdLwT/3/ko8/pCRa1kzxLTM5uyc673z5vT8JF1nTGTgbyoOlc2IKvaljTB169ZkM rMMw== X-Gm-Message-State: AOJu0YwXTmUmN31wx136vpwDcAVyvb3QwLsesVgeS1JzX/twQMYidhbd Bc3OvzcRrmxIYENVlmFkcT4d1Vgmzskd1dBdfafn/iNVgB4KYzeTKAjl3/fuxjvkGA== X-Google-Smtp-Source: AGHT+IE91IYOeoH7Co4FQPgzNtFkiFYWeecE7d0F5J2GxZaKlBCPwnRQBB9VWoRDd1SCyPSrNH5WaQ== X-Received: by 2002:a05:6a20:3ca4:b0:1a8:2cd1:e437 with SMTP id b36-20020a056a203ca400b001a82cd1e437mr102832pzj.11.1713370207249; Wed, 17 Apr 2024 09:10:07 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([115.171.40.106]) by smtp.gmail.com with ESMTPSA id h189-20020a6383c6000000b005f75cf4db92sm5708366pge.82.2024.04.17.09.10.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 17 Apr 2024 09:10:06 -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 6/8] mm/swap: get the swap file offset directly Date: Thu, 18 Apr 2024 00:08:40 +0800 Message-ID: <20240417160842.76665-7-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240417160842.76665-1-ryncsn@gmail.com> References: <20240417160842.76665-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: E44CE120028 X-Rspam-User: X-Stat-Signature: ko4bqo1ph45h4wa717ohyqiifxqbpriz X-HE-Tag: 1713370208-296816 X-HE-Meta: U2FsdGVkX1+WIKZK3gjTRqnRpSmf9IK2PdDLCfbptcQ2Ugz+r2r52GFG3gbT/p7S5813FSP+pENn2WPV9Ga2V2VcV1+rQX/okGPXXGrvtptOmpJUuzgqxLB5UafcMc2RZMoUbIMV5vhe2BAFKF8fbAi/sFuH4hs+UjXy/lCc153kZ4i7XknHnZgfI0O6s9/pqSs4mUbjhJvWUAAW3JpZLK4iHUt3Ith6G7y/ooFiMn6L6wvHA6HEFXnfpOP4wG8K9dLr/A+ai9pKBIRw7utO0hZ2V7cmzfsTYxXx1T0Xhvc7iNDEU6dmZk0oXOX6TljlN5USzG8dS8h4eMKQgyF2qaMQLvfYXIPg4/J4S+lVku8q6yZiKOH04/9eV3DKsHDGM+9XB+7+N9l2CfCnl3kXEgijli6vpYYFPwX4b0u8tyG8o4dznE7SQjMRI1QaLK5GvEZ2q7wzghm6F9orysoSI/Gb34cfG7iLPzEwB65HfdRUq1rp5DHRwXGLIEUJOc3zh3xq3/XxB4lB/FS+HKPP+e8zhugn3OPYxBLV1oe+S6s45rIfl7JOL483Y7/YEgRoIach6Dg7vYmYqMUi5fylJLAImx3W2DLMlOJLU7edrZHf+00Ic4afGDC/Bdf+U/DNibhbMti8tprC6FIiq/4Bo6yJ5Tp4H+N0zte49ACEC3eNkqyF6Nc91pieaa+aTJ7mh0GQRXhoEOuZtbyFND0tQ04XwU9CFooKCJYZdx2c//jiTQbWY8AoL8x2QjpfDS76c+/j8KgXHrCe27vnppgCLNQPJdyy2eeq/hGI18CLQVh8UVvTRjoA3cjGhYFkrfK6tamismoNoTQOFR1+bzVOnavZooc3Kw/AdqhdLlEU9MLFDARMuNVX9m1daTld9pRAdjCCK+WmvMfuwDwGtNlbThVmCYCQMwOIX0MjiymcEzMftZj+7RtDR3cGUQJfAF4BFnM1f6fg8N5TqSedB7k nNsKwhCS Zp2eSppZpN3I6Trf8CWzPeLNnUKGmpAkERMwtGC9S0Xg1gYnGcoZWOajJNsnJ4NcfS1b+JD+2hlTR21UpmeOphECcZRMu5ffVjM2/1iTIL26QPBg9iRK/vpdKw+f7J6B1Xf+7hSjs4hwXy0bzsiHQUtWJtZx759krM6Mehc6Xb2i9MT0s/RQuc5git07d8ogOpjVsL346xtm6/G0zBd3hHvxAL2eZF1EfZLwT9m/5yJJWu5tePmJwfvBqddW0h3/Z1msPgfWh1dDQ4Z/KVwqYOY35IdP2b7604g42jLaiv41sKNTqMlFnaItgx1kLiShaUcr12QBQ+m8emfT913DwNQ11yYJbPWJaj0WajHy2iztXfbKzKlKL5cvY2pM/2Ytg1ksPzX+2SNjw9vC7z738HLV2hHIsJEJcifBN8noR3SpOF8DKNr5TfJ/x8vvIErpqJ6ptLrNHMeBIO/hNkEk3RJ/y2+khPwRl6l/UKS9xGytGMTyDD7lg9/CZ25APxMz/MiVOM0YhqxZxpUuxddDPnlwPhPIFSVPn4qsaDxEaMsjNL4Fp8e2tHKHTTpcIESHjAFfsYN5FRgvz4MdU2MGkouwdZTd5wk4Mkh3sJHS86TejKA+ZJ3ExkFTx9umNl+AHM6aH 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. Signed-off-by: Kairui Song --- mm/page_io.c | 6 +++--- mm/swap.h | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index ae2b49055e43..93de5aadb438 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -279,7 +279,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_file_pos(page_swap_entry(page))); for (p = 0; p < sio->pages; p++) { page = sio->bvec[p].bv_page; set_page_dirty(page); @@ -298,7 +298,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_file_pos(folio->swap); count_swpout_vm_event(folio); folio_start_writeback(folio); @@ -429,7 +429,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_file_pos(folio->swap); if (plug) sio = *plug; diff --git a/mm/swap.h b/mm/swap.h index fc2f6ade7f80..2de83729aaa8 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -7,6 +7,11 @@ struct mempolicy; #ifdef CONFIG_SWAP #include /* for bio_end_io_t */ +static inline loff_t swap_file_pos(swp_entry_t entry) +{ + return ((loff_t)swp_offset(entry)) << PAGE_SHIFT; +} + /* linux/mm/page_io.c */ int sio_pool_init(void); struct swap_iocb; From patchwork Wed Apr 17 16:08:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13633571 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 0DC2DC4345F for ; Wed, 17 Apr 2024 16:10:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8F9966B009E; Wed, 17 Apr 2024 12:10:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 85C136B00A1; Wed, 17 Apr 2024 12:10:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6FBD46B00A2; Wed, 17 Apr 2024 12:10:15 -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 525DD6B009E for ; Wed, 17 Apr 2024 12:10:15 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 1AC6740A4D for ; Wed, 17 Apr 2024 16:10:15 +0000 (UTC) X-FDA: 82019510790.08.BDD9FFE Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by imf25.hostedemail.com (Postfix) with ESMTP id 360ACA0009 for ; Wed, 17 Apr 2024 16:10:13 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=St2cZsr2; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.215.176 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1713370213; 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=yWtogKRbykZjVeWYRJzwDv6D8U3YfbstN+EZdpM/Zng=; b=Ca/tsP52yCFdWMhDpe47nARZRK9PCsTdNYzOXr/dIH8UKxwF5tvaHcPtr1em0BhtIPC/7M Mgq//CqfMqpHrJ0QB1LDdBSRG9s5H2pz001lE2LfFVjKicyBkdwt+UvhBW6dPprC5RLt5E AogU94H0BZnRxTaifLdTqq8POvicX38= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=St2cZsr2; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.215.176 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713370213; a=rsa-sha256; cv=none; b=d5EL8W6T/5H9BWIdPAXZhvo4zZ8DQSDuV6S7fLBE/Re8GJ+os9AU3S9xLqnLbRgMZXSkqa yqvp/++5Xmn/71HkSpo5E5hNwvQAVHZZJO71W6T/FAildlIGeQPxNvdDGl1q2lOxdM3LyA JGZPyrST+yy5om3Hf584OCp/svI3C+g= Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-5cfd95130c6so3875410a12.1 for ; Wed, 17 Apr 2024 09:10:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713370211; x=1713975011; 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=yWtogKRbykZjVeWYRJzwDv6D8U3YfbstN+EZdpM/Zng=; b=St2cZsr2tUbP8L+myoOvstdWH8fbi9gUxNT5tIKkZTgBMnMjcg8co8Ef2irx6Z/J8j hA1ecXMeVL1rZcfUPJDlCWbLavviUxVwSRXrZoZ/WeRSQI8oZD/S/Sdez8ZtzE03ecA/ KCemgVAqCvJ0nXJat/ShbAy79ws4FbFpKAG9YjZcEOlASN8ICjfeCEfBx/9tKf/NkHWk g64J/dAn+w/NBzr/J/lscyiWP8X4Ij8+Zc0GT6E4DO6wUOVBIbibjLJZO28DoXBqTRFM 0asO27HpYUsj4htdvjTq7jul9qhqb6X4fmZjuZ4LmhdogDflSJw035hiPfkLqj9AZtqZ T2Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713370211; x=1713975011; 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=yWtogKRbykZjVeWYRJzwDv6D8U3YfbstN+EZdpM/Zng=; b=kivsponcOWQ8aw92reumuHGBV7/16j2rGiGEE+OBeSlcZYIF8ecpj1kH3k6u/OMKLh GjhZ4ZHEyZfHREA277urk5GETgOjU5v6zu5J9rRaewNeXHmOwRaMckLOq5COFahQuula 8866uXFc8s/Mni+cpiZggb5RMeYJyQXH9SAVc4hE/lWr/u2P4Z0FdTXMOx80ooHmOIrJ GzcS6iDbrBYEjuRdTTPBqeofbvCIwrO8v8P7JeJPgpGejXyDB55u5VcdxnmVlEeV8VER Kdhsq/4+jgZMrgvfbIoivbwVvTipJ1XA8NVKLGS/KjAwRwHDo/w37eY4i3doBcE5CSX6 hO/w== X-Gm-Message-State: AOJu0Yze5q3qHG5tCd0ywf2tCCOntXw+lcRPhjen30rf5pbp5gGI6+Um BSM/TGVQtNhqk+aC++2IG2IcZ1UYk/E6gftGA6nYDg1qJGAEXdC0xuwWVYvEqe5Z0g== X-Google-Smtp-Source: AGHT+IG64Mg+h0HLvsWvmsefrKZFQIaXKNBvLrGP2U2HIqBvzsee7fMoaAAuubQ+ziUMJdC/6NC8Ug== X-Received: by 2002:a17:90a:128d:b0:2a5:492b:847e with SMTP id g13-20020a17090a128d00b002a5492b847emr13549505pja.1.1713370211442; Wed, 17 Apr 2024 09:10:11 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([115.171.40.106]) by smtp.gmail.com with ESMTPSA id h189-20020a6383c6000000b005f75cf4db92sm5708366pge.82.2024.04.17.09.10.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 17 Apr 2024 09:10:10 -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 7/8] mm: drop page_index/page_file_offset and convert swap helpers to use folio Date: Thu, 18 Apr 2024 00:08:41 +0800 Message-ID: <20240417160842.76665-8-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240417160842.76665-1-ryncsn@gmail.com> References: <20240417160842.76665-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 360ACA0009 X-Rspam-User: X-Stat-Signature: w4nh6y4ijhmbxjezus64qjxosex4io7f X-HE-Tag: 1713370213-33993 X-HE-Meta: U2FsdGVkX19zW5XksdoOoBF7otAEJQCdEweGkal7lhz5cx5UAk0EmTbS8VU0FM8LlCMODUG1fRR8xRebV6iU4an6sFxC2qdhuGuilhnxeiGayBrYdMLUZV/ghfWH6yXkwBKUBcPXIznp4pwyH4bUw++2DBZHTQk2UtQisng9H+wUrHee4pQebK5iRyHyKMSGwxu+15GAD6C4jg7eJetEa2UP6HgGINb3HfL5Cm+eRkreCQowCItLVvilrHk33MOYRzwR6i1Bd4hUKViQDWTc9PxcsfT4m525M6lfpqQ3Z/iqCAGirPmDI15ncXmZcuzdYBAb83sRv3ro2NOzeQIwQpdUCZ6bdXXhx8NjYm/oi6Ob0zBnxKowfCtFpxpq/U9u/NA/VaKSmB9JSZGbW1xjKIxwLqQpYD8MNoXoTQVZLalJdDOUqMp5U/Hzj4ZuGYxQbMTWKJxr2UnC5SaLlCrY2aGKzUsUQ3sYYELgizKvnCOVypmsCNY1yS3TNYzRpNQvXU6yQL130gEzDx3v7HtTRrnlkw9cWTPHRQdF90GxQnyxkZrnVhYSgADCgnptgqkOXLDmy4IWsipnpEIjnWDhUvCezy2o/jPXD+9hX/qXk25QPWooJjV5IFKOAzAb2o/Kio83JArdrivhTwIQ1IuNk/b9RgmXqjI3BlRlAemfPO3hF9mnevYDpqAJb5p7ZE4/XXqLG9zTpnO4U+DR1Pac2/6w9UXF964Xl7e45lrW2eBiLMxdB9OuhAz6ToSrzgchNuAmszwv8LTahpdiwciPPbPEHX35MPV36JjW+ZurOoWLFohdDXGpNwOLMTuEGNxfMMFcMu4jmFw41zT0+uIgswp2XcW7i1M/Y3neeE3BMjxIEAe5ZCb/XHhTPFZNGb4jiycT64Gd+d9uhcvLQe3UabsYEenY8O4CXLhkUAvWpnGat9RYuNCcdY62lHNo8iBpdrREwbH52NAGzK4CUJi aF4JQA2Q ApnIKGDp5nshJcxWXHdOBxCQ/5G0xzO8Zz+9JQLYkBetUCsrR7xdj0168KVre6aXUJ8o4mcVLgVxgk+ofBIbTC4Rcv71TnASqHEkoIvtPJHITO5eFr6717oU4rTjLkc0h+XNuj7Gk+19RVe/jfamwSMA3S5DmH0N+51RuPj3udUuRzO25cIwl10Is/OM1g/9ItI9nY95T/OZZ1C4CyBFwJ3R+X3YtpkAhBPSzr//aBgV0Y/n0Gnh7T3LEo+aikYBd9jwfcuzzhVZ7FgA7MB0EEN6HMnVR1T9gj42tlsaik5P42Z+s4pX64V4E9rff2h3RpBWyXlVYHObduuRuLAuuQRovZHhkMPI+L1YW/3TgFKVvtW2538dXnmUBh1dac1b59Msut4QpgypvRj5W1l1+QyLRh1GHfvA9nskM5TWAWI3xsuoVWg115cImb99KZ1kCauniMObVhGv3eP8XhDFRVOu5PS9PVsyeLatcQtg28E95L7eNjd9tkV4dyvSiNgfabs70EG9rttlhd1VEG8M3UOodNRFuMUFusehqRNdMMneD90RQtlej3EiIscmqlr/SDXn8g4c+ljRcvxD3LJyGGiDajPZKbfRnwTMRkOrR3Wv/WM0N1DmQnV5pBhsXnehtQPaRdYQUFWO0x4TVJTVy5++56qEJyq/NDhnn2MjJ5AVQjPQ= 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 When applied on swap cache pages, page_index / page_file_offset was used to retrieve the swap cache index or swap file offset of a page, and they have their folio equivalence version: folio_index / folio_file_pos. We have eliminated all users for page_index / page_file_offset, everything is using folio_index / folio_file_pos now, so remove the old helpers. Then convert the implementation of folio_index / folio_file_pos to to use folio natively. After this commit, all users that might encounter mixed usage of swap cache and page cache will only use following two helpers: folio_index (calls __folio_swap_cache_index) folio_file_pos (calls __folio_swap_file_pos) The offset in swap file and index in swap cache is still basically the same thing at this moment, but will be different in following commits. Signed-off-by: Kairui Song --- include/linux/mm.h | 13 ------------- include/linux/pagemap.h | 19 +++++++++---------- mm/swapfile.c | 13 +++++++++---- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 0436b919f1c7..797480e76c9c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2245,19 +2245,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 2df35e65557d..313f3144406e 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -780,7 +780,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. @@ -795,9 +795,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; } /** @@ -920,11 +920,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. @@ -934,6 +929,8 @@ static inline loff_t folio_pos(struct folio *folio) return page_offset(&folio->page); } +extern loff_t __folio_swap_file_pos(struct folio *folio); + /** * folio_file_pos - Returns the byte position of this folio in its file. * @folio: The folio. @@ -943,7 +940,9 @@ static inline loff_t folio_pos(struct folio *folio) */ static inline loff_t folio_file_pos(struct folio *folio) { - return page_file_offset(&folio->page); + if (unlikely(folio_test_swapcache(folio))) + return __folio_swap_file_pos(folio); + return ((loff_t)folio->index << PAGE_SHIFT); } /* diff --git a/mm/swapfile.c b/mm/swapfile.c index 4919423cce76..0c36a5c2400f 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3419,12 +3419,17 @@ 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); + +loff_t __folio_swap_file_pos(struct folio *folio) +{ + return swap_file_pos(folio->swap); +} +EXPORT_SYMBOL_GPL(__folio_swap_file_pos); /* * add_swap_count_continuation - called when a swap count is duplicated From patchwork Wed Apr 17 16:08:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13633572 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 63BBAC4345F for ; Wed, 17 Apr 2024 16:10:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E9F956B00A2; Wed, 17 Apr 2024 12:10:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E4FC26B00A3; Wed, 17 Apr 2024 12:10:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF0D86B00A4; Wed, 17 Apr 2024 12:10:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id B10506B00A2 for ; Wed, 17 Apr 2024 12:10:20 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id A01C5A0ECC for ; Wed, 17 Apr 2024 16:10:19 +0000 (UTC) X-FDA: 82019510958.16.7001091 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by imf22.hostedemail.com (Postfix) with ESMTP id BB589C0004 for ; Wed, 17 Apr 2024 16:10:17 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Ug2l4UEI; spf=pass (imf22.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.181 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713370217; a=rsa-sha256; cv=none; b=YVTXBLpEeoLTc9iqhdG7D9Oa7bBXtAVXtl9G3WRG3RaLIjTxb4+4ZLTTJxHeEIG2OenZ+G MKqiFBK8bXysSLFH3hCgJfnj3TYk5j99NSiIzG7mqXzy+SYSmg1D0RCfhKo11GvW7t7bel AFlu9rpc82lcU1SgekM4lKmfaf0nOrk= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Ug2l4UEI; spf=pass (imf22.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.181 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1713370217; 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=NbiFeHGTwOcTfQDQTaNNyMygitoQq98RBksPTjxdp5g=; b=Sf3G6pk1sE4ZM2P8Pg5QF2ODvfnRdbY4ELhTTVO/Fu9VAi6rwV6KajIx4dxCH0p2OoPiQ5 OKZm4WVmUjEVDCfZVz4Yc0WiKtNKemrdnWj6rO7dOg6FRZxRBW2LlZj9e+ko4Mt4ly85At mhBgHqtVBcRdxxGmtlSd7Vh22KB3nD0= Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6e46dcd8feaso2696591b3a.2 for ; Wed, 17 Apr 2024 09:10:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713370216; x=1713975016; 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=NbiFeHGTwOcTfQDQTaNNyMygitoQq98RBksPTjxdp5g=; b=Ug2l4UEI/4nEuCY6Sw2yzWNIhW08Yhvf/pJPqPDOhKJjGojCGbWj50plPoUqc6G/Wq xMKSGztMTbVr4uAAg0oYNx9a6CqlQLx2sBSX4yvbLC/1OK6Zfii5WzjgXyXGmDk2Zg6e k2jjadTWTK7jd7dbkbmXz+7Xt7wo0qCv1IhRlA0S2sgMlpYt3V3FHtZhFPPaIWBIthM4 R89yZRwAtAyPuZ1W+bCCe6TOHqIu5t3gJi7sPs63h2axXIvE1kKbJjj/cOolqR2VKsJn fs22l1a3RmtWBeQzvCgGY/r8zfG6UAbNSEPJ/UoZsDHvwwjHPYTYj8x+JhtlPfiEVWUk uVPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713370216; x=1713975016; 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=NbiFeHGTwOcTfQDQTaNNyMygitoQq98RBksPTjxdp5g=; b=v6m+FDSDrIZR0XdJSMsIzsJjqjtd3ptZsLcZ/PQipqT5NgYNsOTdlcplNaMwOMgVYd QKo+qcTkAIZstpdqf52d/dxxIGU7bj6Eb9uh2YVP5ztSHaz/LfbkwAq0CX4xACFzmi5f C23t1zJ3mmG/IQ1F/7zYn+nw/ZIFrnnjSIsk2xiyU13QdhbKm5s3E7whaSBYSa1CU2v/ abQc6cysQQFV/beAcJfnVsapNDxWj5CvWgog+qVuWyOwHVadpTpG41kUv95VlcrNOWWs o6Kokx/cAq5BixIIFbc52Kb5XwGWPW7HKldD/I48nVkzti6eXeVWfkRoJv4oSIOgTdkZ q6kQ== X-Gm-Message-State: AOJu0Yz23WFF1XmlCuKZ9Mp2w/bW2j/YUl5GHgUulNkWdcGetrLxSxZk MLY6nlNCw/ra+llKnftCV8DC6deL1nKER9t5t6N7g3uIYUARjbFsj4ucF54e8N0o9w== X-Google-Smtp-Source: AGHT+IHeqf5gBYmEe5ujb4SeEb6/MooBt6l5k+RX+WFyCklLUnpFVTfLPyz4C4t7qhymJtByjYRG3w== X-Received: by 2002:a05:6a21:8803:b0:1a9:90e0:4760 with SMTP id ta3-20020a056a21880300b001a990e04760mr61057pzc.56.1713370215887; Wed, 17 Apr 2024 09:10:15 -0700 (PDT) Received: from KASONG-MB2.tencent.com ([115.171.40.106]) by smtp.gmail.com with ESMTPSA id h189-20020a6383c6000000b005f75cf4db92sm5708366pge.82.2024.04.17.09.10.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 17 Apr 2024 09:10: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 8/8] mm/swap: reduce swap cache search space Date: Thu, 18 Apr 2024 00:08:42 +0800 Message-ID: <20240417160842.76665-9-ryncsn@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240417160842.76665-1-ryncsn@gmail.com> References: <20240417160842.76665-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: BB589C0004 X-Stat-Signature: ys9rbgofwkkz8e3kbd9kxf4tzidsb45m X-Rspam-User: X-HE-Tag: 1713370217-485748 X-HE-Meta: U2FsdGVkX1/p3gk/k0r2xTSsgdwK3KVzHv/5IjqSvo8563L0/UGUOf781F/U+gNTpwsfRJOtj5IRX46JF/1u1hLxdJ9DgCuXA4ykR/nKz0oGrAXOL8+adp0hqf/42YRW5OnZsAMZUsCTx18PXVCR1rw3M+ZUuTp338frzZv2AS9bzgb7ybz2kc9/ZZEIpBYSp4uig/z6G8f+dq9A8FOLnut6d42gZHy0Lt51cJ2TQCynAAmLcIaYI+VXZobeibYoQwQ1fxacfQ/b+2yqPke9qZNJ9pIN7tj1DOc1ODD4yawCShfZDVnI5LRnWxQbYQi7j+tplzU2QJhHgV8xFpTc/G72RyWMOhpXjOfA4GwiCtbOnf7hITNJE7w6SL0dF1OReNASUKVjP/8E1SjZLyWPXroXsisD12QHgvP0/8R2BgeiHV9Z+clMwJwyjxjggln92YynlNGRGS6+Fl2s/sGBtClKZSAMyoAQ8em4ksMTqsp4Xrc+rJEgYxFKFbfiqPG28jit3OrniBDm2MzhScC1EjmtJDyA3T1na0WuGXKJ5ropNptxDi+to1G0h0+zZxGsLolh59ucRS5UdQG+xmXOnmelvp7ywG8Ff1PwOlWzFuZsO6PaIfC4iNPWnyT1MeY5QSQJ4z8bK6ADExdidBShfSPF9AlJ48XchHJ/UBRbnuJ1F+KfllHgiL7H2hciE4NcYmrTnUOX20qptePQO+qM+EOedICD8gbnVjiB+ZaCxM3t5cP2/MF9FYegzc76nsqAkw1CAXAO5g54BkfXwsalpwSND2pZjVPYc9G0AxLWgC9/1C8CZQVpmemW7vsAFXo5T2fHsj1m991SlNI5fwnZM+JoqK79W1EhGgS+yYuz5GAD6iDZo7+8wLlpj3EbT2Fn5/yRwEWg4DPxqGMTwNGaSdKURgGSxwvAfEIFVnpaDwWusfky439cbvxrWYgQ7iEuyFszYjMW2aJZ1le/H0s Z4cOc3aS vT3UaDS65OU8feIizoJbx1wMoR8/mzlBxtGlZonFYcUUTf4Znk+P0AdslYvBUSESOijhl/HVOQ0FfgPcMZxD6H5FFdw5F1xaFLGQ0BieWgs81OSUubpSa3LF9dQsMzu31G4HrqzGM7Nr2XoMS6t0L2zVzlmsSIQ/bUpONr7HdomO/iWm+ZwDLv1w4kCHl1kWFExk/MufD0BTKeBHtp4YZRrSqxHCEJg6Q30gCueT25upEP8m53WZgxuXSQ6wt61tghcBuDZM/pkXFMSYGQeRXxAZ69I67GClJMxOQhfkMdsJ+A5MbpiOUww/JZDo7E5ofoFSrX2YkoqSVdX6N/LovYNgpI7KKUU8YV+5s4xE6+xkcMIKouUSoMrgKUguSWvrlGJZzo1xi3YAQBewS3p5A9f8Iv1u285WZk/RAEiFjvh3tbJZFELTA75Wz8+pMYCC7q8sVg2RaigjpMEVPxlVDBaAHp0LN33wbSzZ431r7p40FE8adJgUo7CwTYfdklTlPnF0YpHaPe3x2mCo1xQ8TvyzYHcQiKZSlIzfVfeR3ciKvp1CCE/DgVwkIKiHOlw8RZ98VMzx15ZFo0zIGt429F85mVAQq/eImr0s9BGA9PLEPH/8FxKxUStU9bnw/sh4tfqIJ 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 | 7 +++++++ mm/swap_state.c | 12 ++++++------ mm/swapfile.c | 6 +++--- 7 files changed, 20 insertions(+), 13 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 9859aa4f7553..1208d60792f0 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2903,7 +2903,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 fabce2b50c69..04d7be7f30dc 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5934,7 +5934,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 0aad0d9a621b..cbe33ab52a73 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1762,7 +1762,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 2de83729aaa8..6ef237d2b029 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -31,11 +31,18 @@ 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) \ >> SWAP_ADDRESS_SPACE_SHIFT]) +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); diff --git a/mm/swap_state.c b/mm/swap_state.c index bfc7e8c58a6d..9dbb54c72770 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); struct page *page; page = 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 0c36a5c2400f..2e8df95977b7 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -138,7 +138,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; /* @@ -2110,7 +2110,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; @@ -3421,7 +3421,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);