Message ID | 20161110150147.19766-1-rgoldwyn@suse.de (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On Thu, Nov 10, 2016 at 09:01:46AM -0600, Goldwyn Rodrigues wrote: > The find_most_right_entry() tends to miss on the best entry if it > is the first one on the list and there are only two entries in the list. > So, we assign both prev and best to entry. > > To do this, the selection process (rather the rejection) has to be > performed earlier to skip on broken==count. > > Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Applied, and I've put part of the changelog as comment to the code. Minor nit, please don't forget to add the prefix to the subject. I fix that, no problem, but the patches could be delayed if it's not clear that's for progs. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/cmds-check.c b/cmds-check.c index 368c1c5..779870a 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -8184,11 +8184,6 @@ static struct extent_entry *find_most_right_entry(struct list_head *entries) struct extent_entry *entry, *best = NULL, *prev = NULL; list_for_each_entry(entry, entries, list) { - if (!prev) { - prev = entry; - continue; - } - /* * If there are as many broken entries as entries then we know * not to trust this particular entry. @@ -8196,6 +8191,12 @@ static struct extent_entry *find_most_right_entry(struct list_head *entries) if (entry->broken == entry->count) continue; + if (!prev) { + best = entry; + prev = entry; + continue; + } + /* * If our current entry == best then we can't be sure our best * is really the best, so we need to keep searching.
The find_most_right_entry() tends to miss on the best entry if it is the first one on the list and there are only two entries in the list. So, we assign both prev and best to entry. To do this, the selection process (rather the rejection) has to be performed earlier to skip on broken==count. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> --- cmds-check.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)