aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ntfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ntfs')
-rw-r--r--fs/ntfs/aops.c4
-rw-r--r--fs/ntfs/aops.h3
-rw-r--r--fs/ntfs/attrib.c6
-rw-r--r--fs/ntfs/file.c42
-rw-r--r--fs/ntfs/ntfs.h4
-rw-r--r--fs/ntfs/super.c14
6 files changed, 37 insertions, 36 deletions
diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c
index 580412d330cb..bc579bfdfbd8 100644
--- a/fs/ntfs/aops.c
+++ b/fs/ntfs/aops.c
@@ -1544,7 +1544,7 @@ err_out:
1544/** 1544/**
1545 * ntfs_aops - general address space operations for inodes and attributes 1545 * ntfs_aops - general address space operations for inodes and attributes
1546 */ 1546 */
1547struct address_space_operations ntfs_aops = { 1547const struct address_space_operations ntfs_aops = {
1548 .readpage = ntfs_readpage, /* Fill page with data. */ 1548 .readpage = ntfs_readpage, /* Fill page with data. */
1549 .sync_page = block_sync_page, /* Currently, just unplugs the 1549 .sync_page = block_sync_page, /* Currently, just unplugs the
1550 disk request queue. */ 1550 disk request queue. */
@@ -1560,7 +1560,7 @@ struct address_space_operations ntfs_aops = {
1560 * ntfs_mst_aops - general address space operations for mst protecteed inodes 1560 * ntfs_mst_aops - general address space operations for mst protecteed inodes
1561 * and attributes 1561 * and attributes
1562 */ 1562 */
1563struct address_space_operations ntfs_mst_aops = { 1563const struct address_space_operations ntfs_mst_aops = {
1564 .readpage = ntfs_readpage, /* Fill page with data. */ 1564 .readpage = ntfs_readpage, /* Fill page with data. */
1565 .sync_page = block_sync_page, /* Currently, just unplugs the 1565 .sync_page = block_sync_page, /* Currently, just unplugs the
1566 disk request queue. */ 1566 disk request queue. */
diff --git a/fs/ntfs/aops.h b/fs/ntfs/aops.h
index 3b74e66ca2ff..325ce261a107 100644
--- a/fs/ntfs/aops.h
+++ b/fs/ntfs/aops.h
@@ -86,8 +86,7 @@ static inline void ntfs_unmap_page(struct page *page)
86static inline struct page *ntfs_map_page(struct address_space *mapping, 86static inline struct page *ntfs_map_page(struct address_space *mapping,
87 unsigned long index) 87 unsigned long index)
88{ 88{
89 struct page *page = read_cache_page(mapping, index, 89 struct page *page = read_mapping_page(mapping, index, NULL);
90 (filler_t*)mapping->a_ops->readpage, NULL);
91 90
92 if (!IS_ERR(page)) { 91 if (!IS_ERR(page)) {
93 wait_on_page_locked(page); 92 wait_on_page_locked(page);
diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
index 1663f5c3c6aa..6708e1d68a9e 100644
--- a/fs/ntfs/attrib.c
+++ b/fs/ntfs/attrib.c
@@ -2529,8 +2529,7 @@ int ntfs_attr_set(ntfs_inode *ni, const s64 ofs, const s64 cnt, const u8 val)
2529 end >>= PAGE_CACHE_SHIFT; 2529 end >>= PAGE_CACHE_SHIFT;
2530 /* If there is a first partial page, need to do it the slow way. */ 2530 /* If there is a first partial page, need to do it the slow way. */
2531 if (start_ofs) { 2531 if (start_ofs) {
2532 page = read_cache_page(mapping, idx, 2532 page = read_mapping_page(mapping, idx, NULL);
2533 (filler_t*)mapping->a_ops->readpage, NULL);
2534 if (IS_ERR(page)) { 2533 if (IS_ERR(page)) {
2535 ntfs_error(vol->sb, "Failed to read first partial " 2534 ntfs_error(vol->sb, "Failed to read first partial "
2536 "page (sync error, index 0x%lx).", idx); 2535 "page (sync error, index 0x%lx).", idx);
@@ -2600,8 +2599,7 @@ int ntfs_attr_set(ntfs_inode *ni, const s64 ofs, const s64 cnt, const u8 val)
2600 } 2599 }
2601 /* If there is a last partial page, need to do it the slow way. */ 2600 /* If there is a last partial page, need to do it the slow way. */
2602 if (end_ofs) { 2601 if (end_ofs) {
2603 page = read_cache_page(mapping, idx, 2602 page = read_mapping_page(mapping, idx, NULL);
2604 (filler_t*)mapping->a_ops->readpage, NULL);
2605 if (IS_ERR(page)) { 2603 if (IS_ERR(page)) {
2606 ntfs_error(vol->sb, "Failed to read last partial page " 2604 ntfs_error(vol->sb, "Failed to read last partial page "
2607 "(sync error, index 0x%lx).", idx); 2605 "(sync error, index 0x%lx).", idx);
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
index c63a83e8da98..2e42c2dcae12 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -231,8 +231,7 @@ do_non_resident_extend:
231 * Read the page. If the page is not present, this will zero 231 * Read the page. If the page is not present, this will zero
232 * the uninitialized regions for us. 232 * the uninitialized regions for us.
233 */ 233 */
234 page = read_cache_page(mapping, index, 234 page = read_mapping_page(mapping, index, NULL);
235 (filler_t*)mapping->a_ops->readpage, NULL);
236 if (IS_ERR(page)) { 235 if (IS_ERR(page)) {
237 err = PTR_ERR(page); 236 err = PTR_ERR(page);
238 goto init_err_out; 237 goto init_err_out;
@@ -1359,7 +1358,7 @@ err_out:
1359 goto out; 1358 goto out;
1360} 1359}
1361 1360
1362static size_t __ntfs_copy_from_user_iovec(char *vaddr, 1361static size_t __ntfs_copy_from_user_iovec_inatomic(char *vaddr,
1363 const struct iovec *iov, size_t iov_ofs, size_t bytes) 1362 const struct iovec *iov, size_t iov_ofs, size_t bytes)
1364{ 1363{
1365 size_t total = 0; 1364 size_t total = 0;
@@ -1377,10 +1376,6 @@ static size_t __ntfs_copy_from_user_iovec(char *vaddr,
1377 bytes -= len; 1376 bytes -= len;
1378 vaddr += len; 1377 vaddr += len;
1379 if (unlikely(left)) { 1378 if (unlikely(left)) {
1380 /*
1381 * Zero the rest of the target like __copy_from_user().
1382 */
1383 memset(vaddr, 0, bytes);
1384 total -= left; 1379 total -= left;
1385 break; 1380 break;
1386 } 1381 }
@@ -1421,11 +1416,13 @@ static inline void ntfs_set_next_iovec(const struct iovec **iovp,
1421 * pages (out to offset + bytes), to emulate ntfs_copy_from_user()'s 1416 * pages (out to offset + bytes), to emulate ntfs_copy_from_user()'s
1422 * single-segment behaviour. 1417 * single-segment behaviour.
1423 * 1418 *
1424 * We call the same helper (__ntfs_copy_from_user_iovec()) both when atomic and 1419 * We call the same helper (__ntfs_copy_from_user_iovec_inatomic()) both
1425 * when not atomic. This is ok because __ntfs_copy_from_user_iovec() calls 1420 * when atomic and when not atomic. This is ok because
1426 * __copy_from_user_inatomic() and it is ok to call this when non-atomic. In 1421 * __ntfs_copy_from_user_iovec_inatomic() calls __copy_from_user_inatomic()
1427 * fact, the only difference between __copy_from_user_inatomic() and 1422 * and it is ok to call this when non-atomic.
1428 * __copy_from_user() is that the latter calls might_sleep(). And on many 1423 * Infact, the only difference between __copy_from_user_inatomic() and
1424 * __copy_from_user() is that the latter calls might_sleep() and the former
1425 * should not zero the tail of the buffer on error. And on many
1429 * architectures __copy_from_user_inatomic() is just defined to 1426 * architectures __copy_from_user_inatomic() is just defined to
1430 * __copy_from_user() so it makes no difference at all on those architectures. 1427 * __copy_from_user() so it makes no difference at all on those architectures.
1431 */ 1428 */
@@ -1442,14 +1439,18 @@ static inline size_t ntfs_copy_from_user_iovec(struct page **pages,
1442 if (len > bytes) 1439 if (len > bytes)
1443 len = bytes; 1440 len = bytes;
1444 kaddr = kmap_atomic(*pages, KM_USER0); 1441 kaddr = kmap_atomic(*pages, KM_USER0);
1445 copied = __ntfs_copy_from_user_iovec(kaddr + ofs, 1442 copied = __ntfs_copy_from_user_iovec_inatomic(kaddr + ofs,
1446 *iov, *iov_ofs, len); 1443 *iov, *iov_ofs, len);
1447 kunmap_atomic(kaddr, KM_USER0); 1444 kunmap_atomic(kaddr, KM_USER0);
1448 if (unlikely(copied != len)) { 1445 if (unlikely(copied != len)) {
1449 /* Do it the slow way. */ 1446 /* Do it the slow way. */
1450 kaddr = kmap(*pages); 1447 kaddr = kmap(*pages);
1451 copied = __ntfs_copy_from_user_iovec(kaddr + ofs, 1448 copied = __ntfs_copy_from_user_iovec_inatomic(kaddr + ofs,
1452 *iov, *iov_ofs, len); 1449 *iov, *iov_ofs, len);
1450 /*
1451 * Zero the rest of the target like __copy_from_user().
1452 */
1453 memset(kaddr + ofs + copied, 0, len - copied);
1453 kunmap(*pages); 1454 kunmap(*pages);
1454 if (unlikely(copied != len)) 1455 if (unlikely(copied != len))
1455 goto err_out; 1456 goto err_out;
@@ -1484,14 +1485,15 @@ static inline void ntfs_flush_dcache_pages(struct page **pages,
1484 unsigned nr_pages) 1485 unsigned nr_pages)
1485{ 1486{
1486 BUG_ON(!nr_pages); 1487 BUG_ON(!nr_pages);
1488 /*
1489 * Warning: Do not do the decrement at the same time as the call to
1490 * flush_dcache_page() because it is a NULL macro on i386 and hence the
1491 * decrement never happens so the loop never terminates.
1492 */
1487 do { 1493 do {
1488 /* 1494 --nr_pages;
1489 * Warning: Do not do the decrement at the same time as the
1490 * call because flush_dcache_page() is a NULL macro on i386
1491 * and hence the decrement never happens.
1492 */
1493 flush_dcache_page(pages[nr_pages]); 1495 flush_dcache_page(pages[nr_pages]);
1494 } while (--nr_pages > 0); 1496 } while (nr_pages > 0);
1495} 1497}
1496 1498
1497/** 1499/**
diff --git a/fs/ntfs/ntfs.h b/fs/ntfs/ntfs.h
index bf7b3d7c0930..ddd3d503097c 100644
--- a/fs/ntfs/ntfs.h
+++ b/fs/ntfs/ntfs.h
@@ -57,8 +57,8 @@ extern struct kmem_cache *ntfs_attr_ctx_cache;
57extern struct kmem_cache *ntfs_index_ctx_cache; 57extern struct kmem_cache *ntfs_index_ctx_cache;
58 58
59/* The various operations structs defined throughout the driver files. */ 59/* The various operations structs defined throughout the driver files. */
60extern struct address_space_operations ntfs_aops; 60extern const struct address_space_operations ntfs_aops;
61extern struct address_space_operations ntfs_mst_aops; 61extern const struct address_space_operations ntfs_mst_aops;
62 62
63extern const struct file_operations ntfs_file_ops; 63extern const struct file_operations ntfs_file_ops;
64extern struct inode_operations ntfs_file_inode_ops; 64extern struct inode_operations ntfs_file_inode_ops;
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index 27833f6df49f..0e14acea3f8b 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -2601,10 +2601,10 @@ static unsigned long __get_nr_free_mft_records(ntfs_volume *vol,
2601 2601
2602/** 2602/**
2603 * ntfs_statfs - return information about mounted NTFS volume 2603 * ntfs_statfs - return information about mounted NTFS volume
2604 * @sb: super block of mounted volume 2604 * @dentry: dentry from mounted volume
2605 * @sfs: statfs structure in which to return the information 2605 * @sfs: statfs structure in which to return the information
2606 * 2606 *
2607 * Return information about the mounted NTFS volume @sb in the statfs structure 2607 * Return information about the mounted NTFS volume @dentry in the statfs structure
2608 * pointed to by @sfs (this is initialized with zeros before ntfs_statfs is 2608 * pointed to by @sfs (this is initialized with zeros before ntfs_statfs is
2609 * called). We interpret the values to be correct of the moment in time at 2609 * called). We interpret the values to be correct of the moment in time at
2610 * which we are called. Most values are variable otherwise and this isn't just 2610 * which we are called. Most values are variable otherwise and this isn't just
@@ -2617,8 +2617,9 @@ static unsigned long __get_nr_free_mft_records(ntfs_volume *vol,
2617 * 2617 *
2618 * Return 0 on success or -errno on error. 2618 * Return 0 on success or -errno on error.
2619 */ 2619 */
2620static int ntfs_statfs(struct super_block *sb, struct kstatfs *sfs) 2620static int ntfs_statfs(struct dentry *dentry, struct kstatfs *sfs)
2621{ 2621{
2622 struct super_block *sb = dentry->d_sb;
2622 s64 size; 2623 s64 size;
2623 ntfs_volume *vol = NTFS_SB(sb); 2624 ntfs_volume *vol = NTFS_SB(sb);
2624 ntfs_inode *mft_ni = NTFS_I(vol->mft_ino); 2625 ntfs_inode *mft_ni = NTFS_I(vol->mft_ino);
@@ -3093,10 +3094,11 @@ struct kmem_cache *ntfs_index_ctx_cache;
3093/* Driver wide mutex. */ 3094/* Driver wide mutex. */
3094DEFINE_MUTEX(ntfs_lock); 3095DEFINE_MUTEX(ntfs_lock);
3095 3096
3096static struct super_block *ntfs_get_sb(struct file_system_type *fs_type, 3097static int ntfs_get_sb(struct file_system_type *fs_type,
3097 int flags, const char *dev_name, void *data) 3098 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
3098{ 3099{
3099 return get_sb_bdev(fs_type, flags, dev_name, data, ntfs_fill_super); 3100 return get_sb_bdev(fs_type, flags, dev_name, data, ntfs_fill_super,
3101 mnt);
3100} 3102}
3101 3103
3102static struct file_system_type ntfs_fs_type = { 3104static struct file_system_type ntfs_fs_type = {