|
@@ -17,23 +17,6 @@
|
|
#include <linux/bitops.h>
|
|
#include <linux/bitops.h>
|
|
#include "qnx4.h"
|
|
#include "qnx4.h"
|
|
|
|
|
|
-static void count_bits(register const char *bmPart, register int size,
|
|
|
|
- int *const tf)
|
|
|
|
-{
|
|
|
|
- char b;
|
|
|
|
- int tot = *tf;
|
|
|
|
-
|
|
|
|
- if (size > QNX4_BLOCK_SIZE) {
|
|
|
|
- size = QNX4_BLOCK_SIZE;
|
|
|
|
- }
|
|
|
|
- do {
|
|
|
|
- b = *bmPart++;
|
|
|
|
- tot += 8 - hweight8(b);
|
|
|
|
- size--;
|
|
|
|
- } while (size != 0);
|
|
|
|
- *tf = tot;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
unsigned long qnx4_count_free_blocks(struct super_block *sb)
|
|
unsigned long qnx4_count_free_blocks(struct super_block *sb)
|
|
{
|
|
{
|
|
int start = le32_to_cpu(qnx4_sb(sb)->BitMap->di_first_xtnt.xtnt_blk) - 1;
|
|
int start = le32_to_cpu(qnx4_sb(sb)->BitMap->di_first_xtnt.xtnt_blk) - 1;
|
|
@@ -44,13 +27,16 @@ unsigned long qnx4_count_free_blocks(struct super_block *sb)
|
|
struct buffer_head *bh;
|
|
struct buffer_head *bh;
|
|
|
|
|
|
while (total < size) {
|
|
while (total < size) {
|
|
|
|
+ int bytes = min(size - total, QNX4_BLOCK_SIZE);
|
|
|
|
+
|
|
if ((bh = sb_bread(sb, start + offset)) == NULL) {
|
|
if ((bh = sb_bread(sb, start + offset)) == NULL) {
|
|
printk(KERN_ERR "qnx4: I/O error in counting free blocks\n");
|
|
printk(KERN_ERR "qnx4: I/O error in counting free blocks\n");
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- count_bits(bh->b_data, size - total, &total_free);
|
|
|
|
|
|
+ total_free += bytes * BITS_PER_BYTE -
|
|
|
|
+ memweight(bh->b_data, bytes);
|
|
brelse(bh);
|
|
brelse(bh);
|
|
- total += QNX4_BLOCK_SIZE;
|
|
|
|
|
|
+ total += bytes;
|
|
offset++;
|
|
offset++;
|
|
}
|
|
}
|
|
|
|
|