aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ntfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ntfs')
-rw-r--r--fs/ntfs/aops.c39
-rw-r--r--fs/ntfs/inode.c19
-rw-r--r--fs/ntfs/ntfs.h8
3 files changed, 42 insertions, 24 deletions
diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c
index d267ea6aa1a0..6f0f98176b10 100644
--- a/fs/ntfs/aops.c
+++ b/fs/ntfs/aops.c
@@ -1,8 +1,7 @@
1/** 1/**
2 * aops.c - NTFS kernel address space operations and page cache handling. 2 * aops.c - NTFS kernel address space operations and page cache handling.
3 * Part of the Linux-NTFS project.
4 * 3 *
5 * Copyright (c) 2001-2007 Anton Altaparmakov 4 * Copyright (c) 2001-2014 Anton Altaparmakov and Tuxera Inc.
6 * Copyright (c) 2002 Richard Russon 5 * Copyright (c) 2002 Richard Russon
7 * 6 *
8 * This program/include file is free software; you can redistribute it and/or 7 * This program/include file is free software; you can redistribute it and/or
@@ -1539,16 +1538,33 @@ err_out:
1539#endif /* NTFS_RW */ 1538#endif /* NTFS_RW */
1540 1539
1541/** 1540/**
1542 * ntfs_aops - general address space operations for inodes and attributes 1541 * ntfs_normal_aops - address space operations for normal inodes and attributes
1542 *
1543 * Note these are not used for compressed or mst protected inodes and
1544 * attributes.
1543 */ 1545 */
1544const struct address_space_operations ntfs_aops = { 1546const struct address_space_operations ntfs_normal_aops = {
1545 .readpage = ntfs_readpage, /* Fill page with data. */ 1547 .readpage = ntfs_readpage,
1546#ifdef NTFS_RW 1548#ifdef NTFS_RW
1547 .writepage = ntfs_writepage, /* Write dirty page to disk. */ 1549 .writepage = ntfs_writepage,
1550 .set_page_dirty = __set_page_dirty_buffers,
1551#endif /* NTFS_RW */
1552 .migratepage = buffer_migrate_page,
1553 .is_partially_uptodate = block_is_partially_uptodate,
1554 .error_remove_page = generic_error_remove_page,
1555};
1556
1557/**
1558 * ntfs_compressed_aops - address space operations for compressed inodes
1559 */
1560const struct address_space_operations ntfs_compressed_aops = {
1561 .readpage = ntfs_readpage,
1562#ifdef NTFS_RW
1563 .writepage = ntfs_writepage,
1564 .set_page_dirty = __set_page_dirty_buffers,
1548#endif /* NTFS_RW */ 1565#endif /* NTFS_RW */
1549 .migratepage = buffer_migrate_page, /* Move a page cache page from 1566 .migratepage = buffer_migrate_page,
1550 one physical page to an 1567 .is_partially_uptodate = block_is_partially_uptodate,
1551 other. */
1552 .error_remove_page = generic_error_remove_page, 1568 .error_remove_page = generic_error_remove_page,
1553}; 1569};
1554 1570
@@ -1564,9 +1580,8 @@ const struct address_space_operations ntfs_mst_aops = {
1564 without touching the buffers 1580 without touching the buffers
1565 belonging to the page. */ 1581 belonging to the page. */
1566#endif /* NTFS_RW */ 1582#endif /* NTFS_RW */
1567 .migratepage = buffer_migrate_page, /* Move a page cache page from 1583 .migratepage = buffer_migrate_page,
1568 one physical page to an 1584 .is_partially_uptodate = block_is_partially_uptodate,
1569 other. */
1570 .error_remove_page = generic_error_remove_page, 1585 .error_remove_page = generic_error_remove_page,
1571}; 1586};
1572 1587
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index f47af5e6e230..898b9949d363 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -1,7 +1,7 @@
1/** 1/**
2 * inode.c - NTFS kernel inode handling. Part of the Linux-NTFS project. 2 * inode.c - NTFS kernel inode handling.
3 * 3 *
4 * Copyright (c) 2001-2007 Anton Altaparmakov 4 * Copyright (c) 2001-2014 Anton Altaparmakov and Tuxera Inc.
5 * 5 *
6 * This program/include file is free software; you can redistribute it and/or 6 * This program/include file is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as published 7 * modify it under the terms of the GNU General Public License as published
@@ -1012,6 +1012,7 @@ skip_large_dir_stuff:
1012 /* Setup the operations for this inode. */ 1012 /* Setup the operations for this inode. */
1013 vi->i_op = &ntfs_dir_inode_ops; 1013 vi->i_op = &ntfs_dir_inode_ops;
1014 vi->i_fop = &ntfs_dir_ops; 1014 vi->i_fop = &ntfs_dir_ops;
1015 vi->i_mapping->a_ops = &ntfs_mst_aops;
1015 } else { 1016 } else {
1016 /* It is a file. */ 1017 /* It is a file. */
1017 ntfs_attr_reinit_search_ctx(ctx); 1018 ntfs_attr_reinit_search_ctx(ctx);
@@ -1160,11 +1161,12 @@ no_data_attr_special_case:
1160 /* Setup the operations for this inode. */ 1161 /* Setup the operations for this inode. */
1161 vi->i_op = &ntfs_file_inode_ops; 1162 vi->i_op = &ntfs_file_inode_ops;
1162 vi->i_fop = &ntfs_file_ops; 1163 vi->i_fop = &ntfs_file_ops;
1164 vi->i_mapping->a_ops = &ntfs_normal_aops;
1165 if (NInoMstProtected(ni))
1166 vi->i_mapping->a_ops = &ntfs_mst_aops;
1167 else if (NInoCompressed(ni))
1168 vi->i_mapping->a_ops = &ntfs_compressed_aops;
1163 } 1169 }
1164 if (NInoMstProtected(ni))
1165 vi->i_mapping->a_ops = &ntfs_mst_aops;
1166 else
1167 vi->i_mapping->a_ops = &ntfs_aops;
1168 /* 1170 /*
1169 * The number of 512-byte blocks used on disk (for stat). This is in so 1171 * The number of 512-byte blocks used on disk (for stat). This is in so
1170 * far inaccurate as it doesn't account for any named streams or other 1172 * far inaccurate as it doesn't account for any named streams or other
@@ -1414,10 +1416,11 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
1414 ni->allocated_size = sle64_to_cpu( 1416 ni->allocated_size = sle64_to_cpu(
1415 a->data.non_resident.allocated_size); 1417 a->data.non_resident.allocated_size);
1416 } 1418 }
1419 vi->i_mapping->a_ops = &ntfs_normal_aops;
1417 if (NInoMstProtected(ni)) 1420 if (NInoMstProtected(ni))
1418 vi->i_mapping->a_ops = &ntfs_mst_aops; 1421 vi->i_mapping->a_ops = &ntfs_mst_aops;
1419 else 1422 else if (NInoCompressed(ni))
1420 vi->i_mapping->a_ops = &ntfs_aops; 1423 vi->i_mapping->a_ops = &ntfs_compressed_aops;
1421 if ((NInoCompressed(ni) || NInoSparse(ni)) && ni->type != AT_INDEX_ROOT) 1424 if ((NInoCompressed(ni) || NInoSparse(ni)) && ni->type != AT_INDEX_ROOT)
1422 vi->i_blocks = ni->itype.compressed.size >> 9; 1425 vi->i_blocks = ni->itype.compressed.size >> 9;
1423 else 1426 else
diff --git a/fs/ntfs/ntfs.h b/fs/ntfs/ntfs.h
index d6a340bf80fc..c581e26a350d 100644
--- a/fs/ntfs/ntfs.h
+++ b/fs/ntfs/ntfs.h
@@ -1,8 +1,7 @@
1/* 1/*
2 * ntfs.h - Defines for NTFS Linux kernel driver. Part of the Linux-NTFS 2 * ntfs.h - Defines for NTFS Linux kernel driver.
3 * project.
4 * 3 *
5 * Copyright (c) 2001-2005 Anton Altaparmakov 4 * Copyright (c) 2001-2014 Anton Altaparmakov and Tuxera Inc.
6 * Copyright (C) 2002 Richard Russon 5 * Copyright (C) 2002 Richard Russon
7 * 6 *
8 * This program/include file is free software; you can redistribute it and/or 7 * This program/include file is free software; you can redistribute it and/or
@@ -57,7 +56,8 @@ extern struct kmem_cache *ntfs_attr_ctx_cache;
57extern struct kmem_cache *ntfs_index_ctx_cache; 56extern struct kmem_cache *ntfs_index_ctx_cache;
58 57
59/* The various operations structs defined throughout the driver files. */ 58/* The various operations structs defined throughout the driver files. */
60extern const struct address_space_operations ntfs_aops; 59extern const struct address_space_operations ntfs_normal_aops;
60extern const struct address_space_operations ntfs_compressed_aops;
61extern const 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;