Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1576348lqa; Mon, 29 Apr 2024 12:22:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXYfgsXDieT5cB6G/4YOJxQFRp9S8tzCC6WOzKCmKF4e5GMAfYbH4eK376kq0Pd4XTcsQWeQ+1gt9GdUFvILgCqPG6LvPnzfWv2XnYjQg== X-Google-Smtp-Source: AGHT+IFT0de4T8fxDBGp9PlxZNTRhOeCjZQu7VfNUEF2ugJ9N9GTqJUDADS+eyX5I+p58i689ttb X-Received: by 2002:a05:620a:ed2:b0:78f:19d2:ce9 with SMTP id x18-20020a05620a0ed200b0078f19d20ce9mr11288980qkm.57.1714418560946; Mon, 29 Apr 2024 12:22:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714418560; cv=pass; d=google.com; s=arc-20160816; b=QgoKw/isOoYBMVq50LITWRx/c2iQKJtlMzBE+P31gLCgYuw10akIkIxH+qarMDUrdh iXwipvythHoEpQRhm8EZGySlU3tYgdZzd1zxlXR/kizpQRDQ4usqW9vYmub6fswpKFC6 jGKNvi9UTKteKQtEMrmkxJC3fapJaLacC3mWB34LWkXSiId3Poe0JQX3CgvbblmYeGgA mwWnI1ot0EFTJXqtvYBnvtQNQJamlLD7F3Hz9XN+Oh1hiJLL6QYoCr9hV7UBvaCgBavB 3GAuG8mCHmBWXOabYpglOZEXxv3II8RwUWkqj5pdo/WdKqEISHR891G13tP8DnXGy1u8 lJMQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=Cpd1WYildkuoLom26860P+BikCx3lu1sKsq7QDlDPG8=; fh=3wQEO3jfur9/p1vi0heOXhSs7jBh0oVIf5KcnxGcpnM=; b=qgJWM84BJDfJ3NVI4SvmQA58KTJJLPfXeg1v1DpnPROMK0pBC745yEJ9TBXmXatgGJ aVWkOY+OBYLAk+d9ijjfjXSuo9Z5nNAVtksFywtDjEY5t9e7IH8/Y994jFGR2jUAiDQI O3B6JjpCROgY3tQt9MYrSPxoi23Miox03D+EGJDqscMZZ95TDNLbifRh7HIsiqXyOdi3 ASoWKvd0YSMs/SZRRPguh7ipOfycudzBRsHdOQyfEfEt5gdlKHa20/Knp70Rpnzv2YAU g7cj9XCJbvwCXNzXv3bG1kzs5Kux5xlAGhzKYNoJHnM74SReBkg3XUstXeyFH3V9qSv+ 7rmQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QbI2AEXd; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-162910-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162910-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f5-20020a05620a12e500b00790fd2b6197si1598079qkl.199.2024.04.29.12.22.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 12:22:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162910-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QbI2AEXd; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-162910-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162910-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A88581C20CD6 for ; Mon, 29 Apr 2024 19:22:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D48B13B29D; Mon, 29 Apr 2024 19:22:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QbI2AEXd" Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF07A12B73; Mon, 29 Apr 2024 19:22:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714418551; cv=none; b=GlOIVpjHpfLwAJZ237mj6OZN+dDu4rmCKi+GUtbdIgDdNcYyJzjmHzqk1cIvaYaGuZQjEMgSj8zSmoHWUy2dTeeGtUQyw1CPo3dKLayxTMwzrD1ddm3z2oGU8T6BxH3acoFIaa/Vd7dItchJjRjsCUrw9TQMZbBg90IFSo+Fz1o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714418551; c=relaxed/simple; bh=6/2fDYkZ0Fc/sJSvHR4r/NMjtwcjsKhDUHRFLAmNtSc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=nVtDbaA7FJJpdNLnF2zERXkU1VFcD2/Zmjv78YSlXEH9kwdgm7erf7CP+Wa1hEmrUPNQ6KHZFP+vbuCDvqmuofAZVROR5xis+yV7QYT8+fIuzS5/I8C6zGIqhb7KiUTgx1qp0nYZfWh/l3adVLO4tIizGLt0fYrkATa7AHI+bH0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QbI2AEXd; arc=none smtp.client-ip=209.85.208.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2e0933d3b5fso14139841fa.2; Mon, 29 Apr 2024 12:22:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714418548; x=1715023348; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Cpd1WYildkuoLom26860P+BikCx3lu1sKsq7QDlDPG8=; b=QbI2AEXdTTDJQB662zdIT1aekFHJfEt14OcrX2kZOv0gw1Ud01Ziz3SalF24haOlrD Tr8icVrTMUs/6anFU1xd79it5Xvu+bNtzkIwNxa932qHaqJ/bJkc1ga9TBGixl7l4zk2 xHEpSHMvbMvPNzPvh43d49hYzrIjrowKxvDux7DmHDiTc8T3VuaG5fGdkje5qvkTmaOJ U/4Zm0m9D6kK9NBxvYAFku74mDYhHLZRKwCMFod9sP/5OvHmT4NiLLDh1IyxOGGcSoZV lvNVjqaYIWw8g1BFkmjL7cqscEYqBF/ZrUd/dcFVA/N0a92do3mBm2PwXlt0YxyIYRBv Wlkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714418548; x=1715023348; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Cpd1WYildkuoLom26860P+BikCx3lu1sKsq7QDlDPG8=; b=g2ELdxRPQQOldc+9tl49txyWOA/yp/AWCthINvOSZaGO43D5fEcXJZ/SLU3sIC/ume MHh5/zat8UTndih5KheO9+Q02yKowjuWfsqqlz1OnVRyBPJP7/OTPRh2guCEB7VNgdwX f4BSyRMjJg99LQBBdi5KyGGRBkfp7dmurPgEgck5d2ZzZ8SiUDpSVy6r80aY868z0EXt nqPLjS6ejTGSL1rjZXyPJ4pccOZQ/yempJD/niSlBD3/jL4+YrAW1c1pRsEhylY7dUov MEfPfAmcofIMiNvGjwMxIOpx4XuMu3R0n8jWmV7ErDZxuXLl/VZu2jeCobN2+rANP/bv LM/g== X-Forwarded-Encrypted: i=1; AJvYcCX9XNRoZ2ew52jmZplaxDNG5ldpMIW6nAQ9Gwse+qu/W3dieaN+V+jFUbkj+jxt7pGEvRr8ZQm1T16i2RmEWxvtnQGBOXXO0iAX6bjr1aGfpHUxNzFK7FjQ5Wiali2dlH/m2JvOlcB5A2zEK91gAlhL4bIP/tuGFDDS8a9Rt7ZuNvfR24fMkLBf X-Gm-Message-State: AOJu0Yy9mzOovZcdcq260h9QQdlzKXo6QAfyZxwocNEy0tktqa4eWS3Z tZvYeYxYW9mr84NF/uqUbyez4fqypTh3iXQDksikrpJuFZmRwjBj8bfNUGREgmMoIE92tWYpmRj 7qKzFdy8F4N3PX4wfeDRbFDtL6F4= X-Received: by 2002:a2e:b6d1:0:b0:2d6:e2aa:6801 with SMTP id m17-20020a2eb6d1000000b002d6e2aa6801mr6798806ljo.46.1714418547561; Mon, 29 Apr 2024 12:22:27 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240429190500.30979-1-ryncsn@gmail.com> <20240429190500.30979-3-ryncsn@gmail.com> In-Reply-To: From: Kairui Song Date: Tue, 30 Apr 2024 03:22:10 +0800 Message-ID: Subject: Re: [PATCH v3 02/12] nilfs2: drop usage of page_index To: Matthew Wilcox Cc: linux-mm@kvack.org, Andrew Morton , "Huang, Ying" , Chris Li , Barry Song , Ryan Roberts , Neil Brown , Minchan Kim , Hugh Dickins , David Hildenbrand , Yosry Ahmed , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Ryusuke Konishi , linux-nilfs@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 30, 2024 at 3:14=E2=80=AFAM Matthew Wilcox wrote: > > On Tue, Apr 30, 2024 at 03:04:50AM +0800, Kairui Song wrote: > > From: Kairui Song > > > > page_index is only for mixed usage of page cache and swap cache, for > > pure page cache usage, the caller can just use page->index instead. > > > > It can't be a swap cache page here (being part of buffer head), > > so just drop it, also convert it to use folio. > > > > Signed-off-by: Kairui Song > > Cc: Ryusuke Konishi > > Cc: linux-nilfs@vger.kernel.org > > --- > > fs/nilfs2/bmap.c | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c > > index 383f0afa2cea..f4e5df0cd720 100644 > > --- a/fs/nilfs2/bmap.c > > +++ b/fs/nilfs2/bmap.c > > @@ -453,9 +453,8 @@ __u64 nilfs_bmap_data_get_key(const struct nilfs_bm= ap *bmap, > > struct buffer_head *pbh; > > __u64 key; > > > > - key =3D page_index(bh->b_page) << (PAGE_SHIFT - > > - bmap->b_inode->i_blkbits); > > - for (pbh =3D page_buffers(bh->b_page); pbh !=3D bh; pbh =3D pbh->= b_this_page) > > + key =3D bh->b_folio->index << (PAGE_SHIFT - bmap->b_inode->i_blkb= its); > > + for (pbh =3D folio_buffers(bh->b_folio); pbh !=3D bh; pbh =3D pbh= ->b_this_page) > > key++; > > > > return key; > > Why isn't this entire function simply: > > return bh->b_blocknr; > Nice idea, I didn't plan for extra clean up and test for fs code, but this might be OK to have, will check it.