Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp55857lqe; Fri, 5 Apr 2024 12:24:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWCPtAwzhYfWDXEh1DluAn1cklBm6uv4PhJli16yI7iJKChjfs1TqEoY9du9vPu1SKxPpW+Os43Zk9vNOSBVxLU6cxqfS/V1Aui7SjoDw== X-Google-Smtp-Source: AGHT+IH89wqjehuvYzMPmuX0VSAWTgmRE1xbROeWo0i6PcWdE/Z0d7K/bJaSiGK/YKSHClGTq87z X-Received: by 2002:a05:620a:4507:b0:78a:5bfa:3619 with SMTP id t7-20020a05620a450700b0078a5bfa3619mr3001346qkp.17.1712345078764; Fri, 05 Apr 2024 12:24:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712345078; cv=pass; d=google.com; s=arc-20160816; b=LNDHg8oECTBomqePYmcM1x3SmGn9c6EDvnt2ZQah5XpSYNHm/r6dUT+vpQ/c3oZdkl 38JRknSZGixiOrZb7hryMJ0zY4ogQZGiOyZpR+CExsyLjxrOmuwYyC7ylrxi4CQYwmet f3+VsuWk038PlhSqrZoXLSminfhh8CujeulFAOwqxQDzmXFXdeGdoEuswiqEFlHFz5bp v3equr35x9dAoTDyk3c3ctYMAvNl9jdRUtVT9pedVvGLxjZCYz3m1L1hqr5OmscRlEoz bi9CItaP354FI7Lv5YyrsvaBBSrAWMuGhATzA/pW5rvU2StrKuE/l1ewF6puD+w3gmac WPxA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:to:cc:in-reply-to:date:subject:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:message-id:from :dkim-signature; bh=r+9PtxohNn5GLyNZPhR1TRelne4uxW9tVbigzA0Hv9E=; fh=Tvw5SpqJyRpeiZ9Fh00qJK83ONY8TqVwnywxSXVrCFo=; b=jKLIFZY1A0gF5TDmvehADl+1228hqvV3H1tsavokydLJKYVzCIwskTJeVIcLlOEH7l woelQK3NV5aZ1EmiC3bfd3fiZIq+lV9qzJDCwvtWNLpMhae2kJrSi9Z3Os597Gsc5FIZ 4wYbtjJX4wkHex/QIuspulwB/OriIwPjop2JqjEtAXATOOnKe6BvMsyyNHV/jbZrnCKx PqOQLmySa0sMmd+1pV1/G5pTpJP0M9JcORi0oCoq6wNyfHmB67/DM1I5hQ9TOMFIBBjX /OoAzgD260XrsL/J4+N05xbcMGFaNRMTqUFNWqFHqSmehYvz+JygUp5ndfpVQmkifnRY b+YA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@dilger-ca.20230601.gappssmtp.com header.s=20230601 header.b=j1og25Xo; arc=pass (i=1 spf=pass spfdomain=dilger.ca dkim=pass dkdomain=dilger-ca.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-133522-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133522-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id xx25-20020a05620a5d9900b0078d47c0fe40si2472280qkn.92.2024.04.05.12.24.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 12:24:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-133522-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=@dilger-ca.20230601.gappssmtp.com header.s=20230601 header.b=j1og25Xo; arc=pass (i=1 spf=pass spfdomain=dilger.ca dkim=pass dkdomain=dilger-ca.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-133522-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133522-linux.lists.archive=gmail.com@vger.kernel.org" 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 6C6E31C20A65 for ; Fri, 5 Apr 2024 19:24:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A23E5172BD3; Fri, 5 Apr 2024 19:24:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dilger-ca.20230601.gappssmtp.com header.i=@dilger-ca.20230601.gappssmtp.com header.b="j1og25Xo" Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (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 9D761171E5C for ; Fri, 5 Apr 2024 19:24:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712345071; cv=none; b=SjmBG1jgPc7j6RY6PBiivAfJ2vfq8fIGFOrV5+efCa61EASXWENRecJ8x+qA2jqi9oiKZ37Asmz76HJ/fEG5MjjuK3s+2W5GQ+qsTDkaaKlr4fPOab+NsGLNAlJZfBH7MkOsEhWNW5d1DMVexWZunPfgGnvkTgjZitswg1+vCNI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712345071; c=relaxed/simple; bh=mEICjIS/Xm1y/adtTOt4oAM6pGc6Ltt0L3kruWttndY=; h=From:Message-Id:Content-Type:Mime-Version:Subject:Date: In-Reply-To:Cc:To:References; b=uZgoM5ZQB9ziFnBiDTiZUOJCAvPKyeGdHP+t22EJGc16+K+fNGU7R9Es5bs53pcuBEBoztSaGfp1Qs4wlLib+WouQQyCDEmoB3dkK+6nWtJf4qIX+hnQbTwhcfpLCGf42zMe4r6e3Nax2RMQqAlpD0V5DjK04AeIQgZPQiBoG+Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dilger.ca; spf=pass smtp.mailfrom=dilger.ca; dkim=pass (2048-bit key) header.d=dilger-ca.20230601.gappssmtp.com header.i=@dilger-ca.20230601.gappssmtp.com header.b=j1og25Xo; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dilger.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dilger.ca Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6e782e955adso2391803b3a.3 for ; Fri, 05 Apr 2024 12:24:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dilger-ca.20230601.gappssmtp.com; s=20230601; t=1712345069; x=1712949869; darn=vger.kernel.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=r+9PtxohNn5GLyNZPhR1TRelne4uxW9tVbigzA0Hv9E=; b=j1og25Xodeh2U61879zqsSgDKsqz9mkJ6Fy4ZiEP/0JfRQOpwWq2BDmvPKvMmZqOv8 Eoi3xb3nkA+c2J6JCp0O4sx9mnVGe6vjaxwcUm/RkF0u8dtUqyH+qEl8VH2U5F+OsY1w lWaJuFsVhtWqEj2VQHceIrnpoSzoraw9BQCRcMMzp9zBSP6Dk6dqGwIbkpFNDOTiWtPh wZpkuJFt45E0Gui2Za26smu55yH2HfD41uIbL1mNkf4qQaPOrBNyDYDwPIUnQ8iwniZ/ nUsRu3NQprpW5sQoQfsPmi1rSb89ENpn1YzCwgDWxYFVtzf5Q89auV+34Tiff2wXWwWS 0/gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712345069; x=1712949869; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=r+9PtxohNn5GLyNZPhR1TRelne4uxW9tVbigzA0Hv9E=; b=JSNRdJSm0lyPUmMsfISdzz48YRAHGUxaXnY7XxqUcVbDGBoZCowopPyn4oRGujGWc4 5a2o/9H3JzcKYXFU8tzguK/lYUdFCfh8Xly1h/edhG2CMACwOm9tyr+ouaxldgRxjDRF kte5mlqNrTnCursucRQDlvq+ZRMQtXPGRlFz8KU0qg/2XWxqgS9c5PHmPS8wokk8nvC8 4o08i58qyBbjhpkTVmIuVt2sREz5ruzdOq+Q44I0WH6P/pMKWtpJC0cLIh2bJy2WFzE9 eeNMMJxkECrC7j9dQ4LtYe6b1YS0iEuYGQ6E08/Rbq/VoHLB7cq90tVV/wHJJnpWXfBB tQ4Q== X-Forwarded-Encrypted: i=1; AJvYcCVltG8MEQnVtWVrSQFUBzU7KtQEUK97m+luyn3IKlelRYjb4/pKrKrRgt19alDGx5AjWJ6D+71T1gGITb3senpk5zKm3uaeq6DPzq4q X-Gm-Message-State: AOJu0YwOPF8658uf0PQUS5i9Tuki5InyhV3UF/nnsf220PpY1fuZqx+2 czEmHKxEb6R7OYxOY2rPiO9TduGBLEIyLbP9bKT3ytPr0jXUMU6qF/9DgdSTBro= X-Received: by 2002:a05:6a20:dc95:b0:1a3:703c:c7d5 with SMTP id ky21-20020a056a20dc9500b001a3703cc7d5mr2194747pzb.34.1712345069022; Fri, 05 Apr 2024 12:24:29 -0700 (PDT) Received: from cabot.adilger.int (S01068c763f81ca4b.cg.shawcable.net. [70.77.200.158]) by smtp.gmail.com with ESMTPSA id fj8-20020a056a003a0800b006ea8af1569asm1872700pfb.73.2024.04.05.12.24.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Apr 2024 12:24:28 -0700 (PDT) From: Andreas Dilger Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_23208463-7A57-4687-8755-FF47195EDFA6"; protocol="application/pgp-signature"; micalg=pgp-sha256 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [PATCH v3 06/13] nilfs2: fiemap: return correct extent physical length Date: Fri, 5 Apr 2024 13:26:37 -0600 In-Reply-To: Cc: Jonathan Corbet , Kent Overstreet , Brian Foster , Chris Mason , Josef Bacik , David Sterba , Jaegeuk Kim , Chao Yu , Alexander Viro , Christian Brauner , Jan Kara , =?utf-8?Q?Micka=C3=ABl_Sala=C3=BCn?= , linux-doc@vger.kernel.org, Linux Kernel Mailing List , linux-bcachefs@vger.kernel.org, linux-btrfs , linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, kernel-team@meta.com To: Sweet Tea Dorminy References: X-Mailer: Apple Mail (2.3273) --Apple-Mail=_23208463-7A57-4687-8755-FF47195EDFA6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Apr 3, 2024, at 1:22 AM, Sweet Tea Dorminy = wrote: >=20 > Signed-off-by: Sweet Tea Dorminy > --- > fs/nilfs2/inode.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) >=20 > diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c > index 4d3c347c982b..e3108f2cead7 100644 > --- a/fs/nilfs2/inode.c > +++ b/fs/nilfs2/inode.c > @@ -1160,7 +1160,7 @@ int nilfs_fiemap(struct inode *inode, struct = fiemap_extent_info *fieinfo, > { > struct the_nilfs *nilfs =3D inode->i_sb->s_fs_info; > __u64 logical =3D 0, phys =3D 0, size =3D 0; > - __u32 flags =3D 0; > + __u32 flags =3D FIEMAP_EXTENT_HAS_PHYS_LEN; >=20 > loff_t isize; > sector_t blkoff, end_blkoff; > sector_t delalloc_blkoff; > @@ -1197,7 +1197,9 @@ int nilfs_fiemap(struct inode *inode, struct = fiemap_extent_info *fieinfo, > if (blkoff > end_blkoff) > break; >=20 > - flags =3D FIEMAP_EXTENT_MERGED | = FIEMAP_EXTENT_DELALLOC; > + flags =3D FIEMAP_EXTENT_MERGED | > + FIEMAP_EXTENT_DELALLOC | > + FIEMAP_EXTENT_HAS_PHYS_LEN; IMHO, rather than setting "flags =3D FIEMAP..." here, it would be better = to initialize "flags |=3D FIEMAP_HAS_PHYS_LEN" right after = fiemap_fill_next_extent() is called, and use "flags |=3D FIEMAP_EXTENT_MERGED | = FIEMAP_EXTENT_DELALLOC" here. That makes it more clear that MERGED|DELALLOC are "add-on" flags beyond = the base flags, and if more flags are added in the future (e.g. COMPRESSED) = then the flag management will be simpler (more on this below). > @@ -1261,14 +1263,16 @@ int nilfs_fiemap(struct inode *inode, struct = fiemap_extent_info *fieinfo, > break; >=20 > /* Start another extent */ > - flags =3D FIEMAP_EXTENT_MERGED; > + flags =3D FIEMAP_EXTENT_MERGED | > + = FIEMAP_EXTENT_HAS_PHYS_LEN; Strictly speaking, this new extent should not have FIEMAP_EXTENT_MERGED = set, and start out with only FIEMAP_EXTENT_HAS_PHYS_LEN, since it has not = actually been merged with anything. > logical =3D blkoff << blkbits; > phys =3D blkphy << blkbits; > size =3D n << blkbits; > } > } else { > /* Start a new extent */ > - flags =3D FIEMAP_EXTENT_MERGED; > + flags =3D FIEMAP_EXTENT_MERGED | > + FIEMAP_EXTENT_HAS_PHYS_LEN; Then this should be "flags |=3D FIEMAP_EXTENT_MERGED" only once a second block has been merged into the prior one. Cheers, Andreas --Apple-Mail=_23208463-7A57-4687-8755-FF47195EDFA6 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQIzBAEBCAAdFiEEDb73u6ZejP5ZMprvcqXauRfMH+AFAmYQUG0ACgkQcqXauRfM H+DusBAAjLzaPC76LsfW44HKtdh7+jVJ1aHtau12SOTY37rSSphdiw/F9U6SbJ4b PwbKUBwhMzFgGjXhyUE8AX8z7CmrggtnVzeRgw8ad+1O6HfDU6ibC1w04XREKgdZ yVFCaBcijZA3b8POL+pTCS+URpbfc355WbiS1ioIiIa+1KLoBqe83dqfO9PVuS5V BGUZh1pnUhpVxJOxppQ36NgweFjuEDvG32BpN9+NEZiQFrAj2GHP/QijiQTvNoPd 7noTlgPq8zcbGPPI6HTpVyBz3ZWxYmVQ5ImDZlAOUM4WLUoyVPbUjffKC1Y66ts+ FHQy/PRtvV2ohItJbfCTPTWjgBELQeONHyLnhbRoDYNGYyysyatprSq0TVpEVHN8 gukb731ZJzStKaIHIa+FtyW2DlzCfgPgwxT8LAr57xVPvwUFU/im8OztJdRSERf3 kkEg5t5fJsF+g/NekWV4g3ynWHNmKZ0dn40oanFNjHu6VsZj0Swzj9hOfRzYAm92 yr6hPj1VQY7N5tW90Z7sMiJgFQje8/tunjh2/MEweezooqTQ3hVQrvdRykwR4j00 ATlo/5vssOjOmRVThS0jxaSTSUUcW+nFxaEeJ00Cbm5AoRtLaGmpWBkvCVDqqavm dKadcnyZvZ4mwK24TlrHA9EgHUCaGvNmEP6WJ4lfnieswdJIj60= =J11M -----END PGP SIGNATURE----- --Apple-Mail=_23208463-7A57-4687-8755-FF47195EDFA6--