• Naohiro Aota's avatar
    btrfs: zoned: serialize log transaction on zoned filesystems · fa1a0f42
    Naohiro Aota authored
    This is the 2/3 patch to enable tree-log on zoned filesystems.
    
    Since we can start more than one log transactions per subvolume
    simultaneously, nodes from multiple transactions can be allocated
    interleaved. Such mixed allocation results in non-sequential writes at
    the time of a log transaction commit. The nodes of the global log root
    tree (fs_info->log_root_tree), also have the same problem with mixed
    allocation.
    
    Serializes log transactions by waiting for a committing transaction when
    someone tries to start a new transaction, to avoid the mixed allocation
    problem. We must also wait for running log transactions from another
    subvolume, but there is no easy way to detect which subvolume root is
    running a log transaction. So, this patch forbids starting a new log
    transaction when other subvolumes already allocated the global log root
    tree.
    Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
    Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
    Signed-off-by: default avatarNaohiro Aota <naohiro.aota@wdc.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    fa1a0f42
tree-log.c 173 KB