linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Stephen C. Tweedie" <sct@redhat.com>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Rik van Riel <riel@nl.linux.org>, Ingo Molnar <mingo@redhat.com>,
	Stephen Tweedie <sct@redhat.com>,
	linux-mm@kvack.org
Subject: PATCH [2.4.0test10]: Kiobuf#01, expand IO return codes from iobufs
Date: Thu, 2 Nov 2000 12:34:00 +0000	[thread overview]
Message-ID: <20001102123400.A1876@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 334 bytes --]

Hi,

Kiobuf diff 01: allow for both the errno and the number of bytes
transferred to be returned in a kiobuf after IO.  We need both in
order to know how many pages have been dirtied after a failed IO.

Also includes a fix to the brw_kiovec code to make sure that EIO is
returned if no bytes were transferred successfully.

--Stephen

[-- Attachment #2: 01-retval.diff --]
[-- Type: text/plain, Size: 1791 bytes --]

diff -ru linux-2.4.0-test10.kio.00/drivers/char/raw.c linux-2.4.0-test10.kio.01/drivers/char/raw.c
--- linux-2.4.0-test10.kio.00/drivers/char/raw.c	Wed Nov  1 22:25:30 2000
+++ linux-2.4.0-test10.kio.01/drivers/char/raw.c	Thu Nov  2 12:00:35 2000
@@ -321,10 +321,10 @@
 		
 		err = brw_kiovec(rw, 1, &iobuf, dev, b, sector_size);
 
+		transferred += iobuf->retval;
 		if (err >= 0) {
-			transferred += err;
-			size -= err;
-			buf += err;
+			size -= iobuf->retval;
+			buf += iobuf->retval;
 		}
 
 		unmap_kiobuf(iobuf); /* The unlock_kiobuf is implicit here */
diff -ru linux-2.4.0-test10.kio.00/fs/buffer.c linux-2.4.0-test10.kio.01/fs/buffer.c
--- linux-2.4.0-test10.kio.00/fs/buffer.c	Wed Nov  1 22:25:34 2000
+++ linux-2.4.0-test10.kio.01/fs/buffer.c	Thu Nov  2 12:01:14 2000
@@ -1924,6 +1924,8 @@
 	
 	spin_unlock(&unused_list_lock);
 
+	if (!iosize)
+		return -EIO;
 	return iosize;
 }
 
@@ -2049,6 +2051,11 @@
 	}
 
  finished:
+
+	iobuf->retval = transferred;
+	if (err < 0)
+		iobuf->errno = err;
+	
 	if (transferred)
 		return transferred;
 	return err;
diff -ru linux-2.4.0-test10.kio.00/include/linux/iobuf.h linux-2.4.0-test10.kio.01/include/linux/iobuf.h
--- linux-2.4.0-test10.kio.00/include/linux/iobuf.h	Thu Nov  2 12:02:43 2000
+++ linux-2.4.0-test10.kio.01/include/linux/iobuf.h	Thu Nov  2 12:07:27 2000
@@ -52,7 +52,12 @@
 
 	/* Dynamic state for IO completion: */
 	atomic_t	io_count;	/* IOs still in progress */
-	int		errno;		/* Status of completed IO */
+
+	/* Equivalent to the return value and "errno" after a syscall: */
+	int		errno;		/* Error from completed IO (usual
+					   kernel negative values) */
+	int		retval;		/* Return value of completed IO */
+
 	void		(*end_io) (struct kiobuf *); /* Completion callback */
 	wait_queue_head_t wait_queue;
 };

             reply	other threads:[~2000-11-02 12:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-02 12:34 Stephen C. Tweedie [this message]
2000-11-02 13:42 ` Malcolm Beattie

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=20001102123400.A1876@redhat.com \
    --to=sct@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=mingo@redhat.com \
    --cc=riel@nl.linux.org \
    --cc=torvalds@transmeta.com \
    /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