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 2/4] btrfs-progs: convert: struct blk_iterate_data, add ext2-specific file inode pointers
Date: Fri, 3 May 2024 13:49:30 +0200	[thread overview]
Message-ID: <20240503114930.GW2585@twin.jikos.cz> (raw)
In-Reply-To: <df071a4eaaf83d9474449f281ba8b1f905922744.1714722726.git.anand.jain@oracle.com>

On Fri, May 03, 2024 at 05:08:53PM +0800, Anand Jain wrote:
> To obtain the file data extent flags, we require the use of ext2 helper
> functions, pass these pointer in the 'struct blk_iterate_data'. However,
> this struct is a common function across both 'reiserfs' and 'ext4'
> filesystems. Since there is no further development on 'convert-reiserfs',
> this patch avoids creating a mess which won't be used.

Even though there will be no more reiserfs development you should not
clutter the generic API for filesystems with ext2-specific members.

> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  convert/source-ext2.c | 4 ++++
>  convert/source-fs.h   | 5 +++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/convert/source-ext2.c b/convert/source-ext2.c
> index a3f61bb01171..625387e95857 100644
> --- a/convert/source-ext2.c
> +++ b/convert/source-ext2.c
> @@ -324,6 +324,10 @@ static int ext2_create_file_extents(struct btrfs_trans_handle *trans,
>  	init_blk_iterate_data(&data, trans, root, btrfs_inode, objectid,
>  			convert_flags & CONVERT_FLAG_DATACSUM);
>  
> +	data.ext2_fs = ext2_fs;
> +	data.ext2_ino = ext2_ino;
> +	data.ext2_inode = ext2_inode;
> +
>  	err = ext2fs_block_iterate2(ext2_fs, ext2_ino, BLOCK_FLAG_DATA_ONLY,
>  				    NULL, ext2_block_iterate_proc, &data);
>  	if (err)
> diff --git a/convert/source-fs.h b/convert/source-fs.h
> index b26e1842941d..0e71e79eddcc 100644
> --- a/convert/source-fs.h
> +++ b/convert/source-fs.h
> @@ -20,6 +20,7 @@
>  #include "kerncompat.h"
>  #include <sys/types.h>
>  #include <pthread.h>
> +#include <ext2fs/ext2fs.h>
>  #include "kernel-shared/uapi/btrfs_tree.h"
>  #include "convert/common.h"
>  
> @@ -118,6 +119,10 @@ struct btrfs_convert_operations {
>  };
>  
>  struct blk_iterate_data {
> +	ext2_filsys ext2_fs;
> +	struct ext2_inode *ext2_inode;
> +	ext2_ino_t ext2_ino;

This should be a void pointer filled by the target filesystem
implementation that fills it with anything it needs.

> +
>  	struct btrfs_trans_handle *trans;
>  	struct btrfs_root *root;
>  	struct btrfs_root *convert_root;
> -- 
> 2.39.3
> 

  reply	other threads:[~2024-05-03 11:56 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 [this message]
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
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=20240503114930.GW2585@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).