linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Anand Jain <anand.jain@oracle.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 3/4] btrfs-progs: convert: refactor __btrfs_record_file_extent to add a prealloc flag
Date: Fri, 3 May 2024 13:50:59 +0200	[thread overview]
Message-ID: <20240503115059.GX2585@twin.jikos.cz> (raw)
In-Reply-To: <c4b3a3a5192fe56f7b2e1d1ec91046ec27eb1a02.1714722726.git.anand.jain@oracle.com>

On Fri, May 03, 2024 at 05:08:54PM +0800, Anand Jain wrote:
> This preparatory patch adds an argument '%prealloc' to the function
> __btrfs_record_file_extent(), to be used in the following patches.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  common/extent-tree-utils.c | 11 +++++++----
>  common/extent-tree-utils.h |  2 +-
>  convert/main.c             |  9 +++++----
>  convert/source-fs.c        |  5 +++--
>  convert/source-reiserfs.c  |  2 +-
>  mkfs/rootdir.c             |  3 ++-
>  6 files changed, 19 insertions(+), 13 deletions(-)
> 
> diff --git a/common/extent-tree-utils.c b/common/extent-tree-utils.c
> index 34c7e5095160..2ccac6b44cea 100644
> --- a/common/extent-tree-utils.c
> +++ b/common/extent-tree-utils.c
> @@ -122,7 +122,7 @@ static int __btrfs_record_file_extent(struct btrfs_trans_handle *trans,
>  				      struct btrfs_root *root, u64 objectid,
>  				      struct btrfs_inode_item *inode,
>  				      u64 file_pos, u64 disk_bytenr,
> -				      u64 *ret_num_bytes)
> +				      u64 *ret_num_bytes, bool prealloc)
>  {
>  	int ret;
>  	struct btrfs_fs_info *info = root->fs_info;
> @@ -229,7 +229,10 @@ static int __btrfs_record_file_extent(struct btrfs_trans_handle *trans,
>  	leaf = path->nodes[0];
>  	fi = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_file_extent_item);
>  	btrfs_set_file_extent_generation(leaf, fi, trans->transid);
> -	btrfs_set_file_extent_type(leaf, fi, BTRFS_FILE_EXTENT_REG);
> +	if (prealloc)
> +		btrfs_set_file_extent_type(leaf, fi, BTRFS_FILE_EXTENT_PREALLOC);
> +	else
> +		btrfs_set_file_extent_type(leaf, fi, BTRFS_FILE_EXTENT_REG);

The bool parameter makes it less clear what it means in all the callers,
as it is supposed to select the type of extent you could pass the
BTRFS_FILE_ExTENT_ constant directly.

  reply	other threads:[~2024-05-03 11:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-03  9:08 [PATCH 0/4] btrfs-progs: add support ext4 unwritten file extent Anand Jain
2024-05-03  9:08 ` [PATCH 1/4] btrfs-progs: convert: refactor ext2_create_file_extents add argument ext2_inode Anand Jain
2024-05-03  9:08 ` [PATCH 2/4] btrfs-progs: convert: struct blk_iterate_data, add ext2-specific file inode pointers Anand Jain
2024-05-03 11:49   ` David Sterba
2024-05-03 13:09     ` Anand Jain
2024-05-03  9:08 ` [PATCH 3/4] btrfs-progs: convert: refactor __btrfs_record_file_extent to add a prealloc flag Anand Jain
2024-05-03 11:50   ` David Sterba [this message]
2024-05-03 13:10     ` Anand Jain
2024-05-03  9:08 ` [PATCH RFC 4/4] btrfs-progs: convert: support ext2 unwritten file data extents Anand Jain
2024-05-03  9:37   ` Qu Wenruo
2024-05-03 12:25     ` Anand Jain
2024-05-03 22:23       ` Qu Wenruo
2024-05-03 23:27         ` Anand Jain
2024-05-04  0:06           ` Qu Wenruo

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=20240503115059.GX2585@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=anand.jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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).