• Filipe Manana's avatar
    btrfs: search for last logged dir index if it's not cached in the inode · 193df624
    Filipe Manana authored
    
    
    The key offset of the last dir index item that was logged is stored in
    the inode's last_dir_index_offset field. However that field is not
    persisted in the inode item or elsewhere, so if the inode gets evicted
    and reloaded, it gets a value of (u64)-1, so that when we are logging
    dir index items we check if they were logged before, to avoid attempts
    to insert duplicated keys and fallback to a transaction commit.
    
    Improve on this by searching for the last dir index that was logged when
    we start logging a directory if the inode's last_dir_index_offset is not
    set (has a value of (u64)-1) and it was logged before. This avoids
    checking if each dir index item we find was already logged before, and
    simplifies the logging of dir index items (process_dir_items_leaf()).
    
    This will also be needed for an incoming change where we start logging
    delayed items directly, without flushing them first.
    Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    193df624
tree-log.c 196 KB