All of lore.kernel.org
 help / color / mirror / Atom feed
* master - [bcache] get all unit tests passing again
@ 2018-04-26 12:15 Joe Thornber
  0 siblings, 0 replies; only message in thread
From: Joe Thornber @ 2018-04-26 12:15 UTC (permalink / raw)
  To: lvm-devel

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1c97fda42576367e263f8c928c060271787ad1c1
Commit:        1c97fda42576367e263f8c928c060271787ad1c1
Parent:        ea34dad66fe4a46a2f7ec51c4358144f6cb3ed67
Author:        Joe Thornber <ejt@redhat.com>
AuthorDate:    Thu Apr 26 13:13:27 2018 +0100
Committer:     Joe Thornber <ejt@redhat.com>
CommitterDate: Thu Apr 26 13:13:27 2018 +0100

[bcache] get all unit tests passing again

---
 lib/device/bcache.c |   33 +++++++++++++--------------------
 1 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/lib/device/bcache.c b/lib/device/bcache.c
index ea8f702..641838f 100644
--- a/lib/device/bcache.c
+++ b/lib/device/bcache.c
@@ -537,29 +537,16 @@ static void _complete_io(void *context, int err)
 	 */
 	dm_list_del(&b->list);
 
-	if (b->error)
-		memset(b->data, 0, cache->block_sectors << SECTOR_SHIFT);
-
 	/* Things don't work with this block of code, but work without it. */
-#if 0
 	if (b->error) {
 		log_warn("bcache io error %d fd %d", b->error, b->fd);
-		if (b->io_dir == DIR_READ) {
-			// We can just forget about this block, since there's
-			// no dirty data to be written back.
-			_hash_remove(b);
-			dm_list_add(&cache->free, &b->list);
 
-		} else
-			dm_list_add(&cache->errored, &b->list);
+		dm_list_add(&cache->errored, &b->list);
 
 	} else {
 		_clear_flags(b, BF_DIRTY);
 		_link_block(b);
 	}
-#endif
-	_clear_flags(b, BF_DIRTY);
-	_link_block(b);
 }
 
 /*
@@ -908,17 +895,23 @@ bool bcache_get(struct bcache *cache, int fd, block_address index,
 
 	b = _lookup_or_read_block(cache, fd, index, flags);
 	if (b) {
+		if (b->error) {
+			if (b->io_dir == DIR_READ) {
+				// Now we know the read failed we can just forget
+				// about this block, since there's no dirty data to
+				// be written back.
+				_hash_remove(b);
+				dm_list_add(&cache->free, &b->list);
+			}
+			*error = b->error;
+			return false;
+		}
+
 		if (!b->ref_count)
 			cache->nr_locked++;
 		b->ref_count++;
 
 		*result = b;
-
-		if (error)
-			*error = b->error;
-
-		if (b->error)
-			return false;
 		return true;
 	}
 



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-26 12:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-26 12:15 master - [bcache] get all unit tests passing again Joe Thornber

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.