1 #include <linux/kernel.h>
10 unsigned long sum = 0;
15 sum += nbits - bitmap_weight(sbi->
s_imap[i], nbits);
25 static int count_run(
unsigned long **
addr,
int nbits,
26 int addrlen,
int bit,
int max)
31 for (; addrlen > 0; addrlen--, addr++) {
35 if (x < nbits || count > max)
36 return min(count, max);
40 return min(count, max);
48 int nbits,
int bit,
int count,
int set)
52 struct buffer_head *bh;
56 bh = sb_bread(sb, clus_to_blk(sbi, sbi->
s_bitmap_ino) + map);
60 for (i = 0; i <
count; i++, bit++) {
74 set_bit(bit, (
unsigned long *)bh->b_data);
77 clear_bit(bit, (
unsigned long *)bh->b_data);
92 struct buffer_head *bh;
100 bit =
do_div(tmp, bits_per_entry);
108 bh = sb_bread(sb, clus_to_blk(sbi, sbi->
s_bitmap_ino) + map);
112 set_bit(bit, (
unsigned long *)bh->b_data);
143 while (bit < bits_per_entry) {
147 if (bit == bits_per_entry)
150 run = count_run(&sbi->
s_imap[i], bits_per_entry,
153 if (run >= min_request)
162 *return_block = i * bits_per_entry +
bit;
164 ret = set_run(sb, i, bits_per_entry, bit, run, 1);
183 bit =
do_div(tmp, bits_per_entry);
190 ret = set_run(sb, map, bits_per_entry, bit, count, 0);