• Filipe Manana's avatar
    btrfs: move btrfs_realloc_node() from ctree.c into defrag.c · 6422b4cd
    Filipe Manana authored
    btrfs_realloc_node() is only used by the defrag code. Nowadays we have a
    defrag.c file, so move it, and its helper close_blocks(), into defrag.c.
    
    During the move also do a few minor cosmetic changes:
    
    1) Change the return value of close_blocks() from int to bool;
    
    2) Use SZ_32K instead of 32768 at close_blocks();
    
    3) Make some variables const in btrfs_realloc_node(), 'blocksize' and
       'end_slot';
    
    4) Get rid of 'parent_nritems' variable, in both places where it was
       used it could be replaced by calling btrfs_header_nritems(parent);
    
    5) Change the type of a couple variables from int to bool;
    
    6) Rename variable 'err' to 'ret', as that's the most common name we
       use to track the return value of a function;
    
    7) Move some variables from the top scope to the scope of the for loop
       where they are used.
    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>
    6422b4cd
ctree.h 22.2 KB