All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yifan Zhao <stopire@gmail.com>
To: linux-erofs@lists.ozlabs.org
Cc: xiang@kernel.org
Subject: [PATCH v2 1/4] erofs-utils: lib: fix short write retries
Date: Mon, 21 Sep 2026 21:35:32 +0800	[thread overview]
Message-ID: <20260921133535.2381246-1-stopire@gmail.com> (raw)

Retry with only the remaining byte count in both the pwrite() and
pwrite64() paths.

Assisted-by: Codex:gpt-6-astra
Signed-off-by: Yifan Zhao <stopire@gmail.com>
---
 lib/io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/io.c b/lib/io.c
index 5c5449f..f62129f 100644
--- a/lib/io.c
+++ b/lib/io.c
@@ -75,9 +75,9 @@ ssize_t erofs_io_pwrite(struct erofs_vfile *vf, const void *buf,
 	pos += vf->offset;
 	do {
 #ifdef HAVE_PWRITE64
-		ret = pwrite64(vf->fd, buf, len, (off64_t)pos);
+		ret = pwrite64(vf->fd, buf, len - written, (off64_t)pos);
 #else
-		ret = pwrite(vf->fd, buf, len, (off_t)pos);
+		ret = pwrite(vf->fd, buf, len - written, (off_t)pos);
 #endif
 		if (ret <= 0) {
 			if (!ret)
-- 
2.55.0



             reply	other threads:[~2026-09-21 13:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 13:35 Yifan Zhao [this message]
2026-09-21 13:35 ` [PATCH v2 2/4] erofs-utils: lib: fix large chunk index writes Yifan Zhao
2026-09-21 13:35 ` [PATCH v2 3/4] erofs-utils: mkfs: add file-delta framework Yifan Zhao
2026-09-21 13:35 ` [PATCH v2 4/4] erofs-utils: mkfs: support dm-persistent file deltas Yifan Zhao

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=20260921133535.2381246-1-stopire@gmail.com \
    --to=stopire@gmail.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=xiang@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.