Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 188105
b: refs/heads/master
c: c4af964
h: refs/heads/master
i:
  188103: 3cf98d1
v: v3
  • Loading branch information
Akinobu Mita authored and Linus Torvalds committed Mar 18, 2010
1 parent 12ad27e commit 71d1dc2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bcc54e2a6d8e93ff83ec398511930b0a73e19151
refs/heads/master: c4af96449e20f9245cf3d904098db508cdebcda8
25 changes: 13 additions & 12 deletions trunk/fs/ntfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <linux/vfs.h>
#include <linux/moduleparam.h>
#include <linux/smp_lock.h>
#include <linux/bitmap.h>

#include "sysctl.h"
#include "logfile.h"
Expand Down Expand Up @@ -2458,7 +2459,6 @@ static void ntfs_put_super(struct super_block *sb)
static s64 get_nr_free_clusters(ntfs_volume *vol)
{
s64 nr_free = vol->nr_clusters;
u32 *kaddr;
struct address_space *mapping = vol->lcnbmp_ino->i_mapping;
struct page *page;
pgoff_t index, max_index;
Expand All @@ -2477,7 +2477,8 @@ static s64 get_nr_free_clusters(ntfs_volume *vol)
ntfs_debug("Reading $Bitmap, max_index = 0x%lx, max_size = 0x%lx.",
max_index, PAGE_CACHE_SIZE / 4);
for (index = 0; index < max_index; index++) {
unsigned int i;
unsigned long *kaddr;

/*
* Read the page from page cache, getting it from backing store
* if necessary, and increment the use count.
Expand All @@ -2490,16 +2491,16 @@ static s64 get_nr_free_clusters(ntfs_volume *vol)
nr_free -= PAGE_CACHE_SIZE * 8;
continue;
}
kaddr = (u32*)kmap_atomic(page, KM_USER0);
kaddr = kmap_atomic(page, KM_USER0);
/*
* For each 4 bytes, subtract the number of set bits. If this
* Subtract the number of set bits. If this
* is the last page and it is partial we don't really care as
* it just means we do a little extra work but it won't affect
* the result as all out of range bytes are set to zero by
* ntfs_readpage().
*/
for (i = 0; i < PAGE_CACHE_SIZE / 4; i++)
nr_free -= (s64)hweight32(kaddr[i]);
nr_free -= bitmap_weight(kaddr,
PAGE_CACHE_SIZE * BITS_PER_BYTE);
kunmap_atomic(kaddr, KM_USER0);
page_cache_release(page);
}
Expand Down Expand Up @@ -2538,7 +2539,6 @@ static s64 get_nr_free_clusters(ntfs_volume *vol)
static unsigned long __get_nr_free_mft_records(ntfs_volume *vol,
s64 nr_free, const pgoff_t max_index)
{
u32 *kaddr;
struct address_space *mapping = vol->mftbmp_ino->i_mapping;
struct page *page;
pgoff_t index;
Expand All @@ -2548,7 +2548,8 @@ static unsigned long __get_nr_free_mft_records(ntfs_volume *vol,
ntfs_debug("Reading $MFT/$BITMAP, max_index = 0x%lx, max_size = "
"0x%lx.", max_index, PAGE_CACHE_SIZE / 4);
for (index = 0; index < max_index; index++) {
unsigned int i;
unsigned long *kaddr;

/*
* Read the page from page cache, getting it from backing store
* if necessary, and increment the use count.
Expand All @@ -2561,16 +2562,16 @@ static unsigned long __get_nr_free_mft_records(ntfs_volume *vol,
nr_free -= PAGE_CACHE_SIZE * 8;
continue;
}
kaddr = (u32*)kmap_atomic(page, KM_USER0);
kaddr = kmap_atomic(page, KM_USER0);
/*
* For each 4 bytes, subtract the number of set bits. If this
* Subtract the number of set bits. If this
* is the last page and it is partial we don't really care as
* it just means we do a little extra work but it won't affect
* the result as all out of range bytes are set to zero by
* ntfs_readpage().
*/
for (i = 0; i < PAGE_CACHE_SIZE / 4; i++)
nr_free -= (s64)hweight32(kaddr[i]);
nr_free -= bitmap_weight(kaddr,
PAGE_CACHE_SIZE * BITS_PER_BYTE);
kunmap_atomic(kaddr, KM_USER0);
page_cache_release(page);
}
Expand Down

0 comments on commit 71d1dc2

Please sign in to comment.