Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: dsterba@suse.cz
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 21:10:48 +0800	[thread overview]
Message-ID: <8026d42f-21e1-4175-bb52-73b4b347cbd9@oracle.com> (raw)
In-Reply-To: <20240503115059.GX2585@twin.jikos.cz>



On 5/3/24 19:50, David Sterba wrote:
> 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.


oh. ok. It can be done.

Thx, Anand

  reply	other threads:[~2024-05-03 13:11 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
2024-05-03 13:10     ` Anand Jain [this message]
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=8026d42f-21e1-4175-bb52-73b4b347cbd9@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=dsterba@suse.cz \
    --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