• Filipe David Borba Manana's avatar
    Btrfs: remove unnecessary tree search when logging inode · 3d41d702
    Filipe David Borba Manana authored
    In tree-log.c:btrfs_log_inode(), we keep calling btrfs_search_forward()
    until it returns a key whose objectid is higher than our inode or until
    the key's type is higher than our maximum allowed type.
    
    At the end of the loop, we increment our mininum search key's objectid
    and type regardless of our desired target objectid and maximum desired
    type, which causes another loop iteration that will call again
    btrfs_search_forward() just to figure out we've gone beyond our maximum
    key and exit the loop. Therefore while incrementing our minimum key,
    don't do it blindly and exit the loop immiediately if the next search
    key's objectid or type is beyond what we seek.
    
    Also after incrementing the type, set the key's offset to 0, which was
    missing and could make us loose some of the inode's items.
    Signed-off-by: default avatarFilipe David Borba Manana <fdmanana@gmail.com>
    Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
    Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
    3d41d702
tree-log.c 109 KB