• Filipe Manana's avatar
    btrfs: refactor btrfs_drop_extents() to make it easier to extend · 5893dfb9
    Filipe Manana authored
    There are many arguments for __btrfs_drop_extents() and its wrapper
    btrfs_drop_extents(), which makes it hard to add more arguments to it and
    requires changing every caller. I have added a couple myself back in 2014
    commit 1acae57b ("Btrfs: faster file extent item replace operations")
    and therefore know firsthand that it is a bit cumbersome to add additional
    arguments to these functions.
    
    Since I will need to add more arguments in a subsequent bug fix, this
    change is preparatory work and adds a data structure that holds all the
    arguments, for both input and output, that are passed to this function,
    with some comments in the structure's definition mentioning what each
    field is and how it relates to other fields.
    
    Callers of this function need only to zero out the content of the
    structure and setup only the fields they need. This also removes the
    need to have both __btrfs_drop_extents() and btrfs_drop_extents(), so
    now we have a single function named btrfs_drop_extents() that takes a
    pointer to this new data structure (struct btrfs_drop_extents_args).
    Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
    Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    5893dfb9
ctree.h 124 KB