linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 8/8] ufs/util.h: Apply new find_last_zero_bit.
@ 2020-12-06  6:50 Levi Yun
  0 siblings, 0 replies; only message in thread
From: Levi Yun @ 2020-12-06  6:50 UTC (permalink / raw)
  To: akpm, yury.norov, andriy.shevchenko, richard.weiyang,
	christian.brauner, arnd, jpoimboe, changbin.du, rdunlap,
	masahiroy, gregkh, peterz, peter.enderborg, krzk, brendanhiggins,
	keescook, broonie, matti.vaittinen, mhiramat, jpa, nivedita,
	glider, orson.zhai, takahiro.akashi, clm, josef, dsterba,
	dushistov
  Cc: linux-kernel, linux-arch, linux-btrfs

Former find_last_zero_bit in ufs makes complie error when we add
find_last_zero_bit in lib/find_bit.c
We remove former find_last_zero_bit in ufs which iterates per char,
And apply new find_last_zero_bit in lib.

Signed-off-by: Levi Yun <ppbuk5246@gmail.com>
---
 fs/ufs/util.h | 30 +++---------------------------
 1 file changed, 3 insertions(+), 27 deletions(-)

diff --git a/fs/ufs/util.h b/fs/ufs/util.h
index 4931bec1a01c..3024f2076feb 100644
--- a/fs/ufs/util.h
+++ b/fs/ufs/util.h
@@ -413,29 +413,6 @@ static inline unsigned _ubh_find_next_zero_bit_(
 	return (base << uspi->s_bpfshift) + pos - begin;
 } 	
 
-static inline unsigned find_last_zero_bit (unsigned char * bitmap,
-	unsigned size, unsigned offset)
-{
-	unsigned bit, i;
-	unsigned char * mapp;
-	unsigned char map;
-
-	mapp = bitmap + (size >> 3);
-	map = *mapp--;
-	bit = 1 << (size & 7);
-	for (i = size; i > offset; i--) {
-		if ((map & bit) == 0)
-			break;
-		if ((i & 7) != 0) {
-			bit >>= 1;
-		} else {
-			map = *mapp--;
-			bit = 1 << 7;
-		}
-	}
-	return i;
-}
-
 #define ubh_find_last_zero_bit(ubh,begin,size,offset) _ubh_find_last_zero_bit_(uspi,ubh,begin,size,offset)
 static inline unsigned _ubh_find_last_zero_bit_(
 	struct ufs_sb_private_info * uspi, struct ufs_buffer_head * ubh,
@@ -453,15 +430,14 @@ static inline unsigned _ubh_find_last_zero_bit_(
 			    size + (uspi->s_bpf - start), uspi->s_bpf)
 			- (uspi->s_bpf - start);
 		size -= count;
-		pos = find_last_zero_bit (ubh->bh[base]->b_data,
-			start, start - count);
-		if (pos > start - count || !size)
+		pos = find_last_zero_bit_le(ubh->bh[base]->b_data, start + 1);
+		if ((pos < start + 1 && pos > start - count) || !size)
 			break;
 		base--;
 		start = uspi->s_bpf;
 	}
 	return (base << uspi->s_bpfshift) + pos - begin;
-} 	
+}
 
 #define ubh_isblockclear(ubh,begin,block) (!_ubh_isblockset_(uspi,ubh,begin,block))
 
-- 
2.27.0

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

only message in thread, other threads:[~2020-12-06  6:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-06  6:50 [PATCH v2 8/8] ufs/util.h: Apply new find_last_zero_bit Levi Yun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).