From patchwork Fri May 10 11:47: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: 13661464 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 38CB2C25B10 for ; Fri, 10 May 2024 11:49:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C1F8E6B00C0; Fri, 10 May 2024 07:49:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BCF816B00C1; Fri, 10 May 2024 07:49:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A6EEF6B00C2; Fri, 10 May 2024 07:49:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 854D46B00C0 for ; Fri, 10 May 2024 07:49:57 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 2892F140448 for ; Fri, 10 May 2024 11:49:57 +0000 (UTC) X-FDA: 82102317234.05.FDD2A4C Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by imf01.hostedemail.com (Postfix) with ESMTP id 4DE274001B for ; Fri, 10 May 2024 11:49:55 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=CfeTiJ14; spf=pass (imf01.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=1715341795; 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=R7lhdO5v0hVN0l2qTLtMelKVtmq+aBFR854K3Ld5uQo=; b=Ut+1/0O6XqWxmgle9+HKPSuhi0Wv9s76NfmGplJvKpLXYBo0bA8ioQ2E3sZynlj3IGV1tU rxutvzjNc2NHr+UZP8f9KXE5ePQ90H57WdNNOqlZHW3FEPD5tfSSlRSGOnNzHy2DZZAXjE okcgPtN6cXmsgHg8bwkmI+Xo98cSO4A= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=CfeTiJ14; spf=pass (imf01.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715341795; a=rsa-sha256; cv=none; b=UDicdUPzawiTvqY7aI5KuKmyayI2ymJRJKEJKuggM0/EmhyJylILNuQ0SPLAyyMWablFWH 7qBvwkkRCkx+Y0hLj5McgWQn9z1BV2IUnqI06FXbFQGlfMew5X0Hf+qH1k7hNdsBTcO5yF W8mKP/2pX+Pcm5aIVsfERsOKFsGnpY4= Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1ecd3867556so15623035ad.0 for ; Fri, 10 May 2024 04:49:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715341794; x=1715946594; 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=R7lhdO5v0hVN0l2qTLtMelKVtmq+aBFR854K3Ld5uQo=; b=CfeTiJ14KPWU8S+BFL+ZDaUHaFdonLUpaurlF1o/xA9NVNMkFjjcC9h9XahJX1sZT3 RwGCe4qSbsnC55QjKEFBcNX82bpT7ZRccGM1JNKlt7VoDGvEWatfxYlCw5oMNnrCPo0B oQXnrf7fNZibn92robvvB4kJ7ucdLXf+N4FijqoyT8h62qw9lT0NoFQw6CLlwPHGscr7 CvvyiXswrS1lqCca24Dk0D1FeJh9dv/k4s0hGXb2PLS4Yw+jRnlb0Fq7PRQJvDi0yBcq titOMPwaVkpFo3LChRCLx2v8mGDK1aOpqTPyVwosVwstQ5quu5oDVieKv+Gu85vMz8bq 8q2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715341794; x=1715946594; 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=R7lhdO5v0hVN0l2qTLtMelKVtmq+aBFR854K3Ld5uQo=; b=trGBVZLcHvVTzk2RI+QHTkeytx4DbD5iLD8mBfy3rpWhem1C2Q4ksLRQUasGXsWuwC rJY87Cjl5WmEsZjOiPMxksY44+KbpANKnxMvv0DPBFIMXfXnZDCZkf4QlfWdHUuCkAWm 5hBYC41Dtmf6Je6vyhNgEGZPCE1CvDBMqgSfgfUlRRBkbTxxwSFifkNxl2Bb8g7/uLb2 +AZkF01DL1uiOvdobe1iEGroxmeQh6Tp8ctbHjS+/oG+YElw/2UR3WBoCPSl9zwoWdAY JHz3eEiw6Bi9lunwrNngbbnqovetqdwiP1Au4VbuNgrHJx8toqyjweUvgmplAIjQjmlF oNNg== X-Gm-Message-State: AOJu0YweQOqrjnO0pCUVlXl/XCcE0OoPy4n8jUaR9gTI0v1KccJ//VMa cywaF3qQpXYIOVza33RbCZe9/gi27PparhBCtsxDFpMmw6gWk+9+mf/q5SPvIW2X8A== X-Google-Smtp-Source: AGHT+IFE2MX7TpHnes9SKnTNrFmEbBsmeG5v6bapWIi2SW3d+oyDfBCDoaA4IMTDGi9eLDl7rTjLlw== X-Received: by 2002:a17:902:d506:b0:1e4:24cc:e021 with SMTP id d9443c01a7336-1ef44050595mr28789215ad.50.1715341793856; Fri, 10 May 2024 04:49:53 -0700 (PDT) Received: from KASONG-MC4.tencent.com ([43.132.141.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c134155sm30183825ad.231.2024.05.10.04.49.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 10 May 2024 04:49:53 -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 , David Hildenbrand , Hugh Dickins , 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 v5 01/12] f2fs: drop usage of page_index Date: Fri, 10 May 2024 19:47:36 +0800 Message-ID: <20240510114747.21548-2-ryncsn@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240510114747.21548-1-ryncsn@gmail.com> References: <20240510114747.21548-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Queue-Id: 4DE274001B X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: xi5xc1zan6yshsiux3h4cri4tw8ojawa X-HE-Tag: 1715341795-359528 X-HE-Meta: U2FsdGVkX18OQmfivo8l8uEUCaqh/XMrEGCH/Ax4YTjpdKAnGZHBSATsErOgHajb3t7CyTmncqlzguKdbpGvyuroEB/sIfa3RiMwJYKPWgyJagP17Z6cEfX6EFzKmlDh45m3gBn8PVeLRk3zf6fPCELqIrIhqfZ5r4q/SKX2BuHz00Dvd9tQP62YmsayDJJnJWEddaJV6/iZ0y/7HWujU1Kv7Ui9zWMHMJa67iRrO2/WBZliZClM6p0D8qIxLKOsGgSxIWV9QLfHJJ2ou1t9ga3+Qx50L+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vo78MGh1vMJgekll5vqfjdQ00RpalIM7Dae2efS21I6gjNTRWKQzso5m+tY+opNjcE15pRWNgVjf5HztB5W0GYo65R0RmMF/Ti5rFlmnfLvQ51DmaPSXzE+Mtv14lWUZk15IAlfRFoPCaZb1+BNFB0NykaTUBuOssExPIVOeedYa9BfSZrHiZ/VZELMVoHq7loMINjeYmsoomqBlHCQPz/oUTy+9Y/mMO9/2uVTsSA/ehUphrACfsacNnmZYK0F7SuDhibSQRW5fZ8XN33Tk6OcmOXI/qkJpf4JdyBh1H64LBnwy/BgGuaMsBH1RHfejg3ZQZjtRLbstQT4XhLBjSupNyaxSsKg4Jg5JNESlH+ytp0JPWRwSoQLCvm0dByse2vVAnPNq6hx1Wp3+pSfhhwsztbMlHkKHo7UNE2JvnYO+hlbKzN3I/oTZ1J1d4BnGrDyXt6xEJwaM1NjnBPKykwnWs= 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 Fri May 10 11:47: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: 13661465 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 9BD1EC25B10 for ; Fri, 10 May 2024 11:50:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3233C6B00C2; Fri, 10 May 2024 07:50:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2CF9B6B00C3; Fri, 10 May 2024 07:50:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 121776B00C4; Fri, 10 May 2024 07:50:02 -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 E92786B00C2 for ; Fri, 10 May 2024 07:50:01 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 9AA3A1617E4 for ; Fri, 10 May 2024 11:50:01 +0000 (UTC) X-FDA: 82102317402.06.97BF7D3 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf04.hostedemail.com (Postfix) with ESMTP id B2F6740004 for ; Fri, 10 May 2024 11:49:59 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=i7o18FTx; spf=pass (imf04.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.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=1715341799; 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=AlJsO7PWN4Jf79ghcMCVByM1+QjN19p/5hJE9J581cg=; b=t+gSTP9Zv5XQHq3TKICW8/okqoqkOxZu2K/UdD/Par3uuCvQL0t0MA7X/WJ0d9C3XMr0kd S+atah1yOIrs3Ko81aVXHzk3vdOFdSrvG89EX3tFgyQUC6ynhKKPZt1nmPva82Wa39XzaD WghLKJ0G7KuV6rhc0TZ1OTWCA1M/orI= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=i7o18FTx; spf=pass (imf04.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.169 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=1715341799; a=rsa-sha256; cv=none; b=AoxpF+PGKNYUhLWwakvHP8YplUwS7A9BGu4tOVeEsA9WhUAvixBHhVoBBWggacpoJj4QS/ DmuKig7vUCHXBJsTUYxwReqJ74YXD8l6ZFJEfUSw1CbZodeMLkcpb5nP31gjVd8Yr+k+Xm i2fSFXXLtxy4x/XB95EkGCQegAY/2Gw= Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1f0537e39b3so1580255ad.3 for ; Fri, 10 May 2024 04:49:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715341798; x=1715946598; 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=AlJsO7PWN4Jf79ghcMCVByM1+QjN19p/5hJE9J581cg=; b=i7o18FTxnMfC0P3JuyDHto+bRinfsPZ+tRVfxbRiKeo1MgGVk+NsOh/ZQlY4GP/j7+ NX7KtSt+P9Cq8BnyWBJY5zGYGX5X7tCBmikFkxZVVUmBMfJLJ04ig7jDtbNG6XkJZpjD nWCut50G95pmbUUCHdyVgXyx60eOcjHtbnm5JigJJHVjo34JiC21RRYEexcFV55DrcGN gfE+EjNzFL9NTNT1z1Fm15X0m2LwGVQ4oxNR6Css1ZsRJkrI1D/YnGDAYYz/5HG8ZQUj xoqGCd6BkdEA8JuI+YTWgqFW5LarMD0FKEwFM1Mx3vGUAE94liP2MDbEYKwjzAUD5CzX ehjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715341798; x=1715946598; 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=AlJsO7PWN4Jf79ghcMCVByM1+QjN19p/5hJE9J581cg=; b=O09nlHEQXZg6Mnhy1VO+DkRwU8iyouVVyo6I6bC1A87guS0YpueSigNvBFTcy92lWO JSQzybLylMjyB5HlU5vJlAurpRl5/F6Yh2xg97SRI19M//IvLhxzB6GLABOBWCGbghgZ UtlbzEj2TFtWRUZ/IyO8kWJxJzwieolT6Im94oJfQ/kTDtUC/g4zpGporixz5m92ymQ2 q6VJ/hoedPJiGqii3vah5+Q3K/Licxrd+1LacwVpj4PkA4lMcZmgNPix5Q8UUm+OXykm /CjUOzlfF9lFKWYowktu2yZksjjbj03pJn0zJiBDZ8c/xxh0etp2ayWGg/iWeIfkZmfY tfug== X-Gm-Message-State: AOJu0Yyk0lsUZSNaqhXC8jpV8Ufg0zZkH4sfpBE89b3uVUh433JguxX+ D4BEwoqj2qOwxoNwVpFxVAESCvSiT8yIo9TRO31MEvpp7lysVz48d9H1cQQU2GcMKg== X-Google-Smtp-Source: AGHT+IEgC/5PItwGLdBO3mEfXM0RAVpswT1aq1A3QBfgABXJzBC0a91j/oU3l3ssnynmf+QFhY0xNQ== X-Received: by 2002:a17:902:c145:b0:1ec:659c:95fb with SMTP id d9443c01a7336-1ef43e25e5cmr22881935ad.32.1715341798221; Fri, 10 May 2024 04:49:58 -0700 (PDT) Received: from KASONG-MC4.tencent.com ([43.132.141.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c134155sm30183825ad.231.2024.05.10.04.49.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 10 May 2024 04:49:57 -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 , David Hildenbrand , Hugh Dickins , Yosry Ahmed , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kairui Song , Ryusuke Konishi , linux-nilfs@vger.kernel.org Subject: [PATCH v5 02/12] nilfs2: drop usage of page_index Date: Fri, 10 May 2024 19:47:37 +0800 Message-ID: <20240510114747.21548-3-ryncsn@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240510114747.21548-1-ryncsn@gmail.com> References: <20240510114747.21548-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Queue-Id: B2F6740004 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: n8ntxp6cmbx9hkr5tifztrqwuf5tunqo X-HE-Tag: 1715341799-395894 X-HE-Meta: U2FsdGVkX1/VlDy04bdhcNJucR3VVWvXOH4wY5kVRZm3oArBVx/LCO2E1zwl7e8Ky1AT1d9Pn9HXWL8hAvJfajyWQKiLL8+ktw8P+zIRcHF/egllDUckq7bJNh4JvmtnPXPIgkZ5vGvJwIzM8/QkWScDRIT3BJeir2YhsQayAnDE2z160n47ExQIzcXFHjcu5qQo9gG0nvDewKRkxxgb6jpR2BeQ1Xi1X2p2Gs27MZkxbRemmkxTRUClRRyYzqbviCK6YC8lrJ/noB0ahmROgL6f214fO1FdKIoQ4xzQRXsC4W8TUHIR7PGTLK6h2/BoVR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5BiWzhMq5UZk+DKKOjTov5JtoxVRKRCz7HEyLwoMgUuagMlQzUcpggy1F221CETvdB0vc3ZwEhBdeGXqUOjRQywi0udylH5Cre+n538uALHFTFEumRjVC8QcspwFjYEukjcrHWrWPmUDXrnO3ibO/OlFL0ldHt+ZpcuvRYg/kvfA1eHgYbk70auh6BG1jvS+x2YkwREbQBpOfAW7wA0iQeD/63ZWSWOhCYu50/08suVIe0qX+KqpemfwUxi5orjkdzxGlifd7w67Dcx5GKXNmGeq8SS7TevIM69rRNPEK3q896NYDjXoB3JTAX3v7B2FYxWx0r6atzwBJZdGZCuvAi/u8fjhZWIsaLfbdo9iXOuzBrh9awTExNriWqdRFXR5CRHNWXc+nd6eLDP6pQ3VvQGlseWNUIzH/yXxV6ow27DypB9CrqKztw1PKvMKhV5CBtyntJb3TJDYoo6cXrsNwA86hfLPPoTASbZLFYeUqg2WywzYZ3Jo X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Kairui Song page_index is only for mixed usage of page cache and swap cache, for pure page cache usage, the caller can just use page->index instead. It can't be a swap cache page here (being part of buffer head), so just drop it. And while we are at it, optimize the code by retrieving the offset of the buffer head within the folio directly using bh_offset, and get rid of the loop and usage of page helpers. Suggested-by: Matthew Wilcox Signed-off-by: Kairui Song Cc: Ryusuke Konishi Cc: linux-nilfs@vger.kernel.org Acked-by: Ryusuke Konishi --- fs/nilfs2/bmap.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c index 383f0afa2cea..cd14ea25968c 100644 --- a/fs/nilfs2/bmap.c +++ b/fs/nilfs2/bmap.c @@ -450,15 +450,9 @@ int nilfs_bmap_test_and_clear_dirty(struct nilfs_bmap *bmap) __u64 nilfs_bmap_data_get_key(const struct nilfs_bmap *bmap, const struct buffer_head *bh) { - struct buffer_head *pbh; - __u64 key; + loff_t pos = folio_pos(bh->b_folio) + bh_offset(bh); - key = page_index(bh->b_page) << (PAGE_SHIFT - - bmap->b_inode->i_blkbits); - for (pbh = page_buffers(bh->b_page); pbh != bh; pbh = pbh->b_this_page) - key++; - - return key; + return pos >> bmap->b_inode->i_blkbits; } __u64 nilfs_bmap_find_target_seq(const struct nilfs_bmap *bmap, __u64 key) From patchwork Fri May 10 11:47: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: 13661466 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 455F9C25B5F for ; Fri, 10 May 2024 11:50:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D09B96B00C4; Fri, 10 May 2024 07:50:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CB9996B00C5; Fri, 10 May 2024 07:50:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B33816B00C6; Fri, 10 May 2024 07:50:07 -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 924106B00C4 for ; Fri, 10 May 2024 07:50:07 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 49EBE141813 for ; Fri, 10 May 2024 11:50:07 +0000 (UTC) X-FDA: 82102317654.29.783FB2D Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by imf01.hostedemail.com (Postfix) with ESMTP id 6CAD44001B for ; Fri, 10 May 2024 11:50:04 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=OvhZbKBr; spf=pass (imf01.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=1715341804; 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=7WZK1EC9ikQfyuHFTfKb94AiIKSPD5K2lma7no+Kt3Y=; b=ZuS7M2Hxb+rRx7R3exvPFOgKLGWeyIB2Kw84ziQPd3aTMmKhTyxIn7viuti0zy6a66eeVU QZawz28sNfEwolgwwgkUCfEeEaCPAsWoRL9BYldwB41spM6cM3VWLZE7lP53WPLVnFbijX 9yEyHIwXDvRwD7BYO51hm6QkVZtKdEY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715341804; a=rsa-sha256; cv=none; b=uBTzPPQGh3l5lsa7quoVhwMOvF55z5g5vcAr1ECS8PQejYAEp9OC9Y40bz9oL8yDQgD4UU 0M5RZQNtuKV9bYpReGySrB3LFnAPLYZhSPGC+ZzSIyZXv5hSIo9t6vslw79KsPZ7OM1pcF uHgfyeNkFiSv6nRxRYsJzY0KL3XttU4= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=OvhZbKBr; spf=pass (imf01.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.181 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6f44ed6e82fso1710960b3a.3 for ; Fri, 10 May 2024 04:50:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715341803; x=1715946603; 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=7WZK1EC9ikQfyuHFTfKb94AiIKSPD5K2lma7no+Kt3Y=; b=OvhZbKBrfHt8OYgZmNk9IysW3RrCmLXD9kNiyZoT0tg8fA7QObh9iI51rAoK/BNcKD yt6//0lmOpjU5whrBcpKaxpKwTBE9qy6EYVjqHfOCkk2I5K++KFj+wNX9fgjSgwIlwVP IlfHcUFOmHXpjtqDUt857Nn36lblHOzVmmJtwlo5x2SWtO+Qf58OKBwexXTa/x/n5Iaq nJX/And+tqUTZsxjvS3IBKOKPi24roefqwpRaULYb/qBu7HF3vS1LH9gbaF3aPJi2RVF O42HJSWV7lC2+b40XuTNPEDbC/i0Mm86AWJBJj/q1wYK2VyGhtLWZvut4Xl4B67vbWxQ l8MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715341803; x=1715946603; 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=7WZK1EC9ikQfyuHFTfKb94AiIKSPD5K2lma7no+Kt3Y=; b=hwRrc14S741L3pJhj7DJ/9C7kSjPBE+T+mynBBDZkOBaoYkaFc7R95L+JbMXCplAGU QH13Ut9cf1rxUDwRLVIokoBnnr1qNrKjvItsbDRio6QaUfxSJDpDlExrKCcNBrxtvnUc 7z12J9cIhD8fekgGuqqjRBW+1JQ/Q+lTQwS4pD5st3RgUGiFBOWn6SHZV67m+isU6y6L fkB3YrA6O+KjyVvX1987wrNI0d1gKuY8Z0h8o/dk5xmFhy1GLgsARJSeVhr/kFgdi/aB 6G2Wmb09zbB214yvfJAbJH03RNygd9Ot6iNr+xPIxTMS+mSjMRyddK3pXzE0gfeh+gA1 EHjg== X-Gm-Message-State: AOJu0YzzhMZF8Tix63LDQeqcjefHIyPsRs9xbhr7ui2b6E8PeQ+uomBe UM31C4uevj9kHaO3fiF7dUgd+6F52fxCIBkArXQ/Q6iklb39kFVRvsk7J0l9IreqQQ== X-Google-Smtp-Source: AGHT+IGzJePUE/u2//e0nGqK25e74fSzzO7KZJDptjk5/1bik27/+5woaxZ+Rq3FhnwvPq89SZQajQ== X-Received: by 2002:a05:6a21:339f:b0:1af:dbe7:ccbe with SMTP id adf61e73a8af0-1afde103d87mr3133457637.28.1715341803002; Fri, 10 May 2024 04:50:03 -0700 (PDT) Received: from KASONG-MC4.tencent.com ([43.132.141.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c134155sm30183825ad.231.2024.05.10.04.49.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 10 May 2024 04:50:02 -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 , David Hildenbrand , Hugh Dickins , 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 v5 03/12] ceph: drop usage of page_index Date: Fri, 10 May 2024 19:47:38 +0800 Message-ID: <20240510114747.21548-4-ryncsn@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240510114747.21548-1-ryncsn@gmail.com> References: <20240510114747.21548-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 9zj7o3qrk5orwm9xztujnzkaramgsqgo X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 6CAD44001B X-HE-Tag: 1715341804-977440 X-HE-Meta: U2FsdGVkX19ph44Zdeza1ZSDi2jiRt6afX8R8pXIDOnYiL2IJukt2ONmZoQUm0hGg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HHNQsaFsMuOJJyRMOciXKrX0FpFueMh7kJLhxXjosZO0j795pPUArrH25HWqpRnSY++KR4/Eg2UR9h6ZkdoiCZ1CfSzx1oGROxwz6AcBaMsWMZKO3ZE929JSgEcuI615RQmg24HGb7HElw9fuQOhZaKzEl6A5Drr9Qw6fcCRMOa3N8kQ+vmHWP78XVswGi0keTxHGErZtPpOjqKZ3/FC5aBJDlSaIZ3WjAthx/0vmWe2Gwy0UanySjLyC9EqAmmLbakeJccrfT51gw8o9rYlO6owpNl4jW5vzAYw+p7wyPFQ1Yx/lK9Jyw841T9Ul2MRYyuUXFuNmVkXN8GSG1b37VHPMQ4gOfqo/9hgtzWgtec2WLQb5T44s4s8pbQrcCnqJyG5wJI2+SBT8qfIlxY3/FO0AxpylB/wYGe/Tb7rvJ+nldTom9UF9Xr47Lz/CMoW9KwmhCoFqUiCZf8QwEdin2oggSjcBxQ5fvuUsBg30HnPeRVmWAHplIMp3LpLb9rGLR+z5Okp6lw35HTvdD8aTBSDAQo1svpGJvBm59onSBHtGDKmGedjt1zVHFEftMviY+baz4Rnlp6ocsqkEWtvZQqn9O/pFF781ywl6+fLzLIQwdAtkFWwVHj3OWY0bt3uMwaCTfTlRBcdOCPlF+Ni3clcCo54njNk0cx2VZRSCNi3yfy87BoWaUEnWwuqYGVB6TldMjP+jppsIR1pk19vD0MJaB+MyhD+0= 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 Fri May 10 11:47: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: 13661467 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 6C61BC25B10 for ; Fri, 10 May 2024 11:50:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BD2016B00C6; Fri, 10 May 2024 07:50:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B814B6B00C7; Fri, 10 May 2024 07:50:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9D5626B00C8; Fri, 10 May 2024 07:50: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 7F3E96B00C6 for ; Fri, 10 May 2024 07:50:11 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id EBBCDA27E4 for ; Fri, 10 May 2024 11:50:10 +0000 (UTC) X-FDA: 82102317780.03.A2DCA41 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by imf16.hostedemail.com (Postfix) with ESMTP id 13095180015 for ; Fri, 10 May 2024 11:50:08 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=CdeJ9f5e; spf=pass (imf16.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.173 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=1715341809; 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=T/Y01wUoc8GqRpvXAplln3XTaKFYbBI0hlcfHL66MPg=; b=CiRGcTN9076RCCx3JbboC9ey9gsGezSLJuuY6qmeLrWZnE4wllhhC1Uxf8lmotp7LkDvE5 PC26YITpPqTAawCyg55LaxhGJhggl5Kzb9NwhUOEINANCUoH0WyzMQp1e0HFuloMSVwFND ktlQ5wXj2nFOFGiVSMf9sdirrKmRFwg= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=CdeJ9f5e; spf=pass (imf16.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.173 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=1715341809; a=rsa-sha256; cv=none; b=Uxs+ildojOQa1QlrG97TAa9hqBdCqPy/kmNmhxhuVe79C/fumbcb/XThXURKG4Pwr5yRRu 985zC3uLXxygIr81OFc4Lv/UwwwWmzJevJ1l/fAJMZbih1YEHDqbwOU+hqUHxrpf/EYlrK Jb9yv1EtOK4O6Fq3zTLoEb1HWz5Thag= Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1ec4b2400b6so17487185ad.3 for ; Fri, 10 May 2024 04:50:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715341807; x=1715946607; 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=T/Y01wUoc8GqRpvXAplln3XTaKFYbBI0hlcfHL66MPg=; b=CdeJ9f5eWm4h6jE/iDusG0ruaLS8hXxy8qo6EfLsqBJuRsR9YpRH7Ppx24mTf117+r emS9AXKxX7MijsHh8tT+ie8s9LqmS+6Zj6AflsoNBsbBR93fdS5hHZYvMFMZ3TazRPvE ABzzOEzBgnMlK+3JPnrA5dyJi2BNDVcN6hzA6UFShL+7elQi2ozZF7SXA4UUF4gpqx51 q6KVgxlYSefA4WlEnWtd2VQzwwVN4S4QqLW5/v0lEVkyZIEUkdRK8rsbvN0KBI5CJDaa 8+WVXsnj96F2n9CTqHGHTOAwfoC+NVwHOWqXqRzUbuTYz71Qw78qev/7FoGYx/8jQ+3h R/WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715341807; x=1715946607; 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=T/Y01wUoc8GqRpvXAplln3XTaKFYbBI0hlcfHL66MPg=; b=Dfe/a3RmviV8JeNziHGtL6KZV44FVbaXk+DsZccPIceFXXbMMOcPbVP/AW8yOdplJ8 spRSCjfwtMFf7NwUlA5Nwae/SWiocXmPeexmtNwechd9z0t0Bt239+O0Yb8O4bFQJtbd fp0XFaBOGvLLDm+5qQrS/Qi0Sll8GUrnHGPvVWQ8eFj9KABp/hDNIFCIgHXl2jtqeoZW j42mvkJrH8EinNOe2dSAK4kF0ovQXfovkxoqtFcOP3qyrZudFB+zRnPAF0KB2YI0pPg1 QW/t0qfwJM3IO6VPWLu6eXy1hWF9KZfbIARD1Bffe/R2vFFGmXHsMT9Dfg48X7qYagNP OM7Q== X-Gm-Message-State: AOJu0YxLQO4xLrnoUXf9n3ZuizpyYPS3Bb8z9iflto71Fd3KdLYRB04N BvRsTFSViI54IU8CnaaeVnddgWoN/+tcDUhQoUduORhf1xbdYI0ZCB8VHUNcLZiS9Q== X-Google-Smtp-Source: AGHT+IFzfIkLucPk4sXxl+wOh9wZthAGLSllywtwnMpoejVUjDeq2V0rnDLW1ag2irzlv9JXvgqNKA== X-Received: by 2002:a17:902:8307:b0:1e7:b7ea:2d61 with SMTP id d9443c01a7336-1ef43e26bc4mr20776495ad.37.1715341807566; Fri, 10 May 2024 04:50:07 -0700 (PDT) Received: from KASONG-MC4.tencent.com ([43.132.141.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c134155sm30183825ad.231.2024.05.10.04.50.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 10 May 2024 04:50:07 -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 , David Hildenbrand , Hugh Dickins , 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 v5 04/12] NFS: remove nfs_page_lengthg and usage of page_index Date: Fri, 10 May 2024 19:47:39 +0800 Message-ID: <20240510114747.21548-5-ryncsn@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240510114747.21548-1-ryncsn@gmail.com> References: <20240510114747.21548-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Stat-Signature: yyti8rx75utqh4au8ness5n9dc6suzx4 X-Rspam-User: X-Rspamd-Queue-Id: 13095180015 X-Rspamd-Server: rspam05 X-HE-Tag: 1715341808-351615 X-HE-Meta: U2FsdGVkX1/UzSlHM1TUMlUlRiEPYOFxOg13e1IMrHtoLnpVI3nROrqD8zCeaVUOwyq0+O+vYbwQsQ+DKewz5imUqotnnZvMt3PMRTlmzCHvKZHyi8M12fseK+vqjLmrkQzEee6uYygZU/Q9xPB/uu4KKbAmK8gXoQMEzS7aM7lw0iKF7ZfCLwWleBkgP/4jg8Kxkb4kBas5ykY1+N06ph/4eTbrw3UF9Xe0h3nZCEwQxAAVSQ1f4in6Df3o5bIteSf6a4vwF4iTPQvZ+5gCDngeV9N0JUOVAhvaRDogzHRX3IkXGBeWtwG5k+DoLbeojn2Cnz1Uw15s8f+eMRv1SZY5GtwIOngNdIq3bVZsoLYm8x14uCEbXP6GqwIe/Wcb/af7ERQ+RDnXVPZ7qthg2WohU7E9ekUrasvVeGyK0BDr1WVap8REDptj2VIdacZX4Bz34+JfyynIgAZlZB3/IIQPJTcRx2ZviuTIB7jzGECK01u70tdaQTaeaKJitsrtYSnZhdxiZrixsFMww2tj1i6lw9Vd63dfe8tuh+gz485V4Hwp+gyule6BVl5Z19lY7oXMpVwjb7CZBbhWOp8JADIRfbDC/a4H9OEBdC7FzBf5MkxhjLHtEtmWa199B15mdz6N9sPVgZhgezDLa//ODTE1iH0Tn9nkiAvfb9Y946DJbyvJS/oFkqlrX+JvVvY9TZYhfkZA3YqrjiXAoCNU4TGi65/WyB5Ld6jJBt+rXMfII8Ac4P3K355lkEqRHTzcMas0fuZSnk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GI= 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 Fri May 10 11:47: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: 13661468 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 4D450C25B10 for ; Fri, 10 May 2024 11:50:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D7E9C6B00C8; Fri, 10 May 2024 07:50:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D2E486B00C9; Fri, 10 May 2024 07:50:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BCEEE6B00CA; Fri, 10 May 2024 07:50:17 -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 9E9A06B00C8 for ; Fri, 10 May 2024 07:50:17 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id CA93A14180E for ; Fri, 10 May 2024 11:50:16 +0000 (UTC) X-FDA: 82102318032.12.EF42988 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf27.hostedemail.com (Postfix) with ESMTP id F31F94000A for ; Fri, 10 May 2024 11:50:13 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=EioR5OnB; spf=pass (imf27.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.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=1715341814; 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=SKkpoPGaGqkRG+GvEkaimZUGHi7Z3i5I8Zq2egM0XJg=; b=XHb54HjhYT3voZRwdL90QIhrCwPTRL/y74ZLtzutv5su3aCGmt42ZWWSCCDrbMGFGl59+t ogVUjMTyxsipTdEBocSCe2h/HSQWhDNPSSnDZPhkpbfoQjZjk/k5i1Xuw7tI+/iRwCw7CG 3pCwPa+C/m7GU9Rj3HSinVvB7li0se4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715341814; a=rsa-sha256; cv=none; b=aLkeV5E+GUduNX0/GN+qaa72UhovyS4RAprkcVPM/hv7qH9R985RFVKlvBmqQ+wT9WLbyz C4YlJRjc0lnurPgRU1Vs99/nh7WrmpWBylsyHV4u2ziYMKKiA/ffjNzWYuRSp3sS9+zejc AwrHYkdHoB/tKWoO+bmaJxGcZBPjCbA= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=EioR5OnB; spf=pass (imf27.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1ee38966529so21357655ad.1 for ; Fri, 10 May 2024 04:50:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715341812; x=1715946612; 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=SKkpoPGaGqkRG+GvEkaimZUGHi7Z3i5I8Zq2egM0XJg=; b=EioR5OnBxdY4Gk1jz0mRfajNzYc7Wx60Ik0JH0YcNV7azQ5UNrrkVCUbbdq1W+HWWU LCvwgqvN9DrHsw12zNVjp6IU0MiUUdzJsz2MdGgt2LatPT9Leq1WHxz1Oh0yHVeh2Nsj 9lee7llb8XCscEF15QxEDssjvurooqck0XxESewLipaBMA4TX2erjtJlNsp/OgJW2sBi y3n6NxiK95bi8VJsEnXZfch3m9gi4GjHqBzxmDJ8nW0O37B8ou5WdYFmL0yC+6dB2Esh hOnEiUOsQ29NoQDyHGo4J4fw3OmUK0XTZ9dHVumEulx22gu01g8zD3YgKSCa2+vk3d+k D62w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715341812; x=1715946612; 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=SKkpoPGaGqkRG+GvEkaimZUGHi7Z3i5I8Zq2egM0XJg=; b=Uf8+UBLELmRjaC73u2LYxbeqnywCwvb50b5BQqjHYoXo2lknLbd9OVTtwpCptAk7C7 k2tW1NULEcZXh1AgO2WHSMAvBCGBIlOf3v+y2Y93V6n+m3LwZPNK+99DvELSImXr39P/ C61syTFUNvAiYzw1EVvgNgYKiOe8I0eQB08DPF1zNhoaUHsvQDiyDBhxP3rTiton3mSm ETOoEO61bZ1x83yuaJ5F7wyswCvcmGpbZAJIMmPa/oDnYvS9n4S/zUfQOtBqx99Jy6yj dlXrIuMcyGgPbft3Spfo8DDRndZuqpeNN8iPwbNPTdMS27dsES8Hrcheu1icEImQoXwv MlXQ== X-Gm-Message-State: AOJu0Yz41SkQV3gDB4X/+SSNQp1epmW5KWIIewCluY0jFUu9jgF3Jigw UxDMpykikcp7LbKfJAQqVjSym7HOeBDYcGZzggbbWHRQSbDrj2OeM6nQStSLL/27Lg== X-Google-Smtp-Source: AGHT+IFQCmuUzZejhKR+NA0CyPkuBm+fZ6cTTLFHyaCrgsSueVY92V2AUpJszgttMrtwpUbv0gZENw== X-Received: by 2002:a17:902:cecc:b0:1e5:1041:7ed4 with SMTP id d9443c01a7336-1eefa12f408mr84798105ad.14.1715341812566; Fri, 10 May 2024 04:50:12 -0700 (PDT) Received: from KASONG-MC4.tencent.com ([43.132.141.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c134155sm30183825ad.231.2024.05.10.04.50.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 10 May 2024 04:50:12 -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 , David Hildenbrand , Hugh Dickins , 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 v5 05/12] cifs: drop usage of page_file_offset Date: Fri, 10 May 2024 19:47:40 +0800 Message-ID: <20240510114747.21548-6-ryncsn@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240510114747.21548-1-ryncsn@gmail.com> References: <20240510114747.21548-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: bit4trunsc1g1mftyamqa1p3h1urbhe8 X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: F31F94000A X-HE-Tag: 1715341813-67706 X-HE-Meta: U2FsdGVkX181y2d5zCuI7iMzIFAOP3IOwTL02VQulKIfTUwzfWCd0sshCx4ZPsW+HMgpAQ9jEx8zNuTwo+pM4s8v2Co+DnBRW3J3V9pstYhe8Wkl6xVTWR0L7vzbRhnBoVIZn9XacwLHHdUpdY8avol0qxj9gOyNSC7PrYgs6SnL3Ztquo01MLkp5CZJmHCsxFTKDioFEGqYAVVsjrtaOlzsWYgRSxlOxcC88hHIlIwS2UJGngtfJeYyI9cGZuFbGbcCk8OgnLvMRTcIhb2gjLf5aHh+TdnYcLKnjyT7ril4nM3pvW7nx4Ol3Qj+DcjUeMfjs7UfCU2sl4J5GdJwRLak36q5782gHCLXpZOW+XO+F0OTVqsxea9qB2RrLar02tHfNLoBmf138d/C2o5RqWWZ+mE+bwxpf7K17qQnMHlTGdzXTe1XOmoalbkz/npuJOgwZFG5X9ZFeCsTH7SSHUDfPFaNf37B71+jmutVmSDm0PU/ITRuVGjsQI8umhazO9vymFJc/Xnw5Ro7qfBTF1Fa5hzFmQEDO1kczf9/9aCLu5TmFfqI47uzIuAkuR2dHaAt1NUyd2F/d0R9hGUorC2K4wZdFz62sQQc0YpZ66hXk2SR+mGx5b3dumRCGMWBuG2HOTpKh0olLvPSRLWXIGCrPF5/Ku9TUkcaDbXZzTMuaTzbJ75qloqkj148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iB8Mui623oTATYewZlOnazxq6zFmWLvD4x3aBEPqtFnEuSkWias80dSqm6uyQIrsAY2owQ/JDbub+aR4iH+8ory8wEa3VwN0XBUT28E9QrMG0lfYMqRtNIrcnzAF5LBeSlEfY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Kairui Song page_file_offset is only needed for mixed usage of page cache and swap cache, for pure page cache usage, the caller can just use page_offset instead. It can't be a swap cache page here, so just drop it and convert it to use folio. Signed-off-by: Kairui Song Cc: Steve French Cc: Namjae Jeon Cc: Paulo Alcantara Cc: Shyam Prasad N Cc: Bharath SM --- fs/smb/client/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c index 9be37d0fe724..388343b0fceb 100644 --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -4828,7 +4828,7 @@ static int cifs_readpage_worker(struct file *file, struct page *page, static int cifs_read_folio(struct file *file, struct folio *folio) { struct page *page = &folio->page; - loff_t offset = page_file_offset(page); + loff_t offset = folio_pos(folio); int rc = -EACCES; unsigned int xid; From patchwork Fri May 10 11:47: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: 13661469 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 7FCC7C25B10 for ; Fri, 10 May 2024 11:50:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 126466B00CA; Fri, 10 May 2024 07:50:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0ADAA6B00CB; Fri, 10 May 2024 07:50:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E8F996B00CC; Fri, 10 May 2024 07:50:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C7F5C6B00CA for ; Fri, 10 May 2024 07:50:20 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 9131A140383 for ; Fri, 10 May 2024 11:50:20 +0000 (UTC) X-FDA: 82102318200.21.9933392 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by imf05.hostedemail.com (Postfix) with ESMTP id B180B10000A for ; Fri, 10 May 2024 11:50:18 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=BagXCwRt; spf=pass (imf05.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.215.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=1715341818; 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=P42QJurgga8X3tClV+VU5iyd0pTaBz/Ss0EAkzfZsy4=; b=rS/37PPNvDZqWbEbuQWequu9e7MqSVAx7mMa50PrhVqLLwO34o3eX45Pp6u9ngLH7meC9x r49Y2LOR414OmMMq4QSMXC9nEIyu4cLuCabWqyuvzA/0mDaImdeQzEq3CfNmKYFbaqSASW 5RAh5HK4FiI2Xk5uLfG2dA6omf3eC50= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=BagXCwRt; spf=pass (imf05.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.215.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=1715341818; a=rsa-sha256; cv=none; b=7KqoUJS7YUSWodn95pMoYadqyCQWrDhA4c8MSVAlxmJuLuTN0KL/kNxc4iFRW+2ZsG8und bVpn7GO/C4tzPH2FLAR4Gasu3MgdfDA47qyQt1/aG3oyQsUWt1ljVkPqegCdRP2sizkCsU OvrewQQpJa+Jz9EAnHka5EuAnjSHAVg= Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-6123726725eso1642707a12.3 for ; Fri, 10 May 2024 04:50:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715341817; x=1715946617; 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=P42QJurgga8X3tClV+VU5iyd0pTaBz/Ss0EAkzfZsy4=; b=BagXCwRt5KtqR2ujnrRH6hDu8621qUDPBfzxFyUcFZgz/bQIBePvmRnLP1tXfKC5k3 ALYjw9/Adr9rl8ssxoJo4auuUO0TAXZluq4hTWnaha4+niIPZyXLyHokEYqID1TNC37R YNRWcybf22sGEXBt422QPzjbPFUvE5kHmhflB5CjE0JR8MIBvjuyVebliKdxAyw64Rh6 KpDyHJSbXVDJFZY0B1OSQ/EfCxHBvan9F8AQA+jEy/aqziB4ogE2XO+/LGjtiCy0ufZI 6eaNdgEjXy5q8jDHDk9t9IYcwCt8KY2zOOz0eW7sIOchWa9r8YySkClTtgZsK9lEaN34 f39Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715341817; x=1715946617; 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=P42QJurgga8X3tClV+VU5iyd0pTaBz/Ss0EAkzfZsy4=; b=hkGguFVVL/q/8VYtlPdgaQr7Xyw0r6tFKOmv7qfGUU7iV/9pShL2MPbCthsMRGtqrN VazUqDAjBMEcgJS/dSL+oGw2uVFZEVbQtABXTrPt0AVLtBUDgctKz0Ys7Gc+g0CnSpPb W/uR50LnvQGP0S8ZE3aCl3vpre0OYMQ8sHYzWoj0jieMRcfVMmeZ+GbUE5A71+m25qMs kpOyGehhdIUwy8FG7ZYF25EZxtZqe0BXfw0PZs1ss+/Aiw3Z4MHhVpRoySpHZcvsw8rz 2/lBmVzKhsg4/slughg0EyFZekOSlcZRHnha6kYPeX+xjGxQlezVnGX75PW7AzR/mUu1 eq/A== X-Gm-Message-State: AOJu0YwpB0bANNQX7pPE+Xrn8UeWcC6I8gM33Yv90R1zXFuw4t2MH8aN FNT9jkaTYmBLVeiG7PSyoQ9BObSXlRj8pWseAXiah9j1C6yuEJy0WS1LrMqUSpJu3g== X-Google-Smtp-Source: AGHT+IG7UAvfga0ZG2yNv2RJVoigr75WJ+wAKzDPiq9W3zLhf2/XYb9zpcIAAYXrq2V/r060tL2Rzw== X-Received: by 2002:a05:6a21:3991:b0:1a3:dc61:926a with SMTP id adf61e73a8af0-1afde234e8bmr2652358637.54.1715341817254; Fri, 10 May 2024 04:50:17 -0700 (PDT) Received: from KASONG-MC4.tencent.com ([43.132.141.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c134155sm30183825ad.231.2024.05.10.04.50.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 10 May 2024 04:50:16 -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 , David Hildenbrand , Hugh Dickins , Yosry Ahmed , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kairui Song , David Howells , Marc Dionne , linux-afs@lists.infradead.org Subject: [PATCH v5 06/12] afs: drop usage of folio_file_pos Date: Fri, 10 May 2024 19:47:41 +0800 Message-ID: <20240510114747.21548-7-ryncsn@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240510114747.21548-1-ryncsn@gmail.com> References: <20240510114747.21548-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Queue-Id: B180B10000A X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: gy1pytn1pfzn5hjze39hze3ypwp11gkp X-HE-Tag: 1715341818-896433 X-HE-Meta: U2FsdGVkX18qmCM3LiVh3Z4s3nmY7p+FBceA5HCZHDKQzklo5vXBTkRvhIvDgMEj/jftjwVf02MarHbAcE4sRBVLpwEBlwoa1dSc2RTBTRjz0Z91MiCMn+h9v064HUxv+5CsvpjbTswl4hE5BFWyLS8JlLBE94U5dI5EFgYBgSSWEZ1/Mtbjj9aDS2gDjPSI5UGFoFsXLekLtZPP0vrqJTLsJh8trwdUswniDbBJnJ5jQ7S+zHc9FWcIby6SB9/bMHwZ9f4ZkIjBajLyww1fmuFNLCRvAgYTrVmpR6BFypUGTcXZ/3zbBJOzibJbY1XIgeAT9E8/oHy3/q5daArjnYVfKAR/wYN7H7zYMqK4qapbkwJ02xvM4+n9FrMFeyA2Umc3KgmWcwsd77dP+kN2iU3+Go/Em0mXzAP1O4ANPtFJtDaVpSHFKD3awgrHi4N79EfaL2MjqpdyTXLgjLLOyAvwwIK46+YQnSlPY1hGX/VUYr9O5g1P9W3Cx0VcN69ysw6E1YCguK40wrkFzrtPgHGn9OHO+rA7j2z9fdEhIkMV9jUen52eM9s9mlDNEzqIt3vXTc1K+go5hzYBrUewyNZLRx5YiKQt1w/W1a8k32JYvDqVUExMwO7ubtpskc13OB361plCmHJzDeUptB8kYArQh0dPcDpNZRPWGj3VWBDJRVUX2QIZ3NzsFEGyf5FOzVeN1Twer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dK5hwGoDtSvYovGxZ4nuQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Kairui Song folio_file_pos is only needed for mixed usage of page cache and swap cache, for pure page cache usage, the caller can just use folio_pos instead. It can't be a swap cache page here. Swap mapping may only call into fs through swap_rw and that is not supported for afs. So just drop it and use folio_pos instead. Signed-off-by: Kairui Song Cc: David Howells Cc: Marc Dionne Cc: linux-afs@lists.infradead.org --- fs/afs/dir.c | 6 +++--- fs/afs/dir_edit.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 67afe68972d5..f8622ed72e08 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -533,14 +533,14 @@ static int afs_dir_iterate(struct inode *dir, struct dir_context *ctx, break; } - offset = round_down(ctx->pos, sizeof(*dblock)) - folio_file_pos(folio); + offset = round_down(ctx->pos, sizeof(*dblock)) - folio_pos(folio); size = min_t(loff_t, folio_size(folio), - req->actual_len - folio_file_pos(folio)); + req->actual_len - folio_pos(folio)); do { dblock = kmap_local_folio(folio, offset); ret = afs_dir_iterate_block(dvnode, ctx, dblock, - folio_file_pos(folio) + offset); + folio_pos(folio) + offset); kunmap_local(dblock); if (ret != 1) goto out; diff --git a/fs/afs/dir_edit.c b/fs/afs/dir_edit.c index e2fa577b66fe..a71bff10496b 100644 --- a/fs/afs/dir_edit.c +++ b/fs/afs/dir_edit.c @@ -256,7 +256,7 @@ void afs_edit_dir_add(struct afs_vnode *vnode, folio = folio0; } - block = kmap_local_folio(folio, b * AFS_DIR_BLOCK_SIZE - folio_file_pos(folio)); + block = kmap_local_folio(folio, b * AFS_DIR_BLOCK_SIZE - folio_pos(folio)); /* Abandon the edit if we got a callback break. */ if (!test_bit(AFS_VNODE_DIR_VALID, &vnode->flags)) @@ -417,7 +417,7 @@ void afs_edit_dir_remove(struct afs_vnode *vnode, folio = folio0; } - block = kmap_local_folio(folio, b * AFS_DIR_BLOCK_SIZE - folio_file_pos(folio)); + block = kmap_local_folio(folio, b * AFS_DIR_BLOCK_SIZE - folio_pos(folio)); /* Abandon the edit if we got a callback break. */ if (!test_bit(AFS_VNODE_DIR_VALID, &vnode->flags)) From patchwork Fri May 10 11:47: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: 13661470 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 89A47C25B74 for ; Fri, 10 May 2024 11:50:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1BE7E6B009B; Fri, 10 May 2024 07:50:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 16F2B6B00A1; Fri, 10 May 2024 07:50:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 035B46B00CE; Fri, 10 May 2024 07:50:25 -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 D7F7C6B00CC for ; Fri, 10 May 2024 07:50:25 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8BFE841310 for ; Fri, 10 May 2024 11:50:25 +0000 (UTC) X-FDA: 82102318410.11.B2067C1 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf25.hostedemail.com (Postfix) with ESMTP id 9E1EAA000F for ; Fri, 10 May 2024 11:50:23 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="kT2U/2Cv"; spf=pass (imf25.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.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=1715341823; 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=r4pI/dLra8+Fx5rO5TUtIiOfN5ranfVQtnPo5N4NowI=; b=UxbJpMpOk060jkXK7p2EJaOvgq78MK69JH1pxcnH8PjHMIA9KmcTqCWguDMz9qKqVbs0ri IUsLz2VevE0GZfyrNkvyUvaOq676AVgbYwO4Y/QCH2/UNOu9HBp5gMzfpcMu86cG+X6dxv l4cUiKZT6wskBK/ZLQnZx4QjitrvcGw= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="kT2U/2Cv"; spf=pass (imf25.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.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=1715341823; a=rsa-sha256; cv=none; b=RLNXDTCo6yrjRcHkJWd3IiAesOwDSYbMZxe3zn0vRnF+5fi96Vssf0bO3kJIbSxpKbq/or TGI8/E1A786YlstJfX3hlUg9M2H2OG7qAkMjc21KeGfTYQqJ555s4vgwDxKl7Qj5L6jgr+ c8WGSqZumeYU3SwpHn055MllrQY6x94= Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1e3c3aa8938so13526225ad.1 for ; Fri, 10 May 2024 04:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715341822; x=1715946622; 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=r4pI/dLra8+Fx5rO5TUtIiOfN5ranfVQtnPo5N4NowI=; b=kT2U/2CvH0JDwG9IPh9K1kAb51Ew0Od8B2NXJQ1dSam7+k1k5qiokSVz4XjXZncWxS rtfI/6bX9N6kDrD+9tOtKAowFq0c7djEHlIuY9vH6y5yr8QNUYeEnKtmA57hmz72mJKW zZeRyRILT/y2WNuw/HTidUOIAPtpxXhHtCDYK6PusdIbkH4IeFwkWDpzrCSKmNa/qIBV +7YnyUWjJvfbMVo6Rwm0H9WXX0E0J0uIhyB+XE/NHhpdLEMKv7TvNy8E5UCR28D+rmJC LPGGK1O8B9vb0Rek4pmL4zfkt3HZEktE4dZLhrRbqXdjIPPKYr91j8EWW/wVB+a6u3PJ Mxrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715341822; x=1715946622; 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=r4pI/dLra8+Fx5rO5TUtIiOfN5ranfVQtnPo5N4NowI=; b=CscMvvBlkM/E4cw4JWbnXO+7WPTqCkuqQdIjV0gL6IzF5AY/9ft+ptKJxeaC3DJ2Bs /hri72xkjsleGoHlaroooPR0TTDzfG0uI2zPUhiifGcpRz/9lwWeMV+SlJ0AY1/8wJz0 X7kWyGm4r91FGDbqV5Dl22ImC3wmvR3GmW6Hemr6xWiKu4DBrC2CJE1y2m0BShjYcNyG h1PXjJS8bWdHBljmSPYGFXf5YG195r4iJpt5gk3jC8OE1gduy/rPuMxXMCjIRGVKZXl3 MwnEbybhimBQo9SLQDABFHJKiOi4V2EasQ7tYRUO5G/kV9vX9PkW6cDdW3SnnZ5hvj+R LNHw== X-Gm-Message-State: AOJu0Yzi926sLLspAgFNuvdN7ZeGo796AI7l9ki9tJv0EVhmB1KgJqpx 9uNwfj15+GSoTnhQTwzaaVQXpdDhKknuQ2RRAtYU6EYuEx+VjR1VNUhuX+yUFmkBJg== X-Google-Smtp-Source: AGHT+IHSu4vf1uCLF5qFTJHXuHSvWwDd6wRy4AQCNalBLaHz4N+8wZRkLwQ24nQsMv4SDXunk7nJRA== X-Received: by 2002:a17:902:dacd:b0:1e5:62:7aaa with SMTP id d9443c01a7336-1ef43d185e9mr29151095ad.20.1715341821906; Fri, 10 May 2024 04:50:21 -0700 (PDT) Received: from KASONG-MC4.tencent.com ([43.132.141.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c134155sm30183825ad.231.2024.05.10.04.50.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 10 May 2024 04:50:21 -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 , David Hildenbrand , Hugh Dickins , Yosry Ahmed , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kairui Song , David Howells , Jeff Layton , netfs@lists.linux.dev Subject: [PATCH v5 07/12] netfs: drop usage of folio_file_pos Date: Fri, 10 May 2024 19:47:42 +0800 Message-ID: <20240510114747.21548-8-ryncsn@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240510114747.21548-1-ryncsn@gmail.com> References: <20240510114747.21548-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Stat-Signature: jjkt5td9j4it6dpf5zz93z39cnt7kohi X-Rspamd-Queue-Id: 9E1EAA000F X-Rspamd-Server: rspam10 X-Rspam-User: X-HE-Tag: 1715341823-567671 X-HE-Meta: U2FsdGVkX18U3dAd23ZGiM8hHPmV1gP4u2t7ueOzxjtvzwTNQHolLOdX5fVdwOKd1pxqEQhscVTd8BDouUf8mB19ECUxP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IO5qbwvE+RxSnZM0e7BKqcafA4tf1+PTG/JVuhz41nv9rAootbI0RVIDC1CtY9ariyz2zkX0vrvx+2ygBhZSVV4CqhSbtZwpsa7ZL9EQqHMfYbXqgaedXCiH7eJ+O88Sk7OL6RrVEu+tosTtnN62/+peIbt8cBtCMGdYgd+2fDSnTtKuRRtOB3QVCu4eHMrX03SK/kYmQJXYkRWCBBZjiS5o6j/tEZeCz28cZwF/0MenzR0eG+wwLW2Aspp2hF1FeyiIOzmCRJHh2SiADLmNFfqx7GMGUwPznMSOsn3BKbj+bRbQea+2pYTqsGk6xTgQ2mc/R4UmAS67Vz63dXdaC6CssEyfaDgMKd8kFTFHzofEB2TSdjzlBmbxssnDNO3RbUv5uG2Hvb7D9jotZXfcuIQS/NXfOGXrtO61cmiHgQaeJ2SSAshMBRryVV6ivPM8siUA3Oc+HsUCiElAR9ffuPXKzjZYKZDuoDv1++/1AfJ7njg/HZNHYr4vjdUodtRJ9k+wsVRO/bD6Zp946VriH07jTZk9btNJ0MVyRAf0xUseDS66j4hCKRUaBhWBt65 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Kairui Song folio_file_pos is only needed for mixed usage of page cache and swap cache, for pure page cache usage, the caller can just use folio_pos instead. It can't be a swap cache page here. Swap mapping may only call into fs through swap_rw and that is not supported for 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 Fri May 10 11:47:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13661471 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 A0B97C25B5F for ; Fri, 10 May 2024 11:50:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 393B86B00CE; Fri, 10 May 2024 07:50:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 343AA6B00CF; Fri, 10 May 2024 07:50:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 20C166B00D0; Fri, 10 May 2024 07:50:30 -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 018DA6B00CE for ; Fri, 10 May 2024 07:50:29 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id AC16A41760 for ; Fri, 10 May 2024 11:50:29 +0000 (UTC) X-FDA: 82102318578.21.5C1F4FD Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by imf11.hostedemail.com (Postfix) with ESMTP id E09E540003 for ; Fri, 10 May 2024 11:50:27 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=AkhXWOPO; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.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=1715341827; 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=mIIbTsUqC47TgpII0qMr2P678NC38ZS92LaHNxc/VvU=; b=TsNJAbbtTvt520kHx4o9VwLa6qxtOVfAEOtPuJWAIM7ljhfA9BwLBkgAddM1432urVkTcZ 5HfdEF+sRMaG8Rwlt9wBwL8DoJvQDQtdftAcHE8oL7nCjb2fiu/oaooOISqMorF7XO/Ee3 4TwTn/RyLTaEK3OHKRpIReugq3YZ7tQ= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=AkhXWOPO; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.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=1715341827; a=rsa-sha256; cv=none; b=5by2VShj8KkzGyj1Q53HtYk4CLA4bfbUa4fEUM7E/Q3JkPKt0LmIDn98iEI33VH1nv3nQC 1xDarsKeh4PuXiYUU4MCuHksWfHmIEbVf/BYWYSR96/77DusDjpOMxu+3nLCDnluQ/7MZB 0VtutS0pLGhaqSPc6N0y7DK2YICQix8= Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1ee42b97b32so15507075ad.2 for ; Fri, 10 May 2024 04:50:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715341826; x=1715946626; 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=mIIbTsUqC47TgpII0qMr2P678NC38ZS92LaHNxc/VvU=; b=AkhXWOPOL7PwHidx4pZsfZU8XYmkhziUWwmmAEyKzg/gydF/XzaNszgDFrlayHPAMd yQNnQw+ZOch/FmiazlkvinSyJBw42DIjVF6/J26W7osHMKeiE53j6vrumT0vV3GuhGBz /VGoPukJYDRCj6K1mFV3xecbnfBSzj002abBfiAsvBo91yiTkl+68YItUT5Xy5FpYoAj 5gG8fHh/P3wsdj99n2ZypfZH/PLBmJ6L9Vi6IUrwkRULzlWOeKeqjpq7XGLk1APkslPb 33J9K6jG4EaLPkiKmqlWinpI/Rj4l1/6cB4Ad9r+Oxy2Yvn6L6kkSMW4ahIvyggls/Mi sc1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715341826; x=1715946626; 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=mIIbTsUqC47TgpII0qMr2P678NC38ZS92LaHNxc/VvU=; b=W0Z+0o2qaa9xW4SeW7SzVp/sFHgoCj/WrUs+c8T/4PLmj0ZirSrWIGxshHOSTq8byW KdFnMHm0qKJkBTH/coLpbF3VZ6+ILSmYBry+zRBAx7Ool3EG4o2WBUbR2ARGEqIaubr/ cECYPV45swpQMG4vF8jgxc0P1eq4wOQL10j6jH81H1b79ruQU3Z+jNrdYkthvJBfaex0 QtUl43brk2K30cg5UibPhuYopPZVNEOhnHVlg2rOXq4CBOFwskRayFEGfbevIDwh80CV xO4p+6saw461nc0fcn8E3YDzhIAm+DS2KKZBvtU3ngUX0FJCOI/UX97YNuOQoIqcNJ2p /HjA== X-Gm-Message-State: AOJu0YzAd68G0jr+N8W5Azllx6vkybzGPvQk2tLwm7OeeuuuGAociUsL Lp0OzQ2yFNt0WHTy6O3EkIqRLjj9u8amBRpsnHr5nvS2yNkvK4ByoGPKIPWYVkbBmQ== X-Google-Smtp-Source: AGHT+IEqWWlYE0LaQa+qtHe47sVQ58jjdkZuIoCJG8MKrxdZVoUXsASGJ68twijEqsRcGHoHUXZc2w== X-Received: by 2002:a17:902:d4c4:b0:1eb:7ba:a4bc with SMTP id d9443c01a7336-1ef43f43106mr25708225ad.51.1715341826460; Fri, 10 May 2024 04:50:26 -0700 (PDT) Received: from KASONG-MC4.tencent.com ([43.132.141.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c134155sm30183825ad.231.2024.05.10.04.50.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 10 May 2024 04:50:26 -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 , David Hildenbrand , Hugh Dickins , 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 v5 08/12] nfs: drop usage of folio_file_pos Date: Fri, 10 May 2024 19:47:43 +0800 Message-ID: <20240510114747.21548-9-ryncsn@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240510114747.21548-1-ryncsn@gmail.com> References: <20240510114747.21548-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: E09E540003 X-Stat-Signature: bx8p4qs1d6883o4u6cptdjaio311uw3k X-Rspam-User: X-HE-Tag: 1715341827-713891 X-HE-Meta: U2FsdGVkX1+h6uXHp4HkRwMaCrYTHUQR+nlEPyI4G6LHOoCyMF2zqINjXn2NSDlbWeeKSz2eceMqFGACcGq31I5hybN+n+Upg2t0zQHqZb5ERybiP+sXKBtMPcbC7jy6a3r094E+PDRvxNEpkUGfOVCuAdcUxiRo1jVLf7Xe8IeSJClUorSNH9PpFpLBhuyMsu2QKUSVW1v1oRK9odQAG6JJULNWF+jf8czW2f7SWttkOUVRKVflm6iYkfirIczVcs3ArYldTUfbcUd4WBm8lkDeMPGh7tXeUW+c9euN7O1mq1IrdJ4SeW0RRJNKyaVIf+Rra1a1AD6/16J1jJt0cuW8rv1bBWSuhNmCLbJI152yrVhf8yiwDwzRmqPL+/JdxQeFEMz9bQX0KStglooEYHQseHG3Ffx32wxl9Gf8kwq7PDypyTug7V3BeYuwBjsAxpEB15gG+yvVGf+GCQ2O4nYaa31L11ndnvypq7aNgz75GH8TCVGVkwG/ugnCu+kY+VlXS7eGXuEWM3YQYSQ1zAJXE7SI2Mk/x581tZZ1uLIvlKXfM2ZDr/qAh2nDkrcX012Th0DTfGpNgQgnrLtu4U1tqCVr1siBQc8Q+a0wfo6UKDOhh5Xba76E5MKeVcs4csb8LQwOKsknq6Bantz1kMied48DDlwLvwLjpaUlffI9vjriRZEq0wxYHD+sGNniF5u/ZOhEB82/wkYHKlm2UZKUG7Fka0SFi9YN7gPluVmMt3tBG4zD02aQx/TpEM2HaLfqFfU1ZTPngU/Mn2U3GPWzOE6HlZtv9whpVcSxfjyPh+awzn1/lMUKORvpRqPet0Qn5PeILmSosH52BYwr7r9jWlhZ4Z6eCV7ARWEtvMCZ19eDAac6qIN1+E4aJZ/eWJTxtZk7JaBN1hmsXyFNukObINEjIJSLrTdnztZ3Khuj1eonMK7CAMSmmXrqb3Ja7YAM5TGn3AM7yUfTRiG qZINSmFh XVjtsVzZS7EvSHTk1ms7orHYg8dgSSdovHLmlZzvtAMCuP+kfrBYLY1jSMVixNKhLSBockEXCBAOyC4cTedNFmxffIYmJK/ccR7jslNfhsJKMH9qLogEAGkftqUXBFwu6plzMubFB/OYkPlwVqMzMiwtDCGcMMbl/oqf651UeFadFwHuWugsReC/+dP9BaJ46u82jC19wKt5dOpyfqIK96yMHqL5LOaPCWAQodcj9vm91wddkwhSFArDEbo3pw/hGnujSaLI1SdvHUykZMvFuFETqQ1XKHMUefaHe7QCiTDsXGHKz36oxK207wPxsKe5ZBZeJXvmBbYY9mt45eZOzx32jZLKBbXoQiWgo1vosFPj1RB5r3j5RS6f6nAVbgxVhgXjsqhvoePlOiTVuMEsvTrN8/U5SLZl8wcUgLdIelDMl/81iJpxNjhWM6VlEo7wK6LE4WpkmDekZOdTq4i3fH8xpXeJwv7HNn3RcVwsCk0q9RQHqR2MggAd6AIqH4qgRRauULEKTUkCiYUPZfH02JmEjSVDJ2OUk8mw1spSglBJxCdAPmg83Wfc5iyCCZIqI4CoO3zGTgqxZ4p7JF/ORek1kgT8tznWgAm3KVf9abE92Q5RZWIqCZUyFIBh1lKIO08547pkD1PNtJjVPpL6e490kUa6CkZckfKqcYaMDYmKLyC5AEXjdKaWPOnqs36uhtjrUG9Z8Z7hIfa0yzitDUl0vdG8j9sSGae/p/BpKRen8qCjMetGRUwd0SRl/YxzLN4WNS+ge99YVO1Htwv5zAKEMqlE4RjbdAbuA X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Kairui Song folio_file_pos is only needed for mixed usage of page cache and swap cache, for pure page cache usage, the caller can just use folio_pos instead. After commit e1209d3a7a67 ("mm: introduce ->swap_rw and use it for reads from SWP_FS_OPS swap-space"), swap cache should never be exposed to nfs. So remove the usage of folio_file_pos in following NFS functions / helpers: - nfs_vm_page_mkwrite It's only used by nfs_file_vm_ops.page_mkwrite - trace event helper: nfs_folio_event - trace event helper: nfs_folio_event_done These two are used through DEFINE_NFS_FOLIO_EVENT and DEFINE_NFS_FOLIO_EVENT_DONE, which defined following events: - trace_nfs_aop_readpage{_done}: only called by nfs_read_folio - trace_nfs_writeback_folio: only called by nfs_wb_folio - trace_nfs_invalidate_folio: only called by nfs_invalidate_folio - trace_nfs_launder_folio_done: only called by nfs_launder_folio None of them could possibly be used on swap cache folio, nfs_read_folio only called by: .write_begin -> nfs_read_folio .read_folio nfs_wb_folio only called by nfs mapping: .release_folio -> nfs_wb_folio .launder_folio -> nfs_wb_folio .write_begin -> nfs_read_folio -> nfs_wb_folio .read_folio -> nfs_wb_folio .write_end -> nfs_update_folio -> nfs_writepage_setup -> nfs_setup_write_request -> nfs_try_to_update_request -> nfs_wb_folio .page_mkwrite -> nfs_update_folio -> nfs_writepage_setup -> nfs_setup_write_request -> nfs_try_to_update_request -> nfs_wb_folio .write_begin -> nfs_flush_incompatible -> nfs_wb_folio .page_mkwrite -> nfs_vm_page_mkwrite -> nfs_flush_incompatible -> nfs_wb_folio nfs_invalidate_folio is only called by .invalidate_folio. nfs_launder_folio is only called by .launder_folio - nfs_grow_file - nfs_update_folio nfs_grow_file is only called by nfs_update_folio, and all possible callers of them are: .write_end -> nfs_update_folio .page_mkwrite -> nfs_update_folio - nfs_wb_folio_cancel .invalidate_folio -> nfs_wb_folio_cancel Also, seeing from the swap side, swap_rw is now the only interface calling into fs, the offset info is always in iocb.ki_pos now. So we can remove all these folio_file_pos call safely. Signed-off-by: Kairui Song Cc: Trond Myklebust Cc: Anna Schumaker Cc: linux-nfs@vger.kernel.org --- fs/nfs/file.c | 2 +- fs/nfs/nfstrace.h | 4 ++-- fs/nfs/write.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 407c6e15afe2..02741c32e114 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -588,7 +588,7 @@ static vm_fault_t nfs_vm_page_mkwrite(struct vm_fault *vmf) dfprintk(PAGECACHE, "NFS: vm_page_mkwrite(%pD2(%lu), offset %lld)\n", filp, filp->f_mapping->host->i_ino, - (long long)folio_file_pos(folio)); + (long long)folio_pos(folio)); sb_start_pagefault(inode->i_sb); diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h index afedb449b54f..d249741452e1 100644 --- a/fs/nfs/nfstrace.h +++ b/fs/nfs/nfstrace.h @@ -960,7 +960,7 @@ DECLARE_EVENT_CLASS(nfs_folio_event, __entry->fileid = nfsi->fileid; __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); __entry->version = inode_peek_iversion_raw(inode); - __entry->offset = folio_file_pos(folio); + __entry->offset = folio_pos(folio); __entry->count = nfs_folio_length(folio); ), @@ -1008,7 +1008,7 @@ DECLARE_EVENT_CLASS(nfs_folio_event_done, __entry->fileid = nfsi->fileid; __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); __entry->version = inode_peek_iversion_raw(inode); - __entry->offset = folio_file_pos(folio); + __entry->offset = folio_pos(folio); __entry->count = nfs_folio_length(folio); __entry->ret = ret; ), diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 5de85d725fb9..fc782d889449 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -281,7 +281,7 @@ static void nfs_grow_file(struct folio *folio, unsigned int offset, end_index = ((i_size - 1) >> folio_shift(folio)) << folio_order(folio); if (i_size > 0 && folio_index(folio) < end_index) goto out; - end = folio_file_pos(folio) + (loff_t)offset + (loff_t)count; + end = folio_pos(folio) + (loff_t)offset + (loff_t)count; if (i_size >= end) goto out; trace_nfs_size_grow(inode, end); @@ -1362,7 +1362,7 @@ int nfs_update_folio(struct file *file, struct folio *folio, nfs_inc_stats(inode, NFSIOS_VFSUPDATEPAGE); dprintk("NFS: nfs_update_folio(%pD2 %d@%lld)\n", file, count, - (long long)(folio_file_pos(folio) + offset)); + (long long)(folio_pos(folio) + offset)); if (!count) goto out; @@ -2073,7 +2073,7 @@ int nfs_wb_folio_cancel(struct inode *inode, struct folio *folio) */ int nfs_wb_folio(struct inode *inode, struct folio *folio) { - loff_t range_start = folio_file_pos(folio); + loff_t range_start = folio_pos(folio); loff_t range_end = range_start + (loff_t)folio_size(folio) - 1; struct writeback_control wbc = { .sync_mode = WB_SYNC_ALL, From patchwork Fri May 10 11:47:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13661472 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 D388AC25B10 for ; Fri, 10 May 2024 11:50:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6C83B6B00A4; Fri, 10 May 2024 07:50:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 682736B00D0; Fri, 10 May 2024 07:50:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 518EB6B00D1; Fri, 10 May 2024 07:50:34 -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 32AB96B00A4 for ; Fri, 10 May 2024 07:50:34 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id DA2AC1C196A for ; Fri, 10 May 2024 11:50:33 +0000 (UTC) X-FDA: 82102318746.18.6FB3492 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by imf12.hostedemail.com (Postfix) with ESMTP id 07F8540005 for ; Fri, 10 May 2024 11:50:31 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ACkwGVvZ; spf=pass (imf12.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=1715341832; 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=D1huxSjfPNpI2elfAn7WJAQ+EPp79T3Zke3qFamrARc=; b=fgJiNuxuO3ugEp246cwKh8ZiD+bhu18k0EgRZTmr/d8rjdP9rPEmwIzZJJewyyRPgmhRa0 qCj7/fYvAtDJY2uuhFt2oUmlgAUEJuf8444ob5w9jeFR86kYYiwnYWbF2qWsId2A1tbzKb esSl6gzyWUanemX8av5zwB9zptF9xhQ= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ACkwGVvZ; spf=pass (imf12.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715341832; a=rsa-sha256; cv=none; b=pBj8LBJ9sqio5jmnrFB3rUmCwPfv3Se8+GU0zaitiD/mGOiz/82adyqQzOX12BmzxY1sum xMh6NuDIw3OlJG4fK6HtzOvqPoOmjEHueEMg1UdPjEFNVukxxNDXqZVuTi7sBz9f/Utwn0 1gbI33JZ8gURInBNj2vgQ6xojRJRP4Q= Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1eb24e3a2d9so17136245ad.1 for ; Fri, 10 May 2024 04:50:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715341830; x=1715946630; 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=D1huxSjfPNpI2elfAn7WJAQ+EPp79T3Zke3qFamrARc=; b=ACkwGVvZ7gXC/XH7YLf9wkPYWziRD9AnxHTWu4I4o6kcQ/L/tJCk3+idjs3HTxDzCu EoX+Y+x0T+0T4IX1HrTO+WE/KDHhH1Nradn7nYd1LJWJQIB7rmIzruncbAAZjkfEMy7c qinUXxgS0KRBHKs20RTdEpotwFJKvg+5C3vqxmLyWC262xnlTGAWeBTA1UzXqJmDHkKZ YrjieNxlaiX6YtUt55m1FtXrhSW+Kke4lgLVJ4ZRJtK/mzTbtNGXyvTWOJredaZWz2c9 cWKEQq+a440jmA+95quh2w8wBVrc/SGl80Vbfx59KSH5O1obihRicIxqVFnEl6/qF4RE 0lDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715341830; x=1715946630; 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=D1huxSjfPNpI2elfAn7WJAQ+EPp79T3Zke3qFamrARc=; b=Q4eiZVz4glYWhQAAisxLwkvY/3aq9PiDsIBbTaADJ4HMUNgRtnW4AdcdDPqVoCna0K 2z/QBvke42v1ETjwUXACE5FUD6eK7DqPJQF1WVTIchOLD/IiEWwhs7TiMRabF7nMymep 5xais7/SzbvNWFC8Q0Z0rNKr70rbnq+YQrxIvZpnz+uirl4RH3G5oPUih6MYP6pZJOTZ 1F2YoPcSxvMwQOwPw+oqt8ett+ppSDJH4JG/JdHpl21RHL7BRCxcHcCGF76DNzu1FoIs 1/j4G3ENSxW3H4barZM8CAyZIHMStVMLlgfMjSdCg94UQ16ooFAtrQtg8qot+W81o/DD Ouuw== X-Gm-Message-State: AOJu0YwQEhliWUPqsqOQI3arUEcrKPjMOiItUr2N/0cWmZsYeA4/icmi UBrHypNJ5t7wC5bspa4Na82TSs4tX6HG9bykCJckCjvAHhwoaWZghq/62KwFmglllw== X-Google-Smtp-Source: AGHT+IEEg6dE9/dabWmlAkHlSPTCpPJRcc/k2Jrk8P/i3G+yAdrIEP6CyhaxILwoXp+bzQftvYAMNg== X-Received: by 2002:a17:902:ecc7:b0:1ec:7b0d:9eb9 with SMTP id d9443c01a7336-1ef4404e44bmr34221205ad.64.1715341830560; Fri, 10 May 2024 04:50:30 -0700 (PDT) Received: from KASONG-MC4.tencent.com ([43.132.141.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c134155sm30183825ad.231.2024.05.10.04.50.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 10 May 2024 04:50:30 -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 , David Hildenbrand , Hugh Dickins , Yosry Ahmed , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kairui Song Subject: [PATCH v5 09/12] mm/swap: get the swap device offset directly Date: Fri, 10 May 2024 19:47:44 +0800 Message-ID: <20240510114747.21548-10-ryncsn@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240510114747.21548-1-ryncsn@gmail.com> References: <20240510114747.21548-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 07F8540005 X-Rspamd-Server: rspam06 X-Stat-Signature: tb9fqkgx4g7raywindss1bqh63j5n9zf X-HE-Tag: 1715341831-341522 X-HE-Meta: U2FsdGVkX19pjnwVZ8DIyZ5Y1LcQH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KXNJuOhvq6sIVhvJ1z5sBdz/RSrnt+4+ajE3vkoHEHAOxccFc/XzOCBDsyAz6gGj36htsW7tO96J6mnIMsEnb/hGf9Vj8P+dNKenWaR3u3sDyz+iTJEgCehhPoR2ZicjsKcZrySg8CDH7B1VKtT/xDffox1nplYqRUBFNGVhyVCSHIZzyL9t+GbXtDdOhmhbSrMUcxtarfarJiD5khL/V62ulzYzAuYlhVbPCFBaqhC0olwsRggZ2MjjwQa+lly5DxBnU9Zn2MCzfRgD1wRSJqLII9cS3FBf0x/YS+pdVg7g+vhtAmTy3cTzWe6m50L/n/4C3qxL3GvzKfgy8iqTRSP6NDBSVn1jybogTMRelz8jgDE1+QdnOcAdcccJULH9bnZ+XaRICb4Zg1kyla7rsVEWKgYgTKcVPkeWLqmHUM5IdzoAAOeeIeml8G0XMNovroJr05avx8w9H3oDj82DdHC6EmV7/UJq63ZBBOmjd08zi3SIBUpydsgw1Nru0uic6ciFdBTayq1G33cZZHpiUrhVW0JKQc0NVN0QCuVFl4wqww== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Kairui Song folio_file_pos and page_file_offset are for mixed usage of swap cache and page cache, it can't be page cache here, so introduce a new helper to get the swap offset in swap device directly. Need to include swapops.h in mm/swap.h to ensure swp_offset is always defined before use. Signed-off-by: Kairui Song Reviewed-by: "Huang, Ying" --- mm/page_io.c | 6 +++--- mm/swap.h | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 46c603dddf04..a360857cf75d 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -280,7 +280,7 @@ static void sio_write_complete(struct kiocb *iocb, long ret) * be temporary. */ pr_err_ratelimited("Write error %ld on dio swapfile (%llu)\n", - ret, page_file_offset(page)); + ret, swap_dev_pos(page_swap_entry(page))); for (p = 0; p < sio->pages; p++) { page = sio->bvec[p].bv_page; set_page_dirty(page); @@ -299,7 +299,7 @@ static void swap_writepage_fs(struct folio *folio, struct writeback_control *wbc struct swap_iocb *sio = NULL; struct swap_info_struct *sis = swp_swap_info(folio->swap); struct file *swap_file = sis->swap_file; - loff_t pos = folio_file_pos(folio); + loff_t pos = swap_dev_pos(folio->swap); count_swpout_vm_event(folio); folio_start_writeback(folio); @@ -430,7 +430,7 @@ static void swap_read_folio_fs(struct folio *folio, struct swap_iocb **plug) { struct swap_info_struct *sis = swp_swap_info(folio->swap); struct swap_iocb *sio = NULL; - loff_t pos = folio_file_pos(folio); + loff_t pos = swap_dev_pos(folio->swap); if (plug) sio = *plug; diff --git a/mm/swap.h b/mm/swap.h index fc2f6ade7f80..82023ab93205 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -5,6 +5,7 @@ struct mempolicy; #ifdef CONFIG_SWAP +#include /* for swp_offset */ #include /* for bio_end_io_t */ /* linux/mm/page_io.c */ @@ -31,6 +32,14 @@ extern struct address_space *swapper_spaces[]; (&swapper_spaces[swp_type(entry)][swp_offset(entry) \ >> SWAP_ADDRESS_SPACE_SHIFT]) +/* + * Return the swap device position of the swap entry. + */ +static inline loff_t swap_dev_pos(swp_entry_t entry) +{ + return ((loff_t)swp_offset(entry)) << PAGE_SHIFT; +} + void show_swap_cache_info(void); bool add_to_swap(struct folio *folio); void *get_shadow_from_swap_cache(swp_entry_t entry); From patchwork Fri May 10 11:47:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13661473 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 DCA02C25B10 for ; Fri, 10 May 2024 11:50:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6EF8C6B00D2; Fri, 10 May 2024 07:50:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 69F586B00D3; Fri, 10 May 2024 07:50:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 519676B00D4; Fri, 10 May 2024 07:50:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 2DDEC6B00D2 for ; Fri, 10 May 2024 07:50:38 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id D6EB71217EF for ; Fri, 10 May 2024 11:50:37 +0000 (UTC) X-FDA: 82102318914.20.6FC6549 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by imf01.hostedemail.com (Postfix) with ESMTP id 0E59A4001B for ; Fri, 10 May 2024 11:50:35 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=cWLYwChc; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.171 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715341836; 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=APhN0fulocDUETiygz2oAEV3IjS3U4+qkKHyL+coV+Q=; b=KrTfxWFTNNxSGKiv0Mdhmy+uZlskEjXhvbJE9dNISbCQraYYuTQ2U2Y+tbK44pvJuyR8mm wwcetm9iOCt1o6D6BMOp1e98lJ1/bfhC9MIDHujKApHS2/ZFAs4ZdCYts4zNwgU0fRtvtK tVhYyFgPT3ImAdZJ6xznT37WPWy1P10= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=cWLYwChc; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.171 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715341836; a=rsa-sha256; cv=none; b=ksgmu2R9h+yras3LmhcRXLfbc0bLReXoaVK6T4jS29LgN9rSm7zN/VdS4dXhXJ2S+qVbfa rBbiKouKdgqyh90npkEJYJaLGhgNIHjduaCbeE7NoKw8jcFGkR3zEmWZobCK+uLaTCXDz0 g8v3/rx0hZa8NhNpb5MU/U1KE4x42zU= Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1edf506b216so14400275ad.2 for ; Fri, 10 May 2024 04:50:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715341834; x=1715946634; 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=APhN0fulocDUETiygz2oAEV3IjS3U4+qkKHyL+coV+Q=; b=cWLYwChcvYxN6sC8YPLdRArxH1IF9zOSK/nDhwMqgqbSWx5sFeV3PRn2UatgxMs3f2 hQ8hOyNady4Iu8ODRyIxF3msH81vrxjCZYz8UnXUhHmZyDF4AV3r8haUdJaUhRemCZe+ OaIMAH7yjhze93JZo8719MvNgCFZyczSrN/sq8bHO8OEraKFPy4F3E9BCj4KBWYbdKK1 cM5A0DCzajwCuQxdRgvWb4Xj/OifrpKk8S1qYtDEvqSGcX8fYJW2iih6gquNzZm6jRRi qAL2EkHvaU8zq+R+v4Rl6LM0bGcPqgMm4/AEo+7Aqne6gkBbzjAfaRh++cbTPImtZWQq 7vpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715341834; x=1715946634; 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=APhN0fulocDUETiygz2oAEV3IjS3U4+qkKHyL+coV+Q=; b=w7pW8Q0HNImAarOuq1m5WI+r7ToWsbDmpPG5rQA0kxZAhgftiAJ3I3Z0ADUYwGdMsO mC9oozZRIWfgNMcFTh+1pZkEWwmizNSJtEoJbkLJ14Z7YyUt44mCJZ3rjsZPjQwpriK7 riQwvjTdIRXQI4mGXUJJ4r3dT0dE59tzmcuTlgjNkhoDKUwY7Aa+m9nDe1OiuLAgQAcq PTEof9uZEZSXfGSZpfy/w5x3VSSInWcbMNcR+bMRhWCsFpA8c8TTKPdJmtSj5kMjPKpI C+m4OtJAZllfFlTFX42SeZ9bevwDVL0SQLxWD1vCgwNdGzTbES625qMz8XV7OLvgKhnH NlrQ== X-Gm-Message-State: AOJu0YxfMZNOCbs39RPHCU1ki9HiFZFpAs2EpNKSqW2j+oHqhRWG/Bnx yFEFIGiPYXx2kQ9uhlwVuLC70eGKu/Mq87MB7np319/b02IcUKIe/JRPabAOYfdoMQ== X-Google-Smtp-Source: AGHT+IGRhm5V0At8lTwKdrzoZNWdcS6HhlYsyuvWhECri1epnW5oHdn3nfMF9ycJerAmcOjLLrBH8A== X-Received: by 2002:a17:902:720a:b0:1ee:b47e:4ea with SMTP id d9443c01a7336-1ef43f3d39cmr21286825ad.38.1715341834585; Fri, 10 May 2024 04:50:34 -0700 (PDT) Received: from KASONG-MC4.tencent.com ([43.132.141.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c134155sm30183825ad.231.2024.05.10.04.50.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 10 May 2024 04:50:34 -0700 (PDT) From: Kairui Song To: linux-mm@kvack.org Cc: Andrew Morton , "Huang, Ying" , Matthew Wilcox , Chris Li , Barry Song , Ryan Roberts , Neil Brown , Minchan Kim , David Hildenbrand , Hugh Dickins , Yosry Ahmed , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kairui Song Subject: [PATCH v5 10/12] mm: remove page_file_offset and folio_file_pos Date: Fri, 10 May 2024 19:47:45 +0800 Message-ID: <20240510114747.21548-11-ryncsn@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240510114747.21548-1-ryncsn@gmail.com> References: <20240510114747.21548-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 0E59A4001B X-Stat-Signature: dtd159zpmaoifxbmxd8r6k5c93gw5y1r X-HE-Tag: 1715341835-549946 X-HE-Meta: U2FsdGVkX19OqY9grPulcu1QEQIuUIRU8rfa+J/V47CO2tVCsiAADR0/6rfOlCJWCo4u3tXfu2FrgBfp6PqXSEl14FSCz4NFoxaLR41uONAPlx/HG7cN7G7rk+FEmAc1LRS06unYhj/LfRPsRMYZRjkhNkx0K/kdORhRThlHCU/60oYkh5PLj2k488H0UWylA+Oc01I/3uXifnLIq7jSXFILHmGWaCR5SSzY74M+TPcetwnMLlfwv19TYi3O1o8fGlqEqWvrSkM+h6WORDIRrOKcAv49LIc+GNm/A2/8FHDfyzHH3/OvbEqQnRYiqALn3AVI1Ify/DG/rjDlxTATyi6bEdD3CoaCkXqWNWDZ2ckJnhK9inQ7TjikqkICKNTbsUrViuDX5tqRZBlXwU0oqyj4FB1t7DuCKRH55SyIKdY/j6j6RiaaSJor0CjfDydWVICsSPBG9g5F1qzRf4g6CJ5ILHnbK1qec4djIqjTRmUyweH1jO7XXvBii0Gax9kQ/SL6Urn9I15NZ1qZEtuCE4pXIRQx3+XSWt2/lKpRATVmd7xQBJGFDZubBu5qRBuzpeM2+aTMSxnfikmI17kJkjT88+xSGaBMz4J26LJqZhcHuw1H2rKDDjZ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=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Kairui Song These two helpers were useful for mixed usage of swap cache and page cache, which help retrieve the corresponding file or swap device offset of a page or folio. They were introduced in commit f981c5950fa8 ("mm: methods for teaching filesystems about PG_swapcache pages") and used in commit d56b4ddf7781 ("nfs: teach the NFS client how to treat PG_swapcache pages"), suppose to be used with direct_IO for swap over fs. But after commit e1209d3a7a67 ("mm: introduce ->swap_rw and use it for reads from SWP_FS_OPS swap-space"), swap with direct_IO is no more, and swap cache mapping is never exposed to fs. Now we have dropped all users of page_file_offset and folio_file_pos, so they can be deleted. Signed-off-by: Kairui Song Reviewed-by: "Huang, Ying" --- include/linux/pagemap.h | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 850d32057939..a324582ea702 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -918,11 +918,6 @@ static inline loff_t page_offset(struct page *page) return ((loff_t)page->index) << PAGE_SHIFT; } -static inline loff_t page_file_offset(struct page *page) -{ - return ((loff_t)page_index(page)) << PAGE_SHIFT; -} - /** * folio_pos - Returns the byte position of this folio in its file. * @folio: The folio. @@ -932,18 +927,6 @@ static inline loff_t folio_pos(struct folio *folio) return page_offset(&folio->page); } -/** - * folio_file_pos - Returns the byte position of this folio in its file. - * @folio: The folio. - * - * This differs from folio_pos() for folios which belong to a swap file. - * NFS is the only filesystem today which needs to use folio_file_pos(). - */ -static inline loff_t folio_file_pos(struct folio *folio) -{ - return page_file_offset(&folio->page); -} - /* * Get the offset in PAGE_SIZE (even for hugetlb folios). */ From patchwork Fri May 10 11:47:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13661474 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 C72DCC25B10 for ; Fri, 10 May 2024 11:50:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 58F3A6B00D4; Fri, 10 May 2024 07:50:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 565F46B00D5; Fri, 10 May 2024 07:50:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 42E836B00D6; Fri, 10 May 2024 07:50:42 -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 214BD6B00D4 for ; Fri, 10 May 2024 07:50:42 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D5D1C1417FC for ; Fri, 10 May 2024 11:50:41 +0000 (UTC) X-FDA: 82102319082.10.61FA92F Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf23.hostedemail.com (Postfix) with ESMTP id 0AC5B140002 for ; Fri, 10 May 2024 11:50:39 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=S1IAPU89; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.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=1715341840; 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=on6kE/iT1Lkf0hlBPN696BIDabVjdoSu5WvxX7mut44=; b=aiyA7TEN26mlJ6yNFrdpNm6M+c1JavRicRaqkmjIW367XVrokcjx3DcSOh0dJ3CDg+YDk7 4Fa9gG9V/d3/v9A+UDz3DtQmIYZLPL+BkeN8NHe6mquNBucW6eNhlDQ3HyDDvG7+QUra3m KyKoineY4wij5i3NUHL0XyvYD/cInJ4= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=S1IAPU89; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.179 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715341840; a=rsa-sha256; cv=none; b=yWsjlp7JtpRQV65DAECj1L4u7e7FysW1OKDM59udAiYY0/tYql8MDz1oVnt9QB8DThP8fh xavtCfQDeEYEJS2xAUMKD4Vdlkqf40bktQEA47hPVL/xm4i5fPccv9ZU9V7a0/7ElwVPYz FskJpbkv8cV6aL4vwIAS7+hjBJyfKiM= Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1e4bf0b3e06so17059525ad.1 for ; Fri, 10 May 2024 04:50:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715341838; x=1715946638; 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=on6kE/iT1Lkf0hlBPN696BIDabVjdoSu5WvxX7mut44=; b=S1IAPU89vgEbhQnDD4JdrtHH0IcjEgoLmW+252f/qQ/xCGityIKZbu1rQg01ulsuXG uX9bLAtltLtMU1CnIO21Exc/GEtcdOTcF0xWmNsSOAmE7qszKyWjGMgdH+IinGDhOfn5 VPerH2OVoTqc0IKnyHt0Vkr6LsNrgIcy7AsSETDv3WCVROjekh9tfxFlt0PcOryIZXtU 6iiiqQq1ixGo/vVKpTTrKWGimCgnkwiIB9KsbUTVwUXsocAj/H3mhy0jLxpLLnUXG+V5 f+72Q7Cz5+C6c8/nBUTXCme0ki2DKkNJzD55ztshcckSZQ8DewMs+0yQbePyXBc1Fh0r Zxkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715341838; x=1715946638; 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=on6kE/iT1Lkf0hlBPN696BIDabVjdoSu5WvxX7mut44=; b=g3PJqVsQ/XLTkADddAv4d7euT/vyLkA4knNkxHCHAHeKQjCzGk7s41OowL7UeJrP2U hWRqnqVAJ6s42VNFK62vtlctMnOOjutDix6p/eGHK7P+ESql0H0pummeFSA3iTmb6Rb1 lLLudySbtnH6k9R9JGHeFJr6fcHxfjQ59PhWQ95MAFaFlR+uvbAu0vY7MTSqgMvFMwkD iBxFWwH+bawao8zONraW2uFq3w92io0nqwiaRP68YxcCNFkMyaBgZOMl7JL5Myhhzpn/ +91wV0EPexzmzRr7+mpoVZZuNXGi7qdImKIWqtUfP8IgENxjYlUowsY54Vel1HiApLJk YybQ== X-Gm-Message-State: AOJu0YysPU5zIEE14SNl1qMjHIKXuvJCpytjV5NZaOqSDqIaqsHtM5dP 1wSXUhcthBvcpWmjqoqWPElEnAXORS9myzSUonMXKzQh+Yvg9YK5T9UfSoR5P3Td0A== X-Google-Smtp-Source: AGHT+IF1A9PqpbJrq3X5IQGwkaZ9z75WJ/x5Qis3xG1g8x4Md20mqXmUkOulbCkRZ+eLmOE6iEf86w== X-Received: by 2002:a17:902:d4c8:b0:1e4:d548:818f with SMTP id d9443c01a7336-1ef4404fb62mr28624285ad.58.1715341838600; Fri, 10 May 2024 04:50:38 -0700 (PDT) Received: from KASONG-MC4.tencent.com ([43.132.141.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c134155sm30183825ad.231.2024.05.10.04.50.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 10 May 2024 04:50:38 -0700 (PDT) From: Kairui Song To: linux-mm@kvack.org Cc: Andrew Morton , "Huang, Ying" , Matthew Wilcox , Chris Li , Barry Song , Ryan Roberts , Neil Brown , Minchan Kim , David Hildenbrand , Hugh Dickins , Yosry Ahmed , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kairui Song Subject: [PATCH v5 11/12] mm: drop page_index and simplify folio_index Date: Fri, 10 May 2024 19:47:46 +0800 Message-ID: <20240510114747.21548-12-ryncsn@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240510114747.21548-1-ryncsn@gmail.com> References: <20240510114747.21548-1-ryncsn@gmail.com> Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Stat-Signature: pgid57tmjxc83pkt74gnioiss917jho6 X-Rspam-User: X-Rspamd-Queue-Id: 0AC5B140002 X-HE-Tag: 1715341839-719914 X-HE-Meta: U2FsdGVkX19OVgFfFvc0cBSCN4psuR3n7ag+mnDMljXzIbYuXWCCAKiaTwDurup/vrK0BXGUgDd2wt1g2GuHiO4wByN6t41drabxw6st8EOA7J7UF8lsPUkaVs71sPQ8KgB6DYO4xyTNAMR6AhJhGPkBN4L7Ffh7Y13RT3buHVR41LRwHB6u+6oKHZNhXOs8dnHpgfGtOTQCu0c54jKGOpXucC7GbujSy/GQ7ABKGPV02UBb0/9od80Y8+t2q+gjQowselei/zcVoLoyFQVPkAruSyO3OqWD8oR4ds82D4ToqypXwCx4AYZ+GFs9auFQBBkdcdJdp+/BNK0veb0msLKuMRBUa+8BjJOGyzMK1xHytybpjHoCroTgnOqylQBgyWtv0/0XiNf2uZhxoxe5hTAWXyekFiPV0qneV1QwR0iR+FiZodaDkh6dg+pr5TRGFxctR5K7rgPFFJQ1gKBN2q38DZn5Pr/DgdHJxkLjaxiG12WRtKh5d9IuOKCsnNWd2K2hBN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+AfCbYxo2xKWJkHjEODhNQ5El477uWGG2fKU8KkXKlMU2ZnZ1Vr79BezAZAEW6pXM13gOUbzR2z7ESMPJgCWj6wiEf2fZD9+MgMUPurY8DascPkX/z1A9CotDS63ojJgwLyBragwZWYwnG 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 This commit drops page_index, as we have eliminated all users, and converts folio_index's helper __page_file_index to use folio to avoid the page convertion. Signed-off-by: Kairui Song Reviewed-by: "Huang, Ying" --- include/linux/mm.h | 13 ------------- include/linux/pagemap.h | 8 ++++---- mm/swapfile.c | 7 +++---- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 9849dfda44d4..e2718cac0fda 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2290,19 +2290,6 @@ static inline void *folio_address(const struct folio *folio) return page_address(&folio->page); } -extern pgoff_t __page_file_index(struct page *page); - -/* - * Return the pagecache index of the passed page. Regular pagecache pages - * use ->index whereas swapcache pages use swp_offset(->private) - */ -static inline pgoff_t page_index(struct page *page) -{ - if (unlikely(PageSwapCache(page))) - return __page_file_index(page); - return page->index; -} - /* * Return true only if the page has been allocated with * ALLOC_NO_WATERMARKS and the low watermark was not diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index a324582ea702..0cfa5810cde3 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -778,7 +778,7 @@ static inline struct page *grab_cache_page_nowait(struct address_space *mapping, mapping_gfp_mask(mapping)); } -#define swapcache_index(folio) __page_file_index(&(folio)->page) +extern pgoff_t __folio_swap_cache_index(struct folio *folio); /** * folio_index - File index of a folio. @@ -793,9 +793,9 @@ static inline struct page *grab_cache_page_nowait(struct address_space *mapping, */ static inline pgoff_t folio_index(struct folio *folio) { - if (unlikely(folio_test_swapcache(folio))) - return swapcache_index(folio); - return folio->index; + if (unlikely(folio_test_swapcache(folio))) + return __folio_swap_cache_index(folio); + return folio->index; } /** diff --git a/mm/swapfile.c b/mm/swapfile.c index f6ca215fb92f..0b0ae6e8c764 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3474,12 +3474,11 @@ struct address_space *swapcache_mapping(struct folio *folio) } EXPORT_SYMBOL_GPL(swapcache_mapping); -pgoff_t __page_file_index(struct page *page) +pgoff_t __folio_swap_cache_index(struct folio *folio) { - swp_entry_t swap = page_swap_entry(page); - return swp_offset(swap); + return swp_offset(folio->swap); } -EXPORT_SYMBOL_GPL(__page_file_index); +EXPORT_SYMBOL_GPL(__folio_swap_cache_index); /* * add_swap_count_continuation - called when a swap count is duplicated From patchwork Fri May 10 11:47:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13661475 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 2F0C1C25B10 for ; Fri, 10 May 2024 11:50:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B0E926B00D6; Fri, 10 May 2024 07:50:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ABE046B00D7; Fri, 10 May 2024 07:50:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 938876B00D8; Fri, 10 May 2024 07:50:46 -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 73AF06B00D6 for ; Fri, 10 May 2024 07:50:46 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 33653A0349 for ; Fri, 10 May 2024 11:50:46 +0000 (UTC) X-FDA: 82102319292.05.8EA0AC9 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by imf03.hostedemail.com (Postfix) with ESMTP id 4CCDC20011 for ; Fri, 10 May 2024 11:50:44 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="Ta/Xoec9"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf03.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.215.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=1715341844; 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=2cHgobIkFZqi9tZy8wGcGHO8km9uOWAjV7RKPjmck1g=; b=51YFZ0asCqkcmoh4CPI+9RUCCRgqihbBVsuQZFynHHWZqWOZRDLAdhQ6jOS6wTTUHNMGuN HUSAyHJ2PF8O2geEyoKmRsMkpDJtInWxGaS3Pj9ke6X/XhRfv3lmEpo2ns/xs0yo5go6DC 95xtX/It/whdgXT6/8NWLTvmxeA+K8g= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715341844; a=rsa-sha256; cv=none; b=ubMSwqji3pi9pzAY8gG5BzIsBCDOOsMo1LcfP5Dkie11yMVd69rwhvUVykjSMnL77YPrAr 8wtRkqakmgusBYbzjfbDH2z9NWJAtNRsP/bbZRmZIO3wnq7KCD4u2IneefgSUvlvZgwSIu 2ubG24OdvTaG/TCAEH4JM7Df6/KYoag= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="Ta/Xoec9"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf03.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.215.177 as permitted sender) smtp.mailfrom=ryncsn@gmail.com Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-5f80aa2d4a3so1667476a12.0 for ; Fri, 10 May 2024 04:50:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715341843; x=1715946643; 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=2cHgobIkFZqi9tZy8wGcGHO8km9uOWAjV7RKPjmck1g=; b=Ta/Xoec9hvzNnJLmumAtpwLwntcN5pb7C1U5XhHltVYqKLOQQJU3QeLA6lp3jrxuw7 BJJvsUvejgA7aDdKfdatJsk+sU7KoIWENTuaUVbafRmDPXkwANQ8/MvJWyv3Rzc8uVN/ t076O96h3XLhLAkWaG7Vd0T2wIekcZcyP9LiGmH1q7JHOBAZpA3Jlh8EN21JAKDwmYNF Loe5yHSrirQ4E2lqO0/J/lZpFSnBzkbuK+Tw3Fqps8fw9lCnP435LXCu7dTI6F8Dvo6x 4xMiOze2Povgp6NE94ceS72CslmeK1Fu623tTrxGZ0DSyj+DB/z5aJElKBkKJIn4oEy2 oTrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715341843; x=1715946643; 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=2cHgobIkFZqi9tZy8wGcGHO8km9uOWAjV7RKPjmck1g=; b=MzwU5ek9otQd+/k/m4HiVVl93wBLYVw4FU19BGzbGXFzFnVjgSq3JJrrpBiMThH54w /Ok9DbExcIwnY+FoSurOu4oPEtwvNYoMAeYr51GaGwrsoZoDtLoaNPJdL5gYdo76OHSb zMA3fZsGKLRpcBD0YTCewX2xUy0aPHwkMqxuVuVY56a2UuoBsoVSmyAGS16knOWoYnfe CIlowNc5SgwBqixGPLZHcuOWkcVuIOXKKbNim64JV2kfWZatOKP9CEKGdmt0NpQbaDe0 QkiLmVeRXG6klWvMRvFI1TyldkJY2okt5yxxUsgcaKCnq8WLEQuYeaxIpipPb1WYrtIX fPjw== X-Gm-Message-State: AOJu0Yx53w19KRyMnwoU8GY3LMWTEPe/B6c2/xiNtqZnLrebtoE3gR9x 7rDEJxxC0cBOFa7uuvKbCKgi15KZrubp7OKxbMftTp+QvEHKfw3MgmD1g9epwTEgsA== X-Google-Smtp-Source: AGHT+IGk029woWQIMSrmpOx6WkZvEeZxmkaZ13U9riSBclJ33JSyP7Sue0jUtAdVtSG6k8EJeM0BEg== X-Received: by 2002:a05:6a20:914f:b0:1a8:2cc0:290a with SMTP id adf61e73a8af0-1afde0dc8bcmr3107513637.30.1715341842750; Fri, 10 May 2024 04:50:42 -0700 (PDT) Received: from KASONG-MC4.tencent.com ([43.132.141.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c134155sm30183825ad.231.2024.05.10.04.50.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 10 May 2024 04:50:42 -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 , David Hildenbrand , Hugh Dickins , Yosry Ahmed , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kairui Song Subject: [PATCH v5 12/12] mm/swap: reduce swap cache search space Date: Fri, 10 May 2024 19:47:47 +0800 Message-ID: <20240510114747.21548-13-ryncsn@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240510114747.21548-1-ryncsn@gmail.com> References: <20240510114747.21548-1-ryncsn@gmail.com> Reply-To: Kairui Song MI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/iycmqW/zYLsbkv2SM3tnla0Nb72kmAWAp bnRbzOJQ SK7yuKwSCNfpW8xsp/wzZgrv33yaivNGfGuyxu8DX2eOtenTer5ZuVx43DRJklPuUWZWo+s1JINT1Ff/Z4ttFH5JjAGf7rU0S7JhZfLgGvirRcJ/PthAnwZcGdmx0soMTnD+zxptknLtzPCgZ0bfkVOJqOQfghrWLyYmKT+l6PFIa0qIb1jPSW0VGyL7jf4PycLGTxKGeLVHbCea0Jgimh6qDktRTPIzfwaTCmdXcKWjpof6a5CpL2XIrsjvPqmGLe5xvjB6pfvdm1Hogbd+RIPmWFxwVL7x7976vdCFHt1qBFh5Ztt2+TBkYrX7HNfXXmO8BrvS6nB8sZzDrpw5Ic9gV7hsvqD3YMITbG8drj/3hcbRmEFFzeNeqfWemUlh8pq8FVonMCrJgjjwud/10JrZhwk/WfIt8PKQehQub3PO7I69MXWe/EbfA15pc0jN+gmZNzi6sndO11O2lOYL93575KjD1mhmBEBR1KnbLwOQKd1hoHU8JUd8Ooq2mnDRjAmauKzc5TnFqg/Ky8tUBnqO3YGsvJErQ8hZ/S8pAsPojLCIwYU0UDhICA1w582Rn4qrI7gaxyRScbDGAJTebLWVbJJxKYKv6MQp/N45drc7h+TJhddg8n9QMLf8IlAQYzW+a X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Kairui Song Currently we use one swap_address_space for every 64M chunk to reduce lock contention, this is like having a set of smaller swap files inside one swap device. But when doing swap cache look up or insert, we are still using the offset of the whole large swap device. This is OK for correctness, as the offset (key) is unique. But Xarray is specially optimized for small indexes, it creates the radix tree levels lazily to be just enough to fit the largest key stored in one Xarray. So we are wasting tree nodes unnecessarily. For 64M chunk it should only take at most 3 levels to contain everything. But if we are using the offset from the whole swap device, the offset (key) value will be way beyond 64M, and so will the tree level. Optimize this by using a new helper swap_cache_index to get a swap entry's unique offset in its own 64M swap_address_space. I see a ~1% performance gain in benchmark and actual workload with high memory pressure. Test with `time memhog 128G` inside a 8G memcg using 128G swap (ramdisk with SWP_SYNCHRONOUS_IO dropped, tested 3 times, results are stable. The test result is similar but the improvement is smaller if SWP_SYNCHRONOUS_IO is enabled, as swap out path can never skip swap cache): Before: 6.07user 250.74system 4:17.26elapsed 99%CPU (0avgtext+0avgdata 8373376maxresident)k 0inputs+0outputs (55major+33555018minor)pagefaults 0swaps After (1.8% faster): 6.08user 246.09system 4:12.58elapsed 99%CPU (0avgtext+0avgdata 8373248maxresident)k 0inputs+0outputs (54major+33555027minor)pagefaults 0swaps Similar result with MySQL and sysbench using swap: Before: 94055.61 qps After (0.8% faster): 94834.91 qps Radix tree slab usage is also very slightly lower. Signed-off-by: Kairui Song Reviewed-by: "Huang, Ying" --- 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 | 17 +++++++++-------- mm/swapfile.c | 6 +++--- 7 files changed, 31 insertions(+), 15 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 317de2afd371..fcc0e86a2589 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2838,7 +2838,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 d127c9c5fabf..024aeb64d0be 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -6153,7 +6153,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..2c0e96272d49 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 (SWAP_ADDRESS_SPACE_PAGES - 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..6e86c759dc1d 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); @@ -253,13 +253,14 @@ void clear_shadow_from_swap_cache(int type, unsigned long begin, for (;;) { swp_entry_t entry = swp_entry(type, curr); + unsigned long index = curr & SWAP_ADDRESS_SPACE_MASK; struct address_space *address_space = swap_address_space(entry); - XA_STATE(xas, &address_space->i_pages, curr); + XA_STATE(xas, &address_space->i_pages, index); xas_set_update(&xas, workingset_update_node); xa_lock_irq(&address_space->i_pages); - xas_for_each(&xas, old, end) { + xas_for_each(&xas, old, min(index + (end - curr), SWAP_ADDRESS_SPACE_PAGES)) { if (!xa_is_value(old)) continue; xas_store(&xas, NULL); @@ -350,7 +351,7 @@ struct folio *swap_cache_get_folio(swp_entry_t entry, { struct folio *folio; - folio = filemap_get_folio(swap_address_space(entry), swp_offset(entry)); + folio = filemap_get_folio(swap_address_space(entry), swap_cache_index(entry)); if (!IS_ERR(folio)) { bool vma_ra = swap_use_vma_readahead(); bool readahead; @@ -420,7 +421,7 @@ struct folio *filemap_get_incore_folio(struct address_space *mapping, si = get_swap_device(swp); if (!si) return ERR_PTR(-ENOENT); - index = swp_offset(swp); + index = swap_cache_index(swp); folio = filemap_get_folio(swap_address_space(swp), index); put_swap_device(si); return folio; @@ -447,7 +448,7 @@ struct folio *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, * that would confuse statistics. */ folio = filemap_get_folio(swap_address_space(entry), - swp_offset(entry)); + swap_cache_index(entry)); if (!IS_ERR(folio)) goto got_folio; diff --git a/mm/swapfile.c b/mm/swapfile.c index 0b0ae6e8c764..4f0e8b2ac8aa 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -142,7 +142,7 @@ static int __try_to_reclaim_swap(struct swap_info_struct *si, struct folio *folio; int ret = 0; - folio = filemap_get_folio(swap_address_space(entry), offset); + folio = filemap_get_folio(swap_address_space(entry), swap_cache_index(entry)); if (IS_ERR(folio)) return 0; /* @@ -2158,7 +2158,7 @@ static int try_to_unuse(unsigned int type) (i = find_next_to_unuse(si, i)) != 0) { entry = swp_entry(type, i); - folio = filemap_get_folio(swap_address_space(entry), i); + folio = filemap_get_folio(swap_address_space(entry), swap_cache_index(entry)); if (IS_ERR(folio)) continue; @@ -3476,7 +3476,7 @@ EXPORT_SYMBOL_GPL(swapcache_mapping); pgoff_t __folio_swap_cache_index(struct folio *folio) { - return swp_offset(folio->swap); + return swap_cache_index(folio->swap); } EXPORT_SYMBOL_GPL(__folio_swap_cache_index);