From 22ed296834c9d788d3d44b4c88f4d3b2c435faef Mon Sep 17 00:00:00 2001 From: Marcin Slusarz Date: Sat, 2 Feb 2008 22:37:07 +0100 Subject: [PATCH] --- yaml --- r: 91819 b: refs/heads/master c: 01b954a36a03d90a66c9dd1fc13e4cb51269caf7 h: refs/heads/master i: 91817: 53a827e3ea6289816072bb2ede174904c6753190 91815: c547838f59eab6e35aa011f20bffddb12e45bca7 v: v3 --- [refs] | 2 +- trunk/fs/udf/super.c | 17 +++++------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/[refs] b/[refs] index 49530f819ebc..f5a205a391a2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d652eefb70142c64495f4188883f9dfc0430a96b +refs/heads/master: 01b954a36a03d90a66c9dd1fc13e4cb51269caf7 diff --git a/trunk/fs/udf/super.c b/trunk/fs/udf/super.c index 2666e5bc69ff..be0aa424b8f1 100644 --- a/trunk/fs/udf/super.c +++ b/trunk/fs/udf/super.c @@ -55,6 +55,7 @@ #include #include #include +#include #include #include "udf_sb.h" @@ -1958,10 +1959,6 @@ static int udf_statfs(struct dentry *dentry, struct kstatfs *buf) return 0; } -static unsigned char udf_bitmap_lookup[16] = { - 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 -}; - static unsigned int udf_count_free_bitmap(struct super_block *sb, struct udf_bitmap *bitmap) { @@ -1971,7 +1968,6 @@ static unsigned int udf_count_free_bitmap(struct super_block *sb, int block = 0, newblock; kernel_lb_addr loc; uint32_t bytes; - uint8_t value; uint8_t *ptr; uint16_t ident; struct spaceBitmapDesc *bm; @@ -1997,13 +1993,10 @@ static unsigned int udf_count_free_bitmap(struct super_block *sb, ptr = (uint8_t *)bh->b_data; while (bytes > 0) { - while ((bytes > 0) && (index < sb->s_blocksize)) { - value = ptr[index]; - accum += udf_bitmap_lookup[value & 0x0f]; - accum += udf_bitmap_lookup[value >> 4]; - index++; - bytes--; - } + u32 cur_bytes = min_t(u32, bytes, sb->s_blocksize - index); + accum += bitmap_weight((const unsigned long *)(ptr + index), + cur_bytes * 8); + bytes -= cur_bytes; if (bytes) { brelse(bh); newblock = udf_get_lb_pblock(sb, loc, ++block);