From 641aae50ed844488a59630222583d7fea3b6a649 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sat, 3 Dec 2016 19:23:40 -0800 Subject: [PATCH] Fix ring block replay The ring block replay walk messed up the blkno it read from and its exit condition. It needed to test for having just replayed the tail before moving on. Signed-off-by: Zach Brown --- kmod/src/ring.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kmod/src/ring.c b/kmod/src/ring.c index 865071aa..04729eaa 100644 --- a/kmod/src/ring.c +++ b/kmod/src/ring.c @@ -227,7 +227,7 @@ int scoutfs_ring_read(struct super_block *sb) tail = le64_to_cpu(super->ring_tail_index); seq = le64_to_cpu(super->ring_head_seq); - do { + for(;;) { blkno = le64_to_cpu(super->ring_blkno) + index; if (index <= tail) @@ -236,7 +236,7 @@ int scoutfs_ring_read(struct super_block *sb) nr = le64_to_cpu(super->ring_blocks) - index; nr = min_t(int, nr, NR_BLOCKS); - ret = scoutfs_bio_read(sb, pages, index, nr); + ret = scoutfs_bio_read(sb, pages, blkno, nr); if (ret) goto out; @@ -249,10 +249,13 @@ int scoutfs_ring_read(struct super_block *sb) goto out; } + if (index == tail) + break; + index += nr; if (index == le64_to_cpu(super->ring_blocks)) index = 0; - } while (index != tail); + } out: for (i = 0; i < NR_PAGES && pages && pages[i]; i++)