From: Andreas Dilger <adilger@dilger.ca>
To: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Cc: "Jonathan Corbet" <corbet@lwn.net>,
"Kent Overstreet" <kent.overstreet@linux.dev>,
"Brian Foster" <bfoster@redhat.com>, "Chris Mason" <clm@fb.com>,
"Josef Bacik" <josef@toxicpanda.com>,
"David Sterba" <dsterba@suse.com>,
"Jaegeuk Kim" <jaegeuk@kernel.org>, "Chao Yu" <chao@kernel.org>,
"Alexander Viro" <viro@zeniv.linux.org.uk>,
"Christian Brauner" <brauner@kernel.org>,
"Jan Kara" <jack@suse.cz>, "Mickaël Salaün" <mic@digikod.net>,
linux-doc@vger.kernel.org,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
linux-bcachefs@vger.kernel.org,
linux-btrfs <linux-btrfs@vger.kernel.org>,
linux-f2fs-devel@lists.sourceforge.net,
linux-fsdevel@vger.kernel.org, kernel-team@meta.com
Subject: Re: [PATCH v3 06/13] nilfs2: fiemap: return correct extent physical length
Date: Fri, 5 Apr 2024 13:26:37 -0600 [thread overview]
Message-ID: <CBF9FEA5-0FD4-44BE-A2DC-54B7E5D1A874@dilger.ca> (raw)
In-Reply-To: <bd06389b4c9c33ab1411f2941875f02867b18642.1712126039.git.sweettea-kernel@dorminy.me>
[-- Attachment #1: Type: text/plain, Size: 2413 bytes --]
On Apr 3, 2024, at 1:22 AM, Sweet Tea Dorminy <sweettea-kernel@dorminy.me> wrote:
>
> Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
> ---
> fs/nilfs2/inode.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> 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 = inode->i_sb->s_fs_info;
> __u64 logical = 0, phys = 0, size = 0;
> - __u32 flags = 0;
> + __u32 flags = FIEMAP_EXTENT_HAS_PHYS_LEN;
>
> 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;
>
> - flags = FIEMAP_EXTENT_MERGED | FIEMAP_EXTENT_DELALLOC;
> + flags = FIEMAP_EXTENT_MERGED |
> + FIEMAP_EXTENT_DELALLOC |
> + FIEMAP_EXTENT_HAS_PHYS_LEN;
IMHO, rather than setting "flags = FIEMAP..." here, it would be better to
initialize "flags |= FIEMAP_HAS_PHYS_LEN" right after fiemap_fill_next_extent()
is called, and use "flags |= 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;
>
> /* Start another extent */
> - flags = FIEMAP_EXTENT_MERGED;
> + flags = 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 = blkoff << blkbits;
> phys = blkphy << blkbits;
> size = n << blkbits;
> }
> } else {
> /* Start a new extent */
> - flags = FIEMAP_EXTENT_MERGED;
> + flags = FIEMAP_EXTENT_MERGED |
> + FIEMAP_EXTENT_HAS_PHYS_LEN;
Then this should be "flags |= FIEMAP_EXTENT_MERGED" only once a second
block has been merged into the prior one.
Cheers, Andreas
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]
next prev parent reply other threads:[~2024-04-05 19:24 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-03 7:22 [PATCH v3 00/13] fiemap extension for more physical information Sweet Tea Dorminy
2024-04-03 7:22 ` [PATCH v3 01/13] fs: fiemap: add physical_length field to extents Sweet Tea Dorminy
2024-04-03 16:57 ` Brian Foster
2024-04-05 18:47 ` [PATCH v3 01/13] " Andreas Dilger
2024-04-09 16:22 ` [PATCH v3 01/13] fs: " Darrick J. Wong
2024-04-09 19:50 ` Andreas Dilger
2024-04-03 7:22 ` [PATCH v3 02/13] fs: fiemap: update fiemap_fill_next_extent() signature Sweet Tea Dorminy
2024-04-03 16:58 ` Brian Foster
2024-04-05 19:05 ` [PATCH v3 02/13] " Andreas Dilger
2024-04-05 19:06 ` Kent Overstreet
2024-04-03 7:22 ` [PATCH v3 03/13] fs: fiemap: add new COMPRESSED extent state Sweet Tea Dorminy
2024-04-05 19:06 ` [PATCH v3 03/13] " Andreas Dilger
2024-04-03 7:22 ` [PATCH v3 04/13] btrfs: fiemap: emit new COMPRESSED state Sweet Tea Dorminy
2024-04-05 19:10 ` Andreas Dilger
2024-04-03 7:22 ` [PATCH v3 05/13] btrfs: fiemap: return extent physical size Sweet Tea Dorminy
2024-04-03 7:22 ` [PATCH v3 06/13] nilfs2: fiemap: return correct extent physical length Sweet Tea Dorminy
2024-04-05 19:26 ` Andreas Dilger [this message]
2024-04-03 7:22 ` [PATCH v3 07/13] ext4: " Sweet Tea Dorminy
2024-04-03 11:22 ` Jan Kara
2024-04-03 7:22 ` [PATCH v3 08/13] f2fs: fiemap: add physical length to trace_f2fs_fiemap Sweet Tea Dorminy
2024-04-05 19:28 ` Andreas Dilger
2024-04-03 7:22 ` [PATCH v3 09/13] f2fs: fiemap: return correct extent physical length Sweet Tea Dorminy
2024-04-03 7:22 ` [PATCH v3 10/13] ocfs2: " Sweet Tea Dorminy
2024-04-03 11:25 ` Jan Kara
2024-04-03 7:22 ` [PATCH v3 11/13] bcachefs: " Sweet Tea Dorminy
2024-04-03 17:00 ` Brian Foster
2024-04-03 18:15 ` Kent Overstreet
2024-04-03 7:22 ` [PATCH v3 12/13] f2fs: fiemap: emit new COMPRESSED state Sweet Tea Dorminy
2024-04-03 7:22 ` [PATCH v3 13/13] bcachefs: " Sweet Tea Dorminy
2024-04-05 19:17 ` Andreas Dilger
2024-04-05 19:34 ` Andreas Dilger
2024-04-06 5:20 ` Kent Overstreet
2024-04-03 8:29 ` [PATCH v3 00/13] fiemap extension for more physical information Gao Xiang
2024-04-03 15:11 ` Sweet Tea Dorminy
2024-04-04 0:43 ` Gao Xiang
2024-04-03 18:17 ` Kent Overstreet
2024-04-03 18:20 ` Darrick J. Wong
2024-04-05 18:20 ` Andreas Dilger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CBF9FEA5-0FD4-44BE-A2DC-54B7E5D1A874@dilger.ca \
--to=adilger@dilger.ca \
--cc=bfoster@redhat.com \
--cc=brauner@kernel.org \
--cc=chao@kernel.org \
--cc=clm@fb.com \
--cc=corbet@lwn.net \
--cc=dsterba@suse.com \
--cc=jack@suse.cz \
--cc=jaegeuk@kernel.org \
--cc=josef@toxicpanda.com \
--cc=kent.overstreet@linux.dev \
--cc=kernel-team@meta.com \
--cc=linux-bcachefs@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mic@digikod.net \
--cc=sweettea-kernel@dorminy.me \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).