diff options
Diffstat (limited to 'fs/ntfs/super.c')
| -rw-r--r-- | fs/ntfs/super.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 80b04770e8e9..0de1db6cddbf 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include <linux/vfs.h> | 31 | #include <linux/vfs.h> |
| 32 | #include <linux/moduleparam.h> | 32 | #include <linux/moduleparam.h> |
| 33 | #include <linux/smp_lock.h> | 33 | #include <linux/smp_lock.h> |
| 34 | #include <linux/bitmap.h> | ||
| 34 | 35 | ||
| 35 | #include "sysctl.h" | 36 | #include "sysctl.h" |
| 36 | #include "logfile.h" | 37 | #include "logfile.h" |
| @@ -39,6 +40,7 @@ | |||
| 39 | #include "dir.h" | 40 | #include "dir.h" |
| 40 | #include "debug.h" | 41 | #include "debug.h" |
| 41 | #include "index.h" | 42 | #include "index.h" |
| 43 | #include "inode.h" | ||
| 42 | #include "aops.h" | 44 | #include "aops.h" |
| 43 | #include "layout.h" | 45 | #include "layout.h" |
| 44 | #include "malloc.h" | 46 | #include "malloc.h" |
| @@ -2457,7 +2459,6 @@ static void ntfs_put_super(struct super_block *sb) | |||
| 2457 | static s64 get_nr_free_clusters(ntfs_volume *vol) | 2459 | static s64 get_nr_free_clusters(ntfs_volume *vol) |
| 2458 | { | 2460 | { |
| 2459 | s64 nr_free = vol->nr_clusters; | 2461 | s64 nr_free = vol->nr_clusters; |
| 2460 | u32 *kaddr; | ||
| 2461 | struct address_space *mapping = vol->lcnbmp_ino->i_mapping; | 2462 | struct address_space *mapping = vol->lcnbmp_ino->i_mapping; |
| 2462 | struct page *page; | 2463 | struct page *page; |
| 2463 | pgoff_t index, max_index; | 2464 | pgoff_t index, max_index; |
| @@ -2476,7 +2477,8 @@ static s64 get_nr_free_clusters(ntfs_volume *vol) | |||
| 2476 | ntfs_debug("Reading $Bitmap, max_index = 0x%lx, max_size = 0x%lx.", | 2477 | ntfs_debug("Reading $Bitmap, max_index = 0x%lx, max_size = 0x%lx.", |
| 2477 | max_index, PAGE_CACHE_SIZE / 4); | 2478 | max_index, PAGE_CACHE_SIZE / 4); |
| 2478 | for (index = 0; index < max_index; index++) { | 2479 | for (index = 0; index < max_index; index++) { |
| 2479 | unsigned int i; | 2480 | unsigned long *kaddr; |
| 2481 | |||
| 2480 | /* | 2482 | /* |
| 2481 | * Read the page from page cache, getting it from backing store | 2483 | * Read the page from page cache, getting it from backing store |
| 2482 | * if necessary, and increment the use count. | 2484 | * if necessary, and increment the use count. |
| @@ -2489,16 +2491,16 @@ static s64 get_nr_free_clusters(ntfs_volume *vol) | |||
| 2489 | nr_free -= PAGE_CACHE_SIZE * 8; | 2491 | nr_free -= PAGE_CACHE_SIZE * 8; |
| 2490 | continue; | 2492 | continue; |
| 2491 | } | 2493 | } |
| 2492 | kaddr = (u32*)kmap_atomic(page, KM_USER0); | 2494 | kaddr = kmap_atomic(page, KM_USER0); |
| 2493 | /* | 2495 | /* |
| 2494 | * For each 4 bytes, subtract the number of set bits. If this | 2496 | * Subtract the number of set bits. If this |
| 2495 | * is the last page and it is partial we don't really care as | 2497 | * is the last page and it is partial we don't really care as |
| 2496 | * it just means we do a little extra work but it won't affect | 2498 | * it just means we do a little extra work but it won't affect |
| 2497 | * the result as all out of range bytes are set to zero by | 2499 | * the result as all out of range bytes are set to zero by |
| 2498 | * ntfs_readpage(). | 2500 | * ntfs_readpage(). |
| 2499 | */ | 2501 | */ |
| 2500 | for (i = 0; i < PAGE_CACHE_SIZE / 4; i++) | 2502 | nr_free -= bitmap_weight(kaddr, |
| 2501 | nr_free -= (s64)hweight32(kaddr[i]); | 2503 | PAGE_CACHE_SIZE * BITS_PER_BYTE); |
| 2502 | kunmap_atomic(kaddr, KM_USER0); | 2504 | kunmap_atomic(kaddr, KM_USER0); |
| 2503 | page_cache_release(page); | 2505 | page_cache_release(page); |
| 2504 | } | 2506 | } |
| @@ -2537,7 +2539,6 @@ static s64 get_nr_free_clusters(ntfs_volume *vol) | |||
| 2537 | static unsigned long __get_nr_free_mft_records(ntfs_volume *vol, | 2539 | static unsigned long __get_nr_free_mft_records(ntfs_volume *vol, |
| 2538 | s64 nr_free, const pgoff_t max_index) | 2540 | s64 nr_free, const pgoff_t max_index) |
| 2539 | { | 2541 | { |
| 2540 | u32 *kaddr; | ||
| 2541 | struct address_space *mapping = vol->mftbmp_ino->i_mapping; | 2542 | struct address_space *mapping = vol->mftbmp_ino->i_mapping; |
| 2542 | struct page *page; | 2543 | struct page *page; |
| 2543 | pgoff_t index; | 2544 | pgoff_t index; |
| @@ -2547,7 +2548,8 @@ static unsigned long __get_nr_free_mft_records(ntfs_volume *vol, | |||
| 2547 | ntfs_debug("Reading $MFT/$BITMAP, max_index = 0x%lx, max_size = " | 2548 | ntfs_debug("Reading $MFT/$BITMAP, max_index = 0x%lx, max_size = " |
| 2548 | "0x%lx.", max_index, PAGE_CACHE_SIZE / 4); | 2549 | "0x%lx.", max_index, PAGE_CACHE_SIZE / 4); |
| 2549 | for (index = 0; index < max_index; index++) { | 2550 | for (index = 0; index < max_index; index++) { |
| 2550 | unsigned int i; | 2551 | unsigned long *kaddr; |
| 2552 | |||
| 2551 | /* | 2553 | /* |
| 2552 | * Read the page from page cache, getting it from backing store | 2554 | * Read the page from page cache, getting it from backing store |
| 2553 | * if necessary, and increment the use count. | 2555 | * if necessary, and increment the use count. |
| @@ -2560,16 +2562,16 @@ static unsigned long __get_nr_free_mft_records(ntfs_volume *vol, | |||
| 2560 | nr_free -= PAGE_CACHE_SIZE * 8; | 2562 | nr_free -= PAGE_CACHE_SIZE * 8; |
| 2561 | continue; | 2563 | continue; |
| 2562 | } | 2564 | } |
| 2563 | kaddr = (u32*)kmap_atomic(page, KM_USER0); | 2565 | kaddr = kmap_atomic(page, KM_USER0); |
| 2564 | /* | 2566 | /* |
| 2565 | * For each 4 bytes, subtract the number of set bits. If this | 2567 | * Subtract the number of set bits. If this |
| 2566 | * is the last page and it is partial we don't really care as | 2568 | * is the last page and it is partial we don't really care as |
| 2567 | * it just means we do a little extra work but it won't affect | 2569 | * it just means we do a little extra work but it won't affect |
| 2568 | * the result as all out of range bytes are set to zero by | 2570 | * the result as all out of range bytes are set to zero by |
| 2569 | * ntfs_readpage(). | 2571 | * ntfs_readpage(). |
| 2570 | */ | 2572 | */ |
| 2571 | for (i = 0; i < PAGE_CACHE_SIZE / 4; i++) | 2573 | nr_free -= bitmap_weight(kaddr, |
| 2572 | nr_free -= (s64)hweight32(kaddr[i]); | 2574 | PAGE_CACHE_SIZE * BITS_PER_BYTE); |
| 2573 | kunmap_atomic(kaddr, KM_USER0); | 2575 | kunmap_atomic(kaddr, KM_USER0); |
| 2574 | page_cache_release(page); | 2576 | page_cache_release(page); |
| 2575 | } | 2577 | } |
| @@ -2662,6 +2664,13 @@ static int ntfs_statfs(struct dentry *dentry, struct kstatfs *sfs) | |||
| 2662 | return 0; | 2664 | return 0; |
| 2663 | } | 2665 | } |
| 2664 | 2666 | ||
| 2667 | #ifdef NTFS_RW | ||
| 2668 | static int ntfs_write_inode(struct inode *vi, struct writeback_control *wbc) | ||
| 2669 | { | ||
| 2670 | return __ntfs_write_inode(vi, wbc->sync_mode == WB_SYNC_ALL); | ||
| 2671 | } | ||
| 2672 | #endif | ||
| 2673 | |||
| 2665 | /** | 2674 | /** |
| 2666 | * The complete super operations. | 2675 | * The complete super operations. |
| 2667 | */ | 2676 | */ |
