• Omar Sandoval's avatar
    btrfs: send: write larger chunks when using stream v2 · 356bbbb6
    Omar Sandoval authored
    The length field of the send stream TLV header is 16 bits. This means
    that the maximum amount of data that can be sent for one write is 64K
    minus one. However, encoded writes must be able to send the maximum
    compressed extent (128K) in one command, or more. To support this, send
    stream version 2 encodes the DATA attribute differently: it has no
    length field, and the length is implicitly up to the end of containing
    command (which has a 32bit length field). Although this is necessary
    for encoded writes, normal writes can benefit from it, too.
    
    Also add a check to enforce that the DATA attribute is last. It is only
    strictly necessary for v2, but we might as well make v1 consistent with
    it.
    
    For v2, let's bump up the send buffer to the maximum compressed extent
    size plus 16K for the other metadata (144K total). Since this will most
    likely be vmalloc'd (and always will be after the next commit), we round
    it up to the next page since we might as well use the rest of the page
    on systems with >16K pages.
    Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
    Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    356bbbb6
send.c 194 KB