From 33a908a5cd18071e0b44b9e4110a468177f73fc4 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 7 Feb 2017 15:10:26 -0700 Subject: [PATCH] bloom: if we're not setting bits, break after first failed mask check Signed-off-by: Jens Axboe --- lib/bloom.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/bloom.c b/lib/bloom.c index 7a9ebaa9..bb81dbbd 100644 --- a/lib/bloom.c +++ b/lib/bloom.c @@ -104,8 +104,10 @@ static bool __bloom_check(struct bloom *b, const void *data, unsigned int len, if (b->map[index] & (1U << bit)) was_set++; - if (set) + else if (set) b->map[index] |= 1U << bit; + else + break; } return was_set == N_HASHES; -- 2.25.1