[3/4] btrfs: Remove old send implementation
diff mbox series

Message ID 20190619140440.5550-4-nborisov@suse.com
State New
Headers show
Series
  • Spring cleaning
Related show

Commit Message

Nikolay Borisov June 19, 2019, 2:04 p.m. UTC
Commit ba23855cdc89 ("btrfs-progs: send: use splice syscall instead of
read/write to transfer buffer") changed the send implementation to use
splice(). The old read/write implementation hasn't be used for at least
3 years, it's time to remove it.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 cmds-send.c | 61 -----------------------------------------------------
 1 file changed, 61 deletions(-)

Comments

David Sterba June 19, 2019, 10:30 p.m. UTC | #1
On Wed, Jun 19, 2019 at 05:04:39PM +0300, Nikolay Borisov wrote:
> Commit ba23855cdc89 ("btrfs-progs: send: use splice syscall instead of
> read/write to transfer buffer") changed the send implementation to use
> splice(). The old read/write implementation hasn't be used for at least
> 3 years, it's time to remove it.

I left it there in case there are problems with splice so we could
potentially offer option for the copy mechanism, but time proved it's
not necessary.

Patch
diff mbox series

diff --git a/cmds-send.c b/cmds-send.c
index 6496d8e39bbf..1735c35dca74 100644
--- a/cmds-send.c
+++ b/cmds-send.c
@@ -207,67 +207,6 @@  static int add_clone_source(struct btrfs_send *sctx, u64 root_id)
 	return 0;
 }
 
-#if 0
-static int write_buf(int fd, const char *buf, size_t size)
-{
-	int ret;
-	size_t pos = 0;
-
-	while (pos < size) {
-		ssize_t wbytes;
-
-		wbytes = write(fd, buf + pos, size - pos);
-		if (wbytes < 0) {
-			ret = -errno;
-			error("failed to dump stream: %s", strerror(-ret));
-			goto out;
-		}
-		if (!wbytes) {
-			ret = -EIO;
-			error("failed to dump stream: %s", strerror(-ret));
-			goto out;
-		}
-		pos += wbytes;
-	}
-	ret = 0;
-
-out:
-	return ret;
-}
-
-static void* read_sent_data_copy(void *arg)
-{
-	int ret;
-	struct btrfs_send *sctx = (struct btrfs_send*)arg;
-	char buf[SEND_BUFFER_SIZE];
-
-	while (1) {
-		ssize_t rbytes;
-
-		rbytes = read(sctx->send_fd, buf, sizeof(buf));
-		if (rbytes < 0) {
-			ret = -errno;
-			error("failed to read stream from kernel: %s",
-				strerror(-ret));
-			goto out;
-		}
-		if (!rbytes) {
-			ret = 0;
-			goto out;
-		}
-		ret = write_buf(sctx->dump_fd, buf, rbytes);
-		if (ret < 0)
-			goto out;
-	}
-
-out:
-	if (ret < 0)
-		exit(-ret);
-
-	return ERR_PTR(ret);
-}
-#endif
-
 static void *read_sent_data(void *arg)
 {
 	int ret;