linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Cc: "Jonathan Corbet" <corbet@lwn.net>,
	"Kent Overstreet" <kent.overstreet@linux.dev>,
	"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@vger.kernel.org,
	linux-bcachefs@vger.kernel.org, linux-btrfs@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-fsdevel@vger.kernel.org, kernel-team@meta.com
Subject: Re: [PATCH v3 11/13] bcachefs: fiemap: return correct extent physical length
Date: Wed, 3 Apr 2024 13:00:11 -0400	[thread overview]
Message-ID: <Zg2LG1_2-ac1GlsG@bfoster> (raw)
In-Reply-To: <b9b795987a485afa0fdb8f0decc09405691d9320.1712126039.git.sweettea-kernel@dorminy.me>

On Wed, Apr 03, 2024 at 03:22:52AM -0400, Sweet Tea Dorminy wrote:
> Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
> ---
>  fs/bcachefs/fs.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
> index f830578a9cd1..d2793bae842d 100644
> --- a/fs/bcachefs/fs.c
> +++ b/fs/bcachefs/fs.c
> @@ -913,15 +913,17 @@ static int bch2_fill_extent(struct bch_fs *c,
>  			flags |= FIEMAP_EXTENT_SHARED;
>  
>  		bkey_for_each_ptr_decode(k.k, ptrs, p, entry) {
> -			int flags2 = 0;
> +			int flags2 = FIEMAP_EXTENT_HAS_PHYS_LEN;
> +			u64 phys_len = k.k->size << 9;
>  			u64 offset = p.ptr.offset;
>  
>  			if (p.ptr.unwritten)
>  				flags2 |= FIEMAP_EXTENT_UNWRITTEN;
>  
> -			if (p.crc.compression_type)
> +			if (p.crc.compression_type) {
>  				flags2 |= FIEMAP_EXTENT_ENCODED;
> -			else
> +				phys_len = p.crc.compressed_size << 9;
> +			} else
>  				offset += p.crc.offset;
>  
>  			if ((offset & (block_sectors(c) - 1)) ||
> @@ -931,7 +933,7 @@ static int bch2_fill_extent(struct bch_fs *c,
>  			ret = fiemap_fill_next_extent(info,
>  						bkey_start_offset(k.k) << 9,
>  						offset << 9,
> -						k.k->size << 9, 0,
> +						k.k->size << 9, phys_len,
>  						flags|flags2);
>  			if (ret)
>  				return ret;
> @@ -941,14 +943,18 @@ static int bch2_fill_extent(struct bch_fs *c,
>  	} else if (bkey_extent_is_inline_data(k.k)) {
>  		return fiemap_fill_next_extent(info,
>  					       bkey_start_offset(k.k) << 9,
> -					       0, k.k->size << 9, 0,
> +					       0, k.k->size << 9,
> +					       bkey_inline_data_bytes(k.k),

Question for Kent perhaps, but what's the functional difference between
bkey_inline_data_bytes() and k->size in this particular case?

FWIW that and the other couple nitty questions aside, this all LGTM.
Thanks.

Brian

>  					       flags|
> +					       FIEMAP_EXTENT_HAS_PHYS_LEN|
>  					       FIEMAP_EXTENT_DATA_INLINE);
>  	} else if (k.k->type == KEY_TYPE_reservation) {
>  		return fiemap_fill_next_extent(info,
>  					       bkey_start_offset(k.k) << 9,
> -					       0, k.k->size << 9, 0,
> +					       0, k.k->size << 9,
> +					       k.k->size << 9,
>  					       flags|
> +					       FIEMAP_EXTENT_HAS_PHYS_LEN|
>  					       FIEMAP_EXTENT_DELALLOC|
>  					       FIEMAP_EXTENT_UNWRITTEN);
>  	} else {
> -- 
> 2.43.0
> 
> 


  reply	other threads:[~2024-04-03 16:58 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
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 [this message]
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=Zg2LG1_2-ac1GlsG@bfoster \
    --to=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).