aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ntfs
diff options
context:
space:
mode:
authorAnton Altaparmakov <aia21@cantab.net>2005-10-04 11:01:06 -0400
committerAnton Altaparmakov <aia21@cantab.net>2005-10-04 11:01:06 -0400
commite9438250b635f7832e99a8c8d2e394dd1522ce65 (patch)
treee91de9667aa45e9f02387a2dc013982af245d029 /fs/ntfs
parentdd072330d1a60be11a5c284fa1e645350750a4fc (diff)
NTFS: Enable ATTR_SIZE attribute changes in ntfs_setattr(). This completes
the initial implementation of file truncation. Now both open(2)ing a file with the O_TRUNC flag and the {,f}truncate(2) system calls will resize a file appropriately. The limitations are that only uncompressed and unencrypted files are supported. Also, there is only very limited support for highly fragmented files (the ones whose $DATA attribute is split into multiple attribute extents). Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Diffstat (limited to 'fs/ntfs')
-rw-r--r--fs/ntfs/ChangeLog7
-rw-r--r--fs/ntfs/inode.c23
2 files changed, 22 insertions, 8 deletions
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
index 70ad4be7a7fe..9f4674a026f2 100644
--- a/fs/ntfs/ChangeLog
+++ b/fs/ntfs/ChangeLog
@@ -50,6 +50,13 @@ ToDo/Notes:
50 but not the initialized size can be extended, too. 50 but not the initialized size can be extended, too.
51 - Implement fs/ntfs/inode.[hc]::ntfs_truncate(). It only supports 51 - Implement fs/ntfs/inode.[hc]::ntfs_truncate(). It only supports
52 uncompressed and unencrypted files. 52 uncompressed and unencrypted files.
53 - Enable ATTR_SIZE attribute changes in ntfs_setattr(). This completes
54 the initial implementation of file truncation. Now both open(2)ing
55 a file with the O_TRUNC flag and the {,f}truncate(2) system calls
56 will resize a file appropriately. The limitations are that only
57 uncompressed and unencrypted files are supported. Also, there is
58 only very limited support for highly fragmented files (the ones whose
59 $DATA attribute is split into multiple attribute extents).
53 60
542.1.24 - Lots of bug fixes and support more clean journal states. 612.1.24 - Lots of bug fixes and support more clean journal states.
55 62
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index a1682342baa6..b24f4c4b2c5c 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -2845,8 +2845,7 @@ int ntfs_setattr(struct dentry *dentry, struct iattr *attr)
2845 2845
2846 err = inode_change_ok(vi, attr); 2846 err = inode_change_ok(vi, attr);
2847 if (err) 2847 if (err)
2848 return err; 2848 goto out;
2849
2850 /* We do not support NTFS ACLs yet. */ 2849 /* We do not support NTFS ACLs yet. */
2851 if (ia_valid & (ATTR_UID | ATTR_GID | ATTR_MODE)) { 2850 if (ia_valid & (ATTR_UID | ATTR_GID | ATTR_MODE)) {
2852 ntfs_warning(vi->i_sb, "Changes in user/group/mode are not " 2851 ntfs_warning(vi->i_sb, "Changes in user/group/mode are not "
@@ -2854,14 +2853,22 @@ int ntfs_setattr(struct dentry *dentry, struct iattr *attr)
2854 err = -EOPNOTSUPP; 2853 err = -EOPNOTSUPP;
2855 goto out; 2854 goto out;
2856 } 2855 }
2857
2858 if (ia_valid & ATTR_SIZE) { 2856 if (ia_valid & ATTR_SIZE) {
2859 if (attr->ia_size != i_size_read(vi)) { 2857 if (attr->ia_size != i_size_read(vi)) {
2860 ntfs_warning(vi->i_sb, "Changes in inode size are not " 2858 ntfs_inode *ni = NTFS_I(vi);
2861 "supported yet, ignoring."); 2859 /*
2862 err = -EOPNOTSUPP; 2860 * FIXME: For now we do not support resizing of
2863 // TODO: Implement... 2861 * compressed or encrypted files yet.
2864 // err = vmtruncate(vi, attr->ia_size); 2862 */
2863 if (NInoCompressed(ni) || NInoEncrypted(ni)) {
2864 ntfs_warning(vi->i_sb, "Changes in inode size "
2865 "are not supported yet for "
2866 "%s files, ignoring.",
2867 NInoCompressed(ni) ?
2868 "compressed" : "encrypted");
2869 err = -EOPNOTSUPP;
2870 } else
2871 err = vmtruncate(vi, attr->ia_size);
2865 if (err || ia_valid == ATTR_SIZE) 2872 if (err || ia_valid == ATTR_SIZE)
2866 goto out; 2873 goto out;
2867 } else { 2874 } else {