public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 002 of 4] Only call bi_end_io once for any bio.
Date: Thu, 27 Sep 2007 17:20:13 +1000	[thread overview]
Message-ID: <1070927072013.4177@suse.de> (raw)
In-Reply-To: 20070927171111.3251.patches@notabene


Currently bi_end_io can be called multiple times as sub-requests
complete.  However no ->bi_end_io function wants to know about that.
So only call when the bio is complete.

Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./fs/bio.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff .prev/fs/bio.c ./fs/bio.c
--- .prev/fs/bio.c	2007-09-27 16:36:53.000000000 +1000
+++ ./fs/bio.c	2007-09-27 16:39:02.000000000 +1000
@@ -1018,6 +1018,8 @@ void bio_endio(struct bio *bio, unsigned
 {
 	if (error)
 		clear_bit(BIO_UPTODATE, &bio->bi_flags);
+	else if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
+		error = -EIO;
 
 	if (unlikely(bytes_done > bio->bi_size)) {
 		printk("%s: want %u bytes done, only %u left\n", __FUNCTION__,
@@ -1028,7 +1030,7 @@ void bio_endio(struct bio *bio, unsigned
 	bio->bi_size -= bytes_done;
 	bio->bi_sector += (bytes_done >> 9);
 
-	if (bio->bi_end_io)
+	if (bio->bi_size && bio->bi_end_io)
 		bio->bi_end_io(bio, bytes_done, error);
 }
 

  parent reply	other threads:[~2007-09-27  7:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-27  7:20 [PATCH 000 of 4] Change prototype for bi_end_io NeilBrown
2007-09-27  7:20 ` [PATCH 001 of 4] Remove flush_dry_bio_endio NeilBrown
2007-09-27  7:20 ` NeilBrown [this message]
2007-09-27  7:20 ` [PATCH 003 of 4] Don't decrement bi_size in bio_endio NeilBrown
2007-09-27  7:20 ` [PATCH 004 of 4] Drop 'size' argument from bio_endio and bi_end_io NeilBrown
2007-09-27 11:13 ` [PATCH 000 of 4] Change prototype for bi_end_io Jens Axboe

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=1070927072013.4177@suse.de \
    --to=neilb@suse.de \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@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