Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1579665lqa; Mon, 29 Apr 2024 12:29:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX+No0vgELs6BRMuhtesglgeqEcvLrEBlLdNwYU4ZsxzGbvTksBY6kLyn1NyBY22iZvtRyKp/9nxeq/s8aVNpCLZyUMl783Q912eWTEBg== X-Google-Smtp-Source: AGHT+IEsfoEX+RfU7Vrl6+UyChT1wAUD0VgU4muXpn/ZBX4oOVo8i+tvnnAZZHgu39TdSOrwP1Pk X-Received: by 2002:a05:6214:21a2:b0:69b:2523:fcd3 with SMTP id t2-20020a05621421a200b0069b2523fcd3mr8978860qvc.60.1714418950107; Mon, 29 Apr 2024 12:29:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714418950; cv=pass; d=google.com; s=arc-20160816; b=i0Wq321KW4Zc2PnM3E6vILQxhJEV7tAA2AnUPbF573E/WQi+BZv0v+Mp2hvNVMbnJG 7fNAR2CUvYI3vDjRmrTJJK0vWQwMRKRM779WalJXjk9QuG5ZNNcEr+8+j7wvmkZFddbl krX2XMXgRaT3FxTjb6Kgmj2nabnpWAX3QZXDPBh6rWd9NWBZX/VXx1K/CEOUsX0fj+KK E638cb8gZIg/D/8TnCyYg1SI6ujoptJGA3d99YTZ49VJCsrK2zfBWYg/xlRBCX9UAvoX +l7PQmY97AlLWosS+BEoYA+Qd/kKJm2JK+vPkoqbsuGcL5OMSgzpuuacj4J9TbFrpEKF hlrg== 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=2Id47GDLJX/lNIbckbHqS7aCM9UEs1NMxnMsPlIfT5U=; fh=e3r4xSBPkuhg6f4GQg+5CXw4MdANErZSH+LOdhCPIyA=; b=lPxdomBqZ/SEPTkYq9jxSKyQkdjdooIH1xFRML1gHs9AxhKf/xlU1u4Sc8+ZB7OnT0 3DzJLmHY++yxhWS4b+Ph0vZWMGkG1oyJuUbKDMjyNwrI8BzSjIyNsVc5tOl/8oE2EkrC 7O9kbhnIq73Mt9OqVaygAq+gfYgGpuIsoQLkJFWFr/1CSqos35Tl/uUi/Z+6x169Zihn IuQWxX6gyWzKq9EA7VzbEoxkDPpmKONBKq4PsOkdeZVo3OCiH1ZP36UU8PAcTsH6L/jB PvtDoGPU6eNaSYeMWklPBv6UHI59lOKlG/5hm2dVqJ++daCTOgw9WEIN5z3tnDheTruB 74mA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="fZFWi/Nd"; 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-162912-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162912-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. [147.75.199.223]) by mx.google.com with ESMTPS id ke1-20020a056214300100b0069fbce02001si26997412qvb.245.2024.04.29.12.29.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 12:29:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162912-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="fZFWi/Nd"; 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-162912-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162912-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 D14DA1C20ECD for ; Mon, 29 Apr 2024 19:29:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9995C13B2A4; Mon, 29 Apr 2024 19:29:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fZFWi/Nd" Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) (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 6ACBA12B73; Mon, 29 Apr 2024 19:29:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714418941; cv=none; b=Q7cYTMB/U+uxrlM7BBww5AkacYYFR1gzvFdZYgLrD9TahGEujjoEUqmpFn7DpZa6PidOozdN3sToZoqrfFvr+IOJgGiom7iF97jtQxZtDqFlK2Ap0tpw7GOkRfsh+hhIsKmdz2vuAReCxB0jm3j2o6qHW/VEiwcRwTPMztz8UK4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714418941; c=relaxed/simple; bh=NWeoDDKOD67boHpn0fRJjHGzYo37DLBDTAZnh/t/pk8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=csp8bdB8yuPdTHO30jOPqh762P02rR/yFR3zAVgJQmW+I9UX6qFJJfzTH8cyHQfCch6z8CPTpjH1jHPUyDP/3MZXlEAg158bbu0KhPs1A+AqUOcDABoeqb0Rf8G9BBt3xfjVAo0SO4B+dwY9OqIS58nIkQmd1PD9swQT3uBwMwE= 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=fZFWi/Nd; arc=none smtp.client-ip=209.85.219.179 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-yb1-f179.google.com with SMTP id 3f1490d57ef6-de604ca3cfcso755566276.3; Mon, 29 Apr 2024 12:29:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714418939; x=1715023739; 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=2Id47GDLJX/lNIbckbHqS7aCM9UEs1NMxnMsPlIfT5U=; b=fZFWi/NdoVD2z/xGb7zN1/Q6tLuFHw2uylWPG/RUnB+xJawE7BjIGKIFfGBZIUVefs 6Dh2os2+LcyyMDMDz1cSgtsj5UG8yGZ4CnxTMrBButQIC7GtG2v7hE+m2/k1PFOB+BWX 39WjCxc1j/FaelGYFTc0S9eOB1kPYrbqgMK/tQXASxSCznSp3opRaNsKDq8xgBt5IIBW PTaKeeXuX1f8ldGhJgjLUMt1fPVgtg1etRgE8PxObuZJs05+fj24cGOYxidqNs+3+uF0 9512wUT+JFuXmdSeSwD6Y6J/a7odU6x+qeAOvCrKG0GRj2QZXI0dFXsuY0BwLOTqdNnL QMvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714418939; x=1715023739; 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=2Id47GDLJX/lNIbckbHqS7aCM9UEs1NMxnMsPlIfT5U=; b=ZL3xL4FddNfJ2ci5lrSXwRMM/jYRp4Sy3m7npFE3o2ntycZ+qehbDVIjyLuAsMLID6 LibzIDOkMTDMdaBN+5M7j5FMi3eGViwWpM95bLVf6kFnWXUP/9tcuF3IruTGLcdOatjH 6Ytf57toODnwZWNMWFMyPLIf71/zTmWqb1QC3+VDppgT6cEt9Bnx2J/okc4dsfJsYMAd 4VeoNUsqKUIfdlOd0BF/ucqVwjS0LMb/QGgZCmTXjJOw2teUE+SA9SucpB1QBeSQM8EA maPTq5L4VRpGhJaY5fdnIC/OvEwYCMxDXyRpzrAnC/gP8voWN+I8EC0gwwlWF65OE1Ez zkaA== X-Forwarded-Encrypted: i=1; AJvYcCVCvowXLG+Ncua2y2VUxJ4tTNV23kHrUua7bQxfaRjs+Eu3xmnkkERS15kTzPABgzQfhwjd5pDnS6Py7tCy8f5yZVnEV8qgn/JX/xVbEtyj59Ke5AlgGEZCmw8NDdfPNUz4x/h3Q4MkbfjR8aA4aUFWQSQ0Ic2LJonqj3TdFM1mJIRflyIjO9db X-Gm-Message-State: AOJu0YxCBRd3+LYZm154TVkNvedqz13b1jvGYWNUjI6IDc4FyEzMMJ+w yCmhNhhHRpK7sAk6lXLzkABktfABL8yuC9Id2d5Cgg1+ldpF34T87GWvLJ4qaOVmuwFXjjI8c72 hTmT3B5m8VOoymu5Jj0g8doVkRoE= X-Received: by 2002:a25:7587:0:b0:de5:8427:d669 with SMTP id q129-20020a257587000000b00de58427d669mr8497299ybc.53.1714418939241; Mon, 29 Apr 2024 12:28:59 -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: Ryusuke Konishi Date: Tue, 30 Apr 2024 04:28:41 +0900 Message-ID: Subject: Re: [PATCH v3 02/12] nilfs2: drop usage of page_index To: Kairui Song Cc: Matthew Wilcox , 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, linux-nilfs@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 30, 2024 at 4:22=E2=80=AFAM Kairui Song wrot= e: > > 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_= bmap *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_bl= kbits); > > > + for (pbh =3D folio_buffers(bh->b_folio); pbh !=3D bh; pbh =3D p= bh->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. Wait a minute. This function returns a key that corresponds to the cache offset of the data block, not the disk block number. Why is returning to bh->b_blocknr an alternative ? Am I missing something? Ryusuke Konishi