• Sweet Tea Dorminy's avatar
    btrfs: don't commit transaction for every subvol create · 1b53e51a
    Sweet Tea Dorminy authored
    
    
    Recently a Meta-internal workload encountered subvolume creation taking
    up to 2s each, significantly slower than directory creation. As they
    were hoping to be able to use subvolumes instead of directories, and
    were looking to create hundreds, this was a significant issue. After
    Josef investigated, it turned out to be due to the transaction commit
    currently performed at the end of subvolume creation.
    
    This change improves the workload by not doing transaction commit for every
    subvolume creation, and merely requiring a transaction commit on fsync.
    In the worst case, of doing a subvolume create and fsync in a loop, this
    should require an equal amount of time to the current scheme; and in the
    best case, the internal workload creating hundreds of subvolumes before
    fsyncing is greatly improved.
    
    While it would be nice to be able to use the log tree and use the normal
    fsync path, log tree replay can't deal with new subvolume inodes
    presently.
    
    It's possible that there's some reason that the transaction commit is
    necessary for correctness during subvolume creation; however,
    git logs indicate that the commit dates back to the beginning of
    subvolume creation, and there are no notes on why it would be necessary.
    Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
    Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
    Reviewed-by: default avatarNeal Gompa <neal@gompa.dev>
    Signed-off-by: default avatarSweet Tea Dorminy <sweettea-kernel@dorminy.me>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    1b53e51a
ioctl.c 115 KB