public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] blkdev: fix merge_bvec_fn return value checks
@ 2010-02-27 17:35 Dmitry Monakhov
  2010-02-27 17:35 ` [PATCH 2/2] blktrace: perform cleanup after setup error Dmitry Monakhov
  2010-02-28 18:46 ` [PATCH 1/2] blkdev: fix merge_bvec_fn return value checks Jens Axboe
  0 siblings, 2 replies; 23+ messages in thread
From: Dmitry Monakhov @ 2010-02-27 17:35 UTC (permalink / raw)
  To: linux-kernel; +Cc: jens.axboe, Dmitry Monakhov

merge_bvec_fn() returns bvec->bv_len on success. So we have to check
against this value. But in case of fs_optimization merge we compare
with wrong value. This patch must be included in
 b428cd6da7e6559aca69aa2e3a526037d3f20403
But accidentally i've forgot to add this in the initial patch.
To make things straight let's replace all such checks.
In fact this makes code easy to understand.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 fs/bio.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/bio.c b/fs/bio.c
index 88094af..c28e5fb 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -557,7 +557,7 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page
 					.bi_rw = bio->bi_rw,
 				};
 
-				if (q->merge_bvec_fn(q, &bvm, prev) < len) {
+				if (q->merge_bvec_fn(q, &bvm, prev) != prev->bv_len) {
 					prev->bv_len -= len;
 					return 0;
 				}
@@ -611,7 +611,7 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page
 		 * merge_bvec_fn() returns number of bytes it can accept
 		 * at this offset
 		 */
-		if (q->merge_bvec_fn(q, &bvm, bvec) < len) {
+		if (q->merge_bvec_fn(q, &bvm, bvec) != bvec->bv_len) {
 			bvec->bv_page = NULL;
 			bvec->bv_len = 0;
 			bvec->bv_offset = 0;
-- 
1.6.6


^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2010-03-08  9:01 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-27 17:35 [PATCH 1/2] blkdev: fix merge_bvec_fn return value checks Dmitry Monakhov
2010-02-27 17:35 ` [PATCH 2/2] blktrace: perform cleanup after setup error Dmitry Monakhov
2010-02-28 18:46   ` Jens Axboe
2010-02-28 18:46 ` [PATCH 1/2] blkdev: fix merge_bvec_fn return value checks Jens Axboe
2010-03-03  3:49   ` Dmitry Monakhov
2010-03-03  7:30     ` Jens Axboe
2010-03-03  8:39       ` Dmitry Monakhov
2010-03-03 12:21         ` Jens Axboe
2010-03-03 18:20     ` Mike Snitzer
2010-03-03 18:45       ` Dmitry Monakhov
2010-03-03 19:16         ` Mike Snitzer
2010-03-03 19:42           ` Dmitry Monakhov
2010-03-03 20:07             ` Jens Axboe
2010-03-04 11:47               ` [dm-devel] " Mikulas Patocka
2010-03-04 12:19                 ` Jens Axboe
2010-03-04 21:55                   ` Mikulas Patocka
2010-03-05  7:30                     ` Jens Axboe
2010-03-05 21:56                       ` Neil Brown
2010-03-05 22:27                         ` Alasdair G Kergon
2010-03-05 23:52                           ` Neil Brown
2010-03-06  2:20                             ` Alasdair G Kergon
2010-03-08  9:01                       ` Mikulas Patocka
2010-03-04 17:59               ` Lars Ellenberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox