All of lore.kernel.org
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: linux-btrfs@vger.kernel.org
Cc: kernel-team@fb.com
Subject: [PATCH v13 00/17] btrfs: add ioctls and send/receive support for reading/writing compressed data
Date: Thu, 10 Feb 2022 11:09:50 -0800	[thread overview]
Message-ID: <cover.1644519257.git.osandov@fb.com> (raw)

From: Omar Sandoval <osandov@fb.com>

This series has three parts: new Btrfs ioctls for reading/writing
compressed data, support for sending compressed data via Btrfs send, and
btrfs-progs support for sending/receiving compressed data and writing it
with the new ioctl.

Patches 1 and 2 are VFS changes exporting a couple of helpers for checks
needed by reads and writes. Patches 3-8 are preparatory Btrfs changes
for compressed reads and writes. Patch 6 is a cleanup. Patch 9 adds the
compressed read ioctl and patch 10 adds the compressed write ioctl.

The main use-case for this interface is Btrfs send/receive. Currently,
when sending data from one compressed filesystem to another, the sending
side decompresses the data and the receiving side recompresses it before
writing it out. This is wasteful and can be avoided if we can just send
and write compressed extents.

Patches 11 and 12 are cleanups for Btrfs send. Patches 13-17 add the
Btrfs send support. See the previous posting for more details and
benchmarks [1]. Patches 13-15 prepare some protocol changes for send
stream v2. Patch 16 implements compressed send. Patch 17 enables send
stream v2 and compressed send in the send ioctl when requested.

These patches are based on Dave Sterba's Btrfs misc-next branch [2],
which is in turn currently based on v5.17-rc3. Test cases are here [3].

Changes since v12 [4]:

- Changed some LZO code to use filesystem sector size instead of page
  size.
- Changed to use btrfs_inode_lock() instead of inode_lock().
- Added explanation of why we don't need to hold mmap lock for encoded
  reads to commit message.
- Got rid of GFP_HIGHMEM allocations.
- Changed send protocol definitions to use explicit numbers.
- Changed btrfs send patch to default to protocol v1 for now.
- Style cleanups.

1: https://lore.kernel.org/linux-btrfs/cover.1615922753.git.osandov@fb.com/
2: https://github.com/kdave/btrfs-devel/tree/misc-next
3: https://github.com/osandov/xfstests/tree/btrfs-encoded-io
4: https://lore.kernel.org/linux-btrfs/cover.1637179348.git.osandov@fb.com/

Omar Sandoval (17):
  fs: export rw_verify_area()
  fs: export variant of generic_write_checks without iov_iter
  btrfs: don't advance offset for compressed bios in
    btrfs_csum_one_bio()
  btrfs: add ram_bytes and offset to btrfs_ordered_extent
  btrfs: support different disk extent size for delalloc
  btrfs: clean up cow_file_range_inline()
  btrfs: optionally extend i_size in cow_file_range_inline()
  btrfs: add definitions + documentation for encoded I/O ioctls
  btrfs: add BTRFS_IOC_ENCODED_READ
  btrfs: add BTRFS_IOC_ENCODED_WRITE
  btrfs: send: remove unused send_ctx::{total,cmd}_send_size
  btrfs: send: explicitly number commands and attributes
  btrfs: add send stream v2 definitions
  btrfs: send: write larger chunks when using stream v2
  btrfs: send: allocate send buffer with alloc_page() and vmap() for v2
  btrfs: send: send compressed extents with encoded writes
  btrfs: send: enable support for stream v2 and compressed writes

 fs/btrfs/compression.c     |  10 +-
 fs/btrfs/compression.h     |   6 +-
 fs/btrfs/ctree.h           |  19 +-
 fs/btrfs/delalloc-space.c  |  18 +-
 fs/btrfs/file-item.c       |  32 +-
 fs/btrfs/file.c            |  68 ++-
 fs/btrfs/inode.c           | 930 +++++++++++++++++++++++++++++++++----
 fs/btrfs/ioctl.c           | 208 +++++++++
 fs/btrfs/ordered-data.c    | 131 ++----
 fs/btrfs/ordered-data.h    |  25 +-
 fs/btrfs/relocation.c      |   2 +-
 fs/btrfs/send.c            | 324 +++++++++++--
 fs/btrfs/send.h            | 142 +++---
 fs/internal.h              |   5 -
 fs/read_write.c            |  34 +-
 include/linux/fs.h         |   2 +
 include/uapi/linux/btrfs.h | 142 +++++-
 17 files changed, 1760 insertions(+), 338 deletions(-)

The btrfs-progs patches were written by Boris Burkov with some updates
from me. Patches 1-4 are preparation. Patch 5 implements encoded writes.
Patch 6 implements the fallback to decompressing. Patches 7 and 8
implement the other commands. Patch 9 adds the new `btrfs send` options.
Patch 10 adds a test case.

Boris Burkov (8):
  btrfs-progs: receive: support v2 send stream larger tlv_len
  btrfs-progs: receive: dynamically allocate sctx->read_buf
  btrfs-progs: receive: support v2 send stream DATA tlv format
  btrfs-progs: receive: process encoded_write commands
  btrfs-progs: receive: encoded_write fallback to explicit decode and
    write
  btrfs-progs: receive: process fallocate commands
  btrfs-progs: receive: process setflags ioctl commands
  btrfs-progs: receive: add tests for basic encoded_write send/receive

Omar Sandoval (2):
  btrfs-progs: receive: add send stream v2 cmds and attrs to send.h
  btrfs-progs: send: stream v2 ioctl flags

 Documentation/btrfs-receive.rst               |   5 +
 Documentation/btrfs-send.rst                  |  22 ++
 cmds/receive-dump.c                           |  31 +-
 cmds/receive.c                                | 347 +++++++++++++++++-
 cmds/send.c                                   | 100 ++++-
 common/send-stream.c                          | 165 +++++++--
 common/send-stream.h                          |   7 +
 ioctl.h                                       | 151 +++++++-
 kernel-shared/send.h                          | 146 +++++---
 libbtrfs/send-stream.c                        |   2 +-
 .../052-receive-write-encoded/test.sh         | 114 ++++++
 11 files changed, 993 insertions(+), 97 deletions(-)
 create mode 100755 tests/misc-tests/052-receive-write-encoded/test.sh

-- 
2.35.1


             reply	other threads:[~2022-02-10 19:10 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10 19:09 Omar Sandoval [this message]
2022-02-10 19:09 ` [PATCH v13 01/17] fs: export rw_verify_area() Omar Sandoval
2022-02-10 19:09 ` [PATCH v13 02/17] fs: export variant of generic_write_checks without iov_iter Omar Sandoval
2022-02-10 19:09 ` [PATCH v13 03/17] btrfs: don't advance offset for compressed bios in btrfs_csum_one_bio() Omar Sandoval
2022-02-10 19:09 ` [PATCH v13 04/17] btrfs: add ram_bytes and offset to btrfs_ordered_extent Omar Sandoval
2022-02-11 17:12   ` David Sterba
2022-02-10 19:09 ` [PATCH v13 05/17] btrfs: support different disk extent size for delalloc Omar Sandoval
2022-02-10 19:09 ` [PATCH v13 06/17] btrfs: clean up cow_file_range_inline() Omar Sandoval
2022-02-10 19:09 ` [PATCH v13 07/17] btrfs: optionally extend i_size in cow_file_range_inline() Omar Sandoval
2022-02-10 19:09 ` [PATCH v13 08/17] btrfs: add definitions + documentation for encoded I/O ioctls Omar Sandoval
2022-02-11 18:17   ` David Sterba
2022-02-14 19:19     ` Omar Sandoval
2022-02-18 15:18       ` David Sterba
2022-02-10 19:09 ` [PATCH v13 09/17] btrfs: add BTRFS_IOC_ENCODED_READ Omar Sandoval
2022-02-10 19:10 ` [PATCH v13 10/17] btrfs: add BTRFS_IOC_ENCODED_WRITE Omar Sandoval
2022-02-10 19:10 ` [PATCH v13 11/17] btrfs: send: remove unused send_ctx::{total,cmd}_send_size Omar Sandoval
2022-02-10 19:10 ` [PATCH v13 12/17] btrfs: send: explicitly number commands and attributes Omar Sandoval
2022-02-10 19:10 ` [PATCH v13 13/17] btrfs: add send stream v2 definitions Omar Sandoval
2022-02-10 19:10 ` [PATCH v13 14/17] btrfs: send: write larger chunks when using stream v2 Omar Sandoval
2022-02-10 19:10 ` [PATCH v13 15/17] btrfs: send: allocate send buffer with alloc_page() and vmap() for v2 Omar Sandoval
2022-02-10 19:10 ` [PATCH v13 16/17] btrfs: send: send compressed extents with encoded writes Omar Sandoval
2022-02-10 19:10 ` [PATCH v13 17/17] btrfs: send: enable support for stream v2 and compressed writes Omar Sandoval
2022-02-10 19:10 ` [PATCH v13 01/10] btrfs-progs: receive: support v2 send stream larger tlv_len Omar Sandoval
2022-02-10 19:10 ` [PATCH v13 02/10] btrfs-progs: receive: dynamically allocate sctx->read_buf Omar Sandoval
2022-02-10 19:10 ` [PATCH v13 03/10] btrfs-progs: receive: support v2 send stream DATA tlv format Omar Sandoval
2022-02-10 19:10 ` [PATCH v13 04/10] btrfs-progs: receive: add send stream v2 cmds and attrs to send.h Omar Sandoval
2022-02-10 19:10 ` [PATCH v13 05/10] btrfs-progs: receive: process encoded_write commands Omar Sandoval
2022-02-10 19:10 ` [PATCH v13 06/10] btrfs-progs: receive: encoded_write fallback to explicit decode and write Omar Sandoval
2022-02-10 19:10 ` [PATCH v13 07/10] btrfs-progs: receive: process fallocate commands Omar Sandoval
2022-02-10 19:10 ` [PATCH v13 08/10] btrfs-progs: receive: process setflags ioctl commands Omar Sandoval
2022-02-10 19:10 ` [PATCH v13 09/10] btrfs-progs: send: stream v2 ioctl flags Omar Sandoval
2022-02-10 19:15   ` Omar Sandoval
2022-02-10 19:10 ` [PATCH v13 10/10] btrfs-progs: receive: add tests for basic encoded_write send/receive Omar Sandoval
2022-02-18 15:41 ` [PATCH v13 00/17] btrfs: add ioctls and send/receive support for reading/writing compressed data David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1644519257.git.osandov@fb.com \
    --to=osandov@osandov.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.