Linux kernel -stable discussions
 help / color / mirror / Atom feed
* Re: Patch "btrfs: use bio::remaining for async checksumming synchronization" has been added to the 7.3-stable tree
       [not found] <20261117144250.1672000-1-sashal@kernel.org>
@ 2026-11-18  5:25 ` Daniel Vacek
  2026-11-18 12:40   ` Sasha Levin
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Vacek @ 2026-11-18  5:25 UTC (permalink / raw)
  To: stable; +Cc: stable-commits, David Sterba, Chris Mason

On Tue, 17 Nov 2026 at 15:42, Sasha Levin <sashal@kernel.org> wrote:
> This is a note to let you know that I've just added the patch titled
>
>     btrfs: use bio::remaining for async checksumming synchronization
>
> to the 7.3-stable tree which can be found at:
>     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
>
> The filename of the patch is:
>      btrfs-use-bio-remaining-for-async-checksumming-synch.patch
> and it can be found in the queue-7.3 subdirectory.
>
> If you, or anyone else, feels it should not be added to the stable tree,
> please let <stable@vger.kernel.org> know about it.

This one is only worth for CONFIG_BTRFS_EXPERIMENTAL builds.
I'm not sure it makes sense pulling it to stable.

--nX

> commit f1d59a15198b62c45ec7062017ef72cace97ef0d
> Author: Daniel Vacek <neelx@suse.com>
> Date:   Wed Sep 2 15:56:27 2026 +0200
>
>     btrfs: use bio::remaining for async checksumming synchronization
>
>     [ Upstream commit e54f700d6ae3203221745c168dae20d88f2be4f1 ]
>
>     We can use bio::remaining counter to sync the offloaded checksumming.
>     As a result we can slim down the btrfs_bio structure by 24 bytes
>     and simplify the code a bit.
>
>     Difference in pahole output:
>
>     -       /* size: 328, cachelines: 6, members: 15 */
>     +       /* size: 304, cachelines: 5, members: 14 */
>
>     Moreover this will allow us enabling async checksumming with encryption
>     where we need to checksum the bounce bio instead of our regular one
>     embedded in btrfs_bio. And so we need to extend it's lifetime. This is
>     the preferred way to do so.
>
>     This also fixes a bug in experimental build where the async checksumming
>     was using the system workqueue instead of fs_info::endio_workers.
>
>     Fixes: dd57c78aec39 ("btrfs: introduce btrfs_bio::async_csum")
>     Reviewed-by: Qu Wenruo <wqu@suse.com>
>     Signed-off-by: Daniel Vacek <neelx@suse.com>
>     Signed-off-by: David Sterba <dsterba@suse.com>
>     Signed-off-by: Sasha Levin <sashal@kernel.org>
>
> diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
> index 19b4855969f53..771b7d598aeee 100644
> --- a/fs/btrfs/bio.c
> +++ b/fs/btrfs/bio.c
> @@ -103,7 +103,6 @@ static struct btrfs_bio *btrfs_split_bio(struct btrfs_fs_info *fs_info,
>         bbio->can_use_append = orig_bbio->can_use_append;
>         bbio->is_scrub = orig_bbio->is_scrub;
>         bbio->is_remap = orig_bbio->is_remap;
> -       bbio->async_csum = orig_bbio->async_csum;
>
>         atomic_inc(&orig_bbio->pending_ios);
>         return bbio;
> @@ -114,9 +113,6 @@ void btrfs_bio_end_io(struct btrfs_bio *bbio, blk_status_t status)
>         /* Make sure we're already in task context. */
>         ASSERT(in_task());
>
> -       if (bbio->async_csum)
> -               wait_for_completion(&bbio->csum_done);
> -
>         bbio->bio.bi_status = status;
>         if (bbio->bio.bi_pool == &btrfs_clone_bioset) {
>                 struct btrfs_bio *orig_bbio = bbio->private;
> diff --git a/fs/btrfs/bio.h b/fs/btrfs/bio.h
> index b7bd377a01624..bbf362b8668bb 100644
> --- a/fs/btrfs/bio.h
> +++ b/fs/btrfs/bio.h
> @@ -58,7 +58,6 @@ struct btrfs_bio {
>                         struct btrfs_ordered_extent *ordered;
>                         struct btrfs_ordered_sum *sums;
>                         struct work_struct csum_work;
> -                       struct completion csum_done;
>                         struct bvec_iter csum_saved_iter;
>                         u64 orig_physical;
>                         u64 orig_logical;
> @@ -93,9 +92,6 @@ struct btrfs_bio {
>         /* Whether the bio is coming from copy_remapped_data_io(). */
>         bool is_remap:1;
>
> -       /* Whether the csum generation for data write is async. */
> -       bool async_csum:1;
> -
>         /* Whether the bio is written using zone append. */
>         bool can_use_append:1;
>
> diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
> index 2c6c14dfe3932..ae1fd4da38d31 100644
> --- a/fs/btrfs/file-item.c
> +++ b/fs/btrfs/file-item.c
> @@ -819,9 +819,8 @@ static void csum_one_bio_work(struct work_struct *work)
>         struct btrfs_bio *bbio = container_of(work, struct btrfs_bio, csum_work);
>
>         ASSERT(btrfs_op(&bbio->bio) == BTRFS_MAP_WRITE);
> -       ASSERT(bbio->async_csum == true);
>         csum_one_bio(bbio);
> -       complete(&bbio->csum_done);
> +       bio_endio(&bbio->bio);
>  }
>
>  /*
> @@ -855,10 +854,9 @@ int btrfs_csum_one_bio(struct btrfs_bio *bbio, bool async)
>                 csum_one_bio(bbio);
>                 return 0;
>         }
> -       init_completion(&bbio->csum_done);
> -       bbio->async_csum = true;
> +       bio_inc_remaining(bio);
>         INIT_WORK(&bbio->csum_work, csum_one_bio_work);
> -       schedule_work(&bbio->csum_work);
> +       queue_work(fs_info->endio_workers, &bbio->csum_work);
>         return 0;
>  }
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Patch "btrfs: use bio::remaining for async checksumming synchronization" has been added to the 7.3-stable tree
  2026-11-18  5:25 ` Patch "btrfs: use bio::remaining for async checksumming synchronization" has been added to the 7.3-stable tree Daniel Vacek
@ 2026-11-18 12:40   ` Sasha Levin
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2026-11-18 12:40 UTC (permalink / raw)
  To: Daniel Vacek, stable
  Cc: Sasha Levin, stable-commits, David Sterba, Chris Mason

On Wed, Nov 18, 2026 at 06:25:54AM +0100, Daniel Vacek wrote:
> This one is only worth for CONFIG_BTRFS_EXPERIMENTAL builds.
> I'm not sure it makes sense pulling it to stable.

Dropped e54f700d6ae3 ("btrfs: use bio::remaining for async checksumming
synchronization") from the 7.3 queue, along with 57c6777ebd24 ("btrfs: consume
given iter directly instead of copying in csum_one_bio()"), which was only
queued as its dependency.

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-18 12:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261117144250.1672000-1-sashal@kernel.org>
2026-11-18  5:25 ` Patch "btrfs: use bio::remaining for async checksumming synchronization" has been added to the 7.3-stable tree Daniel Vacek
2026-11-18 12:40   ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox