[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20201206065040.GA6385@ubuntu>
Date: Sun, 6 Dec 2020 15:50:40 +0900
From: Levi Yun <ppbuk5246@...il.com>
To: akpm@...ux-foundation.org, yury.norov@...il.com,
andriy.shevchenko@...ux.intel.com,
richard.weiyang@...ux.alibaba.com, christian.brauner@...ntu.com,
arnd@...db.de, jpoimboe@...hat.com, changbin.du@...el.com,
rdunlap@...radead.org, masahiroy@...nel.org,
gregkh@...uxfoundation.org, peterz@...radead.org,
peter.enderborg@...y.com, krzk@...nel.org,
brendanhiggins@...gle.com, keescook@...omium.org,
broonie@...nel.org, matti.vaittinen@...rohmeurope.com,
mhiramat@...nel.org, jpa@....mail.kapsi.fi, nivedita@...m.mit.edu,
glider@...gle.com, orson.zhai@...soc.com,
takahiro.akashi@...aro.org, clm@...com, josef@...icpanda.com,
dsterba@...e.com, dushistov@...l.ru
Cc: linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
linux-btrfs@...r.kernel.org
Subject: [PATCH v2 8/8] ufs/util.h: Apply new find_last_zero_bit.
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@...il.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
Powered by blists - more mailing lists