]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: send: use struct send_ctx *sctx for btrfs_compare_trees and changed_cb
authorRoman Anasal <roman.anasal@bdsu.de>
Mon, 25 Jan 2021 19:43:25 +0000 (20:43 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 8 Feb 2021 21:58:57 +0000 (22:58 +0100)
commit2fe66d269ec4ca5d5ebde1e6255fb1522e0ed108
tree61f11df736b38fa35f72e1787efe83c45b996e19
parenta40e55953d4b54da05cfe8901023a93d738aa994
btrfs: send: use struct send_ctx *sctx for btrfs_compare_trees and changed_cb

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
cast 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 5689b64cc88d ("btrfs: send: remove indirect callback
parameter for changed_cb").

Signed-off-by: Roman Anasal <roman.anasal@bdsu.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/send.c