From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH 3/4] btrfs: Remove old send implementation
Date: Wed, 19 Jun 2019 17:04:39 +0300 [thread overview]
Message-ID: <20190619140440.5550-4-nborisov@suse.com> (raw)
In-Reply-To: <20190619140440.5550-1-nborisov@suse.com>
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(-)
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;
--
2.17.1
next prev parent reply other threads:[~2019-06-19 14:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-19 14:04 [PATCH 0/4] Spring cleaning Nikolay Borisov
2019-06-19 14:04 ` [PATCH 1/4] btrfs-progs: Remove redundant if Nikolay Borisov
2019-06-19 14:04 ` [PATCH 2/4] btrfs-progs: Remove commented code Nikolay Borisov
2019-06-19 22:28 ` David Sterba
2019-06-19 14:04 ` Nikolay Borisov [this message]
2019-06-19 22:30 ` [PATCH 3/4] btrfs: Remove old send implementation David Sterba
2019-06-19 14:04 ` [PATCH 4/4] btrfs-progs: check: Remove duplicated and commented functions Nikolay Borisov
2019-06-19 22:35 ` [PATCH 0/4] Spring cleaning 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=20190619140440.5550-4-nborisov@suse.com \
--to=nborisov@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox