[dm-devel] [PATCH 3/11] bottom-layer barrier support

Mikulas Patocka mpatocka at redhat.com
Fri Apr 10 05:11:27 UTC 2009


Change md->barrier_error so that it can accumulate more errors
(the first one is reported).

With the following patches, more errors could happen.
Return the first error to the caller.

Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>

---
 drivers/md/dm.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Index: linux-2.6.30-rc1-devel/drivers/md/dm.c
===================================================================
--- linux-2.6.30-rc1-devel.orig/drivers/md/dm.c	2009-04-10 06:33:20.000000000 +0200
+++ linux-2.6.30-rc1-devel/drivers/md/dm.c	2009-04-10 06:33:23.000000000 +0200
@@ -565,7 +565,8 @@ static void dec_pending(struct dm_io *io
 			 * per-device variable for error reporting is OK.
 			 * Note that you can't touch the bio after end_io_acct
 			 */
-			md->barrier_error = io_error;
+			if (!md->barrier_error)
+				md->barrier_error = io_error;
 			end_io_acct(io);
 		} else {
 			end_io_acct(io);
@@ -864,7 +865,8 @@ static void __split_and_process_bio(stru
 		if (!bio_barrier(bio))
 			bio_io_error(bio);
 		else
-			md->barrier_error = -EIO;
+			if (!md->barrier_error)
+				md->barrier_error = -EIO;
 		return;
 	}
 
@@ -1459,16 +1461,15 @@ static void dm_wq_work(struct work_struc
 		if (!bio_barrier(c))
 			__split_and_process_bio(md, c);
 		else {
+			md->barrier_error = 0;
+
 			dm_flush(md);
 
-			if (bio_empty_barrier(c)) {
-				bio_endio(c, 0);
-				goto next_bio;
+			if (!bio_empty_barrier(c)) {
+				__split_and_process_bio(md, c);
+				dm_flush(md);
 			}
 
-			__split_and_process_bio(md, c);
-			dm_flush(md);
-
 			if (md->barrier_error != DM_ENDIO_REQUEUE)
 				bio_endio(c, md->barrier_error);
 			else {
@@ -1478,7 +1479,6 @@ static void dm_wq_work(struct work_struc
 			}
 		}
 
-next_bio:
 		down_write(&md->io_lock);
 	}
 




More information about the dm-devel mailing list