Re: [PATCH 2/2] btrfs: move end_io_func argument to btrfs_bio_ctrl structure

Anand Jain
2022-09-12T13:13:24Z

On 12/09/2022 14:28, Qu Wenruo wrote:
> For function submit_extent_page() and alloc_new_bio(), we have an
> argument @end_io_func to indicate the end io function.
>
> But that function never change inside any call site of them, thus no
> need to pass the pointer around everywhere.
>
> There is a better match for the lifespan of all the call sites, as we
> have btrfs_bio_ctrl structure, thus we can put the endio function
> pointer there, and grab the pointer every time we allocate a new bio.
>
> Also add extra ASSERT()s to make sure every call site of
> submit_extent_page() and alloc_new_bio() has properly set the pointer
> inside btrfs_bio_ctrl.
>
> This removes one argument from the already long argument list of
> submit_extent_page().
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Reviewed-by: Anand Jain <anand.jain@oracle.com>

Nit: submit_extent_page comments has stale reference that need fixing too.

--------------
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index cea7d09c2dc1..3e902ed99240 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3347,10 +3347,7 @@ static int alloc_new_bio(struct btrfs_inode *inode,
* @size: portion of page that we want to write to
* @pg_offset: offset of the new bio or to check whether we are adding
* a contiguous page to the previous one
- * @bio_ret: must be valid pointer, newly allocated bio will be stored
there
* @end_io_func: end_io callback for new bio
- * @mirror_num: desired mirror to read/write
- * @prev_bio_flags: flags of previous bio to see if we can merge the
current one
* @compress_type: compress type for current bio
*/
static int submit_extent_page(blk_opf_t opf,
--------------