Re: [PATCH] btrfs: send: use struct send_ctx *sctx for btrfs_compare_trees and changed_cb
From: David Sterba <hidden>
Date: 2021-01-27 10:13:54
From: David Sterba <hidden>
Date: 2021-01-27 10:13:54
On Mon, Jan 25, 2021 at 08:43:25PM +0100, Roman Anasal wrote:
btrfs_compare_trees and changed_cb use a void *ctx parameter instead of
struct send_ctx *sctx but when used in changed_cb it is immediately
casted to `struct send_ctx *sctx = ctx;`.
changed_cb is only ever called from btrfs_compare_trees and full_send_tree:
- full_send_tree already passes a struct send_ctx *sctx
- btrfs_compare_trees is only called by send_subvol with a struct send_ctx *sctx
- void *ctx in btrfs_compare_trees is only used to be passed to changed_cb
So casting to/from void *ctx seems unnecessary and directly using
struct send_ctx *sctx instead provides better type-safety.
The original reason for using void *ctx in the first place seems to have
been dropped with
1b51d6f ("btrfs: send: remove indirect callback parameter for changed_cb")
Signed-off-by: Roman Anasal <redacted>Makes sense, added to misc-next, thanks.