diff options
author | Anton Altaparmakov <aia21@cantab.net> | 2005-02-03 07:02:56 -0500 |
---|---|---|
committer | Anton Altaparmakov <aia21@cantab.net> | 2005-05-05 05:53:01 -0400 |
commit | c002f42543e155dd2b5b5039ea2637ab26c82513 (patch) | |
tree | ea408493d2e0e9096166ab39a8657689c15c7dfa /fs | |
parent | f40661be038ce6ed9ef6a8b80307a9153bd95769 (diff) |
NTFS: - Add disable_sparse mount option together with a per volume sparse
enable bit which is set appropriately and a per inode sparse disable
bit which is preset on some system file inodes as appropriate.
- Enforce that sparse support is disabled on NTFS volumes pre 3.0.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ntfs/ChangeLog | 10 | ||||
-rw-r--r-- | fs/ntfs/dir.c | 4 | ||||
-rw-r--r-- | fs/ntfs/inode.c | 5 | ||||
-rw-r--r-- | fs/ntfs/inode.h | 4 | ||||
-rw-r--r-- | fs/ntfs/layout.h | 4 | ||||
-rw-r--r-- | fs/ntfs/super.c | 65 | ||||
-rw-r--r-- | fs/ntfs/sysctl.c | 4 | ||||
-rw-r--r-- | fs/ntfs/volume.h | 6 |
8 files changed, 71 insertions, 31 deletions
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog index 8a249df2b5c2..3f78fff45448 100644 --- a/fs/ntfs/ChangeLog +++ b/fs/ntfs/ChangeLog | |||
@@ -56,6 +56,10 @@ ToDo/Notes: | |||
56 | this only works until the data attribute becomes too big for the mft | 56 | this only works until the data attribute becomes too big for the mft |
57 | record after which we abort the write returning -EOPNOTSUPP from | 57 | record after which we abort the write returning -EOPNOTSUPP from |
58 | ntfs_prepare_write(). | 58 | ntfs_prepare_write(). |
59 | - Add disable_sparse mount option together with a per volume sparse | ||
60 | enable bit which is set appropriately and a per inode sparse disable | ||
61 | bit which is preset on some system file inodes as appropriate. | ||
62 | - Enforce that sparse support is disabled on NTFS volumes pre 3.0. | ||
59 | 63 | ||
60 | 2.1.22 - Many bug and race fixes and error handling improvements. | 64 | 2.1.22 - Many bug and race fixes and error handling improvements. |
61 | 65 | ||
@@ -1062,7 +1066,7 @@ tng-0.0.8 - 08/03/2002 - Now using BitKeeper, http://linux-ntfs.bkbits.net/ | |||
1062 | - Further runlist merging work. (Richard Russon) | 1066 | - Further runlist merging work. (Richard Russon) |
1063 | - Backwards compatibility for gcc-2.95. (Richard Russon) | 1067 | - Backwards compatibility for gcc-2.95. (Richard Russon) |
1064 | - Update to kernel 2.5.5-pre1 and rediff the now tiny patch. | 1068 | - Update to kernel 2.5.5-pre1 and rediff the now tiny patch. |
1065 | - Convert to new file system declaration using ->ntfs_get_sb() and | 1069 | - Convert to new filesystem declaration using ->ntfs_get_sb() and |
1066 | replacing ntfs_read_super() with ntfs_fill_super(). | 1070 | replacing ntfs_read_super() with ntfs_fill_super(). |
1067 | - Set s_maxbytes to MAX_LFS_FILESIZE to avoid page cache page index | 1071 | - Set s_maxbytes to MAX_LFS_FILESIZE to avoid page cache page index |
1068 | overflow on 32-bit architectures. | 1072 | overflow on 32-bit architectures. |
@@ -1358,7 +1362,7 @@ tng-0.0.1 - The first useful version. | |||
1358 | The driver is now actually useful! Yey. (-: It undoubtedly has got bugs | 1362 | The driver is now actually useful! Yey. (-: It undoubtedly has got bugs |
1359 | though and it doesn't implement accesssing compressed files yet. Also, | 1363 | though and it doesn't implement accesssing compressed files yet. Also, |
1360 | accessing files with attribute list attributes is not implemented yet | 1364 | accessing files with attribute list attributes is not implemented yet |
1361 | either. But for small or simple file systems it should work and allow | 1365 | either. But for small or simple filesystems it should work and allow |
1362 | you to list directories, use stat on directory entries and the file | 1366 | you to list directories, use stat on directory entries and the file |
1363 | system, open, read, mmap and llseek around in files. A big mile stone | 1367 | system, open, read, mmap and llseek around in files. A big mile stone |
1364 | has been reached! | 1368 | has been reached! |
@@ -1366,7 +1370,7 @@ tng-0.0.1 - The first useful version. | |||
1366 | tng-0.0.0 - Initial version tag. | 1370 | tng-0.0.0 - Initial version tag. |
1367 | 1371 | ||
1368 | Initial driver implementation. The driver can mount and umount simple | 1372 | Initial driver implementation. The driver can mount and umount simple |
1369 | NTFS file systems (i.e. ones without attribute lists in the system | 1373 | NTFS filesystems (i.e. ones without attribute lists in the system |
1370 | files). If the mount fails there might be problems in the error handling | 1374 | files). If the mount fails there might be problems in the error handling |
1371 | code paths, so be warned. Otherwise it seems to be loading the system | 1375 | code paths, so be warned. Otherwise it seems to be loading the system |
1372 | files nicely and the mft record read mapping/unmapping seems to be | 1376 | files nicely and the mft record read mapping/unmapping seems to be |
diff --git a/fs/ntfs/dir.c b/fs/ntfs/dir.c index d261ac4596f5..95c44577160c 100644 --- a/fs/ntfs/dir.c +++ b/fs/ntfs/dir.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /** | 1 | /** |
2 | * dir.c - NTFS kernel directory operations. Part of the Linux-NTFS project. | 2 | * dir.c - NTFS kernel directory operations. Part of the Linux-NTFS project. |
3 | * | 3 | * |
4 | * Copyright (c) 2001-2004 Anton Altaparmakov | 4 | * Copyright (c) 2001-2005 Anton Altaparmakov |
5 | * Copyright (c) 2002 Richard Russon | 5 | * Copyright (c) 2002 Richard Russon |
6 | * | 6 | * |
7 | * 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 |
@@ -610,7 +610,7 @@ dir_err_out: | |||
610 | // TODO: (AIA) | 610 | // TODO: (AIA) |
611 | // The algorithm embedded in this code will be required for the time when we | 611 | // The algorithm embedded in this code will be required for the time when we |
612 | // want to support adding of entries to directories, where we require correct | 612 | // want to support adding of entries to directories, where we require correct |
613 | // collation of file names in order not to cause corruption of the file system. | 613 | // collation of file names in order not to cause corruption of the filesystem. |
614 | 614 | ||
615 | /** | 615 | /** |
616 | * ntfs_lookup_inode_by_name - find an inode in a directory given its name | 616 | * ntfs_lookup_inode_by_name - find an inode in a directory given its name |
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c index 6c631dbe0f4c..372c7fcdc068 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. Part of the Linux-NTFS project. |
3 | * | 3 | * |
4 | * Copyright (c) 2001-2004 Anton Altaparmakov | 4 | * Copyright (c) 2001-2005 Anton Altaparmakov |
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 |
@@ -1731,6 +1731,7 @@ int ntfs_read_inode_mount(struct inode *vi) | |||
1731 | /* Setup the data attribute. It is special as it is mst protected. */ | 1731 | /* Setup the data attribute. It is special as it is mst protected. */ |
1732 | NInoSetNonResident(ni); | 1732 | NInoSetNonResident(ni); |
1733 | NInoSetMstProtected(ni); | 1733 | NInoSetMstProtected(ni); |
1734 | NInoSetSparseDisabled(ni); | ||
1734 | ni->type = AT_DATA; | 1735 | ni->type = AT_DATA; |
1735 | ni->name = NULL; | 1736 | ni->name = NULL; |
1736 | ni->name_len = 0; | 1737 | ni->name_len = 0; |
@@ -2279,6 +2280,8 @@ int ntfs_show_options(struct seq_file *sf, struct vfsmount *mnt) | |||
2279 | seq_printf(sf, ",case_sensitive"); | 2280 | seq_printf(sf, ",case_sensitive"); |
2280 | if (NVolShowSystemFiles(vol)) | 2281 | if (NVolShowSystemFiles(vol)) |
2281 | seq_printf(sf, ",show_sys_files"); | 2282 | seq_printf(sf, ",show_sys_files"); |
2283 | if (!NVolSparseEnabled(vol)) | ||
2284 | seq_printf(sf, ",disable_sparse"); | ||
2282 | for (i = 0; on_errors_arr[i].val; i++) { | 2285 | for (i = 0; on_errors_arr[i].val; i++) { |
2283 | if (on_errors_arr[i].val & vol->on_errors) | 2286 | if (on_errors_arr[i].val & vol->on_errors) |
2284 | seq_printf(sf, ",errors=%s", on_errors_arr[i].str); | 2287 | seq_printf(sf, ",errors=%s", on_errors_arr[i].str); |
diff --git a/fs/ntfs/inode.h b/fs/ntfs/inode.h index 56b2d6ec33f7..6eb99777a722 100644 --- a/fs/ntfs/inode.h +++ b/fs/ntfs/inode.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * inode.h - Defines for inode structures NTFS Linux kernel driver. Part of | 2 | * inode.h - Defines for inode structures NTFS Linux kernel driver. Part of |
3 | * the Linux-NTFS project. | 3 | * the Linux-NTFS project. |
4 | * | 4 | * |
5 | * Copyright (c) 2001-2004 Anton Altaparmakov | 5 | * Copyright (c) 2001-2005 Anton Altaparmakov |
6 | * Copyright (c) 2002 Richard Russon | 6 | * Copyright (c) 2002 Richard Russon |
7 | * | 7 | * |
8 | * This program/include file is free software; you can redistribute it and/or | 8 | * This program/include file is free software; you can redistribute it and/or |
@@ -166,6 +166,7 @@ typedef enum { | |||
166 | NI_Sparse, /* 1: Unnamed data attr is sparse (f). | 166 | NI_Sparse, /* 1: Unnamed data attr is sparse (f). |
167 | 1: Create sparse files by default (d). | 167 | 1: Create sparse files by default (d). |
168 | 1: Attribute is sparse (a). */ | 168 | 1: Attribute is sparse (a). */ |
169 | NI_SparseDisabled, /* 1: May not create sparse regions. */ | ||
169 | NI_TruncateFailed, /* 1: Last ntfs_truncate() call failed. */ | 170 | NI_TruncateFailed, /* 1: Last ntfs_truncate() call failed. */ |
170 | } ntfs_inode_state_bits; | 171 | } ntfs_inode_state_bits; |
171 | 172 | ||
@@ -218,6 +219,7 @@ NINO_FNS(IndexAllocPresent) | |||
218 | NINO_FNS(Compressed) | 219 | NINO_FNS(Compressed) |
219 | NINO_FNS(Encrypted) | 220 | NINO_FNS(Encrypted) |
220 | NINO_FNS(Sparse) | 221 | NINO_FNS(Sparse) |
222 | NINO_FNS(SparseDisabled) | ||
221 | NINO_FNS(TruncateFailed) | 223 | NINO_FNS(TruncateFailed) |
222 | 224 | ||
223 | /* | 225 | /* |
diff --git a/fs/ntfs/layout.h b/fs/ntfs/layout.h index 47b338999921..7cb8806d4559 100644 --- a/fs/ntfs/layout.h +++ b/fs/ntfs/layout.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * layout.h - All NTFS associated on-disk structures. Part of the Linux-NTFS | 2 | * layout.h - All NTFS associated on-disk structures. Part of the Linux-NTFS |
3 | * project. | 3 | * project. |
4 | * | 4 | * |
5 | * Copyright (c) 2001-2004 Anton Altaparmakov | 5 | * Copyright (c) 2001-2005 Anton Altaparmakov |
6 | * Copyright (c) 2002 Richard Russon | 6 | * Copyright (c) 2002 Richard Russon |
7 | * | 7 | * |
8 | * This program/include file is free software; you can redistribute it and/or | 8 | * This program/include file is free software; you can redistribute it and/or |
@@ -834,7 +834,7 @@ enum { | |||
834 | /* Note, this is a copy of the corresponding bit from the mft record, | 834 | /* Note, this is a copy of the corresponding bit from the mft record, |
835 | telling us whether this file has a view index present (eg. object id | 835 | telling us whether this file has a view index present (eg. object id |
836 | index, quota index, one of the security indexes or the encrypting | 836 | index, quota index, one of the security indexes or the encrypting |
837 | file system related indexes). */ | 837 | filesystem related indexes). */ |
838 | }; | 838 | }; |
839 | 839 | ||
840 | typedef le32 FILE_ATTR_FLAGS; | 840 | typedef le32 FILE_ATTR_FLAGS; |
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 0ad0c51e9eb9..b676cf6fd93c 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * super.c - NTFS kernel super block handling. Part of the Linux-NTFS project. | 2 | * super.c - NTFS kernel super block handling. Part of the Linux-NTFS project. |
3 | * | 3 | * |
4 | * Copyright (c) 2001-2004 Anton Altaparmakov | 4 | * Copyright (c) 2001-2005 Anton Altaparmakov |
5 | * Copyright (c) 2001,2002 Richard Russon | 5 | * Copyright (c) 2001,2002 Richard Russon |
6 | * | 6 | * |
7 | * 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 |
@@ -41,7 +41,7 @@ | |||
41 | #include "malloc.h" | 41 | #include "malloc.h" |
42 | #include "ntfs.h" | 42 | #include "ntfs.h" |
43 | 43 | ||
44 | /* Number of mounted file systems which have compression enabled. */ | 44 | /* Number of mounted filesystems which have compression enabled. */ |
45 | static unsigned long ntfs_nr_compression_users; | 45 | static unsigned long ntfs_nr_compression_users; |
46 | 46 | ||
47 | /* A global default upcase table and a corresponding reference count. */ | 47 | /* A global default upcase table and a corresponding reference count. */ |
@@ -102,7 +102,7 @@ static BOOL parse_options(ntfs_volume *vol, char *opt) | |||
102 | gid_t gid = (gid_t)-1; | 102 | gid_t gid = (gid_t)-1; |
103 | mode_t fmask = (mode_t)-1, dmask = (mode_t)-1; | 103 | mode_t fmask = (mode_t)-1, dmask = (mode_t)-1; |
104 | int mft_zone_multiplier = -1, on_errors = -1; | 104 | int mft_zone_multiplier = -1, on_errors = -1; |
105 | int show_sys_files = -1, case_sensitive = -1; | 105 | int show_sys_files = -1, case_sensitive = -1, disable_sparse = -1; |
106 | struct nls_table *nls_map = NULL, *old_nls; | 106 | struct nls_table *nls_map = NULL, *old_nls; |
107 | 107 | ||
108 | /* I am lazy... (-8 */ | 108 | /* I am lazy... (-8 */ |
@@ -162,6 +162,7 @@ static BOOL parse_options(ntfs_volume *vol, char *opt) | |||
162 | else NTFS_GETOPT_WITH_DEFAULT("sloppy", sloppy, TRUE) | 162 | else NTFS_GETOPT_WITH_DEFAULT("sloppy", sloppy, TRUE) |
163 | else NTFS_GETOPT_BOOL("show_sys_files", show_sys_files) | 163 | else NTFS_GETOPT_BOOL("show_sys_files", show_sys_files) |
164 | else NTFS_GETOPT_BOOL("case_sensitive", case_sensitive) | 164 | else NTFS_GETOPT_BOOL("case_sensitive", case_sensitive) |
165 | else NTFS_GETOPT_BOOL("disable_sparse", disable_sparse) | ||
165 | else NTFS_GETOPT_OPTIONS_ARRAY("errors", on_errors, | 166 | else NTFS_GETOPT_OPTIONS_ARRAY("errors", on_errors, |
166 | on_errors_arr) | 167 | on_errors_arr) |
167 | else if (!strcmp(p, "posix") || !strcmp(p, "show_inodes")) | 168 | else if (!strcmp(p, "posix") || !strcmp(p, "show_inodes")) |
@@ -291,6 +292,21 @@ no_mount_options: | |||
291 | else | 292 | else |
292 | NVolClearCaseSensitive(vol); | 293 | NVolClearCaseSensitive(vol); |
293 | } | 294 | } |
295 | if (disable_sparse != -1) { | ||
296 | if (disable_sparse) | ||
297 | NVolClearSparseEnabled(vol); | ||
298 | else { | ||
299 | if (!NVolSparseEnabled(vol) && | ||
300 | vol->major_ver && vol->major_ver < 3) | ||
301 | ntfs_warning(vol->sb, "Not enabling sparse " | ||
302 | "support due to NTFS volume " | ||
303 | "version %i.%i (need at least " | ||
304 | "version 3.0).", vol->major_ver, | ||
305 | vol->minor_ver); | ||
306 | else | ||
307 | NVolSetSparseEnabled(vol); | ||
308 | } | ||
309 | } | ||
294 | return TRUE; | 310 | return TRUE; |
295 | needs_arg: | 311 | needs_arg: |
296 | ntfs_error(vol->sb, "The %s option requires an argument.", p); | 312 | ntfs_error(vol->sb, "The %s option requires an argument.", p); |
@@ -967,6 +983,7 @@ static BOOL load_and_init_mft_mirror(ntfs_volume *vol) | |||
967 | tmp_ni = NTFS_I(tmp_ino); | 983 | tmp_ni = NTFS_I(tmp_ino); |
968 | /* The $MFTMirr, like the $MFT is multi sector transfer protected. */ | 984 | /* The $MFTMirr, like the $MFT is multi sector transfer protected. */ |
969 | NInoSetMstProtected(tmp_ni); | 985 | NInoSetMstProtected(tmp_ni); |
986 | NInoSetSparseDisabled(tmp_ni); | ||
970 | /* | 987 | /* |
971 | * Set up our little cheat allowing us to reuse the async read io | 988 | * Set up our little cheat allowing us to reuse the async read io |
972 | * completion handler for directories. | 989 | * completion handler for directories. |
@@ -1122,6 +1139,7 @@ static BOOL load_and_check_logfile(ntfs_volume *vol) | |||
1122 | /* ntfs_check_logfile() will have displayed error output. */ | 1139 | /* ntfs_check_logfile() will have displayed error output. */ |
1123 | return FALSE; | 1140 | return FALSE; |
1124 | } | 1141 | } |
1142 | NInoSetSparseDisabled(NTFS_I(tmp_ino)); | ||
1125 | vol->logfile_ino = tmp_ino; | 1143 | vol->logfile_ino = tmp_ino; |
1126 | ntfs_debug("Done."); | 1144 | ntfs_debug("Done."); |
1127 | return TRUE; | 1145 | return TRUE; |
@@ -1220,6 +1238,7 @@ static BOOL load_and_init_attrdef(ntfs_volume *vol) | |||
1220 | iput(ino); | 1238 | iput(ino); |
1221 | goto failed; | 1239 | goto failed; |
1222 | } | 1240 | } |
1241 | NInoSetSparseDisabled(NTFS_I(ino)); | ||
1223 | /* The size of FILE_AttrDef must be above 0 and fit inside 31 bits. */ | 1242 | /* The size of FILE_AttrDef must be above 0 and fit inside 31 bits. */ |
1224 | i_size = i_size_read(ino); | 1243 | i_size = i_size_read(ino); |
1225 | if (i_size <= 0 || i_size > 0x7fffffff) | 1244 | if (i_size <= 0 || i_size > 0x7fffffff) |
@@ -1439,6 +1458,7 @@ static BOOL load_system_files(ntfs_volume *vol) | |||
1439 | iput(vol->lcnbmp_ino); | 1458 | iput(vol->lcnbmp_ino); |
1440 | goto bitmap_failed; | 1459 | goto bitmap_failed; |
1441 | } | 1460 | } |
1461 | NInoSetSparseDisabled(NTFS_I(vol->lcnbmp_ino)); | ||
1442 | if ((vol->nr_clusters + 7) >> 3 > i_size_read(vol->lcnbmp_ino)) { | 1462 | if ((vol->nr_clusters + 7) >> 3 > i_size_read(vol->lcnbmp_ino)) { |
1443 | iput(vol->lcnbmp_ino); | 1463 | iput(vol->lcnbmp_ino); |
1444 | bitmap_failed: | 1464 | bitmap_failed: |
@@ -1490,6 +1510,12 @@ get_ctx_vol_failed: | |||
1490 | unmap_mft_record(NTFS_I(vol->vol_ino)); | 1510 | unmap_mft_record(NTFS_I(vol->vol_ino)); |
1491 | printk(KERN_INFO "NTFS volume version %i.%i.\n", vol->major_ver, | 1511 | printk(KERN_INFO "NTFS volume version %i.%i.\n", vol->major_ver, |
1492 | vol->minor_ver); | 1512 | vol->minor_ver); |
1513 | if (vol->major_ver < 3 && NVolSparseEnabled(vol)) { | ||
1514 | ntfs_warning(vol->sb, "Disabling sparse support due to NTFS " | ||
1515 | "volume version %i.%i (need at least version " | ||
1516 | "3.0).", vol->major_ver, vol->minor_ver); | ||
1517 | NVolClearSparseEnabled(vol); | ||
1518 | } | ||
1493 | #ifdef NTFS_RW | 1519 | #ifdef NTFS_RW |
1494 | /* Make sure that no unsupported volume flags are set. */ | 1520 | /* Make sure that no unsupported volume flags are set. */ |
1495 | if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) { | 1521 | if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) { |
@@ -2033,7 +2059,7 @@ static s64 get_nr_free_clusters(ntfs_volume *vol) | |||
2033 | /** | 2059 | /** |
2034 | * __get_nr_free_mft_records - return the number of free inodes on a volume | 2060 | * __get_nr_free_mft_records - return the number of free inodes on a volume |
2035 | * @vol: ntfs volume for which to obtain free inode count | 2061 | * @vol: ntfs volume for which to obtain free inode count |
2036 | * @nr_free: number of mft records in file system | 2062 | * @nr_free: number of mft records in filesystem |
2037 | * @max_index: maximum number of pages containing set bits | 2063 | * @max_index: maximum number of pages containing set bits |
2038 | * | 2064 | * |
2039 | * Calculate the number of free mft records (inodes) on the mounted NTFS | 2065 | * Calculate the number of free mft records (inodes) on the mounted NTFS |
@@ -2138,13 +2164,13 @@ static int ntfs_statfs(struct super_block *sb, struct kstatfs *sfs) | |||
2138 | /* Optimal transfer block size. */ | 2164 | /* Optimal transfer block size. */ |
2139 | sfs->f_bsize = PAGE_CACHE_SIZE; | 2165 | sfs->f_bsize = PAGE_CACHE_SIZE; |
2140 | /* | 2166 | /* |
2141 | * Total data blocks in file system in units of f_bsize and since | 2167 | * Total data blocks in filesystem in units of f_bsize and since |
2142 | * inodes are also stored in data blocs ($MFT is a file) this is just | 2168 | * inodes are also stored in data blocs ($MFT is a file) this is just |
2143 | * the total clusters. | 2169 | * the total clusters. |
2144 | */ | 2170 | */ |
2145 | sfs->f_blocks = vol->nr_clusters << vol->cluster_size_bits >> | 2171 | sfs->f_blocks = vol->nr_clusters << vol->cluster_size_bits >> |
2146 | PAGE_CACHE_SHIFT; | 2172 | PAGE_CACHE_SHIFT; |
2147 | /* Free data blocks in file system in units of f_bsize. */ | 2173 | /* Free data blocks in filesystem in units of f_bsize. */ |
2148 | size = get_nr_free_clusters(vol) << vol->cluster_size_bits >> | 2174 | size = get_nr_free_clusters(vol) << vol->cluster_size_bits >> |
2149 | PAGE_CACHE_SHIFT; | 2175 | PAGE_CACHE_SHIFT; |
2150 | if (size < 0LL) | 2176 | if (size < 0LL) |
@@ -2163,7 +2189,7 @@ static int ntfs_statfs(struct super_block *sb, struct kstatfs *sfs) | |||
2163 | max_index = ((((mft_ni->initialized_size >> vol->mft_record_size_bits) | 2189 | max_index = ((((mft_ni->initialized_size >> vol->mft_record_size_bits) |
2164 | + 7) >> 3) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | 2190 | + 7) >> 3) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; |
2165 | read_unlock_irqrestore(&mft_ni->size_lock, flags); | 2191 | read_unlock_irqrestore(&mft_ni->size_lock, flags); |
2166 | /* Number of inodes in file system (at this point in time). */ | 2192 | /* Number of inodes in filesystem (at this point in time). */ |
2167 | sfs->f_files = size; | 2193 | sfs->f_files = size; |
2168 | /* Free inodes in fs (based on current total count). */ | 2194 | /* Free inodes in fs (based on current total count). */ |
2169 | sfs->f_ffree = __get_nr_free_mft_records(vol, size, max_index); | 2195 | sfs->f_ffree = __get_nr_free_mft_records(vol, size, max_index); |
@@ -2172,8 +2198,8 @@ static int ntfs_statfs(struct super_block *sb, struct kstatfs *sfs) | |||
2172 | * File system id. This is extremely *nix flavour dependent and even | 2198 | * File system id. This is extremely *nix flavour dependent and even |
2173 | * within Linux itself all fs do their own thing. I interpret this to | 2199 | * within Linux itself all fs do their own thing. I interpret this to |
2174 | * mean a unique id associated with the mounted fs and not the id | 2200 | * mean a unique id associated with the mounted fs and not the id |
2175 | * associated with the file system driver, the latter is already given | 2201 | * associated with the filesystem driver, the latter is already given |
2176 | * by the file system type in sfs->f_type. Thus we use the 64-bit | 2202 | * by the filesystem type in sfs->f_type. Thus we use the 64-bit |
2177 | * volume serial number splitting it into two 32-bit parts. We enter | 2203 | * volume serial number splitting it into two 32-bit parts. We enter |
2178 | * the least significant 32-bits in f_fsid[0] and the most significant | 2204 | * the least significant 32-bits in f_fsid[0] and the most significant |
2179 | * 32-bits in f_fsid[1]. | 2205 | * 32-bits in f_fsid[1]. |
@@ -2259,18 +2285,18 @@ static struct export_operations ntfs_export_ops = { | |||
2259 | }; | 2285 | }; |
2260 | 2286 | ||
2261 | /** | 2287 | /** |
2262 | * ntfs_fill_super - mount an ntfs files system | 2288 | * ntfs_fill_super - mount an ntfs filesystem |
2263 | * @sb: super block of ntfs file system to mount | 2289 | * @sb: super block of ntfs filesystem to mount |
2264 | * @opt: string containing the mount options | 2290 | * @opt: string containing the mount options |
2265 | * @silent: silence error output | 2291 | * @silent: silence error output |
2266 | * | 2292 | * |
2267 | * ntfs_fill_super() is called by the VFS to mount the device described by @sb | 2293 | * ntfs_fill_super() is called by the VFS to mount the device described by @sb |
2268 | * with the mount otions in @data with the NTFS file system. | 2294 | * with the mount otions in @data with the NTFS filesystem. |
2269 | * | 2295 | * |
2270 | * If @silent is true, remain silent even if errors are detected. This is used | 2296 | * If @silent is true, remain silent even if errors are detected. This is used |
2271 | * during bootup, when the kernel tries to mount the root file system with all | 2297 | * during bootup, when the kernel tries to mount the root filesystem with all |
2272 | * registered file systems one after the other until one succeeds. This implies | 2298 | * registered filesystems one after the other until one succeeds. This implies |
2273 | * that all file systems except the correct one will quite correctly and | 2299 | * that all filesystems except the correct one will quite correctly and |
2274 | * expectedly return an error, but nobody wants to see error messages when in | 2300 | * expectedly return an error, but nobody wants to see error messages when in |
2275 | * fact this is what is supposed to happen. | 2301 | * fact this is what is supposed to happen. |
2276 | * | 2302 | * |
@@ -2330,6 +2356,9 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) | |||
2330 | 2356 | ||
2331 | unlock_kernel(); | 2357 | unlock_kernel(); |
2332 | 2358 | ||
2359 | /* By default, enable sparse support. */ | ||
2360 | NVolSetSparseEnabled(vol); | ||
2361 | |||
2333 | /* Important to get the mount options dealt with now. */ | 2362 | /* Important to get the mount options dealt with now. */ |
2334 | if (!parse_options(vol, (char*)opt)) | 2363 | if (!parse_options(vol, (char*)opt)) |
2335 | goto err_out_now; | 2364 | goto err_out_now; |
@@ -2711,7 +2740,7 @@ static int __init init_ntfs_fs(void) | |||
2711 | ntfs_debug("NTFS driver registered successfully."); | 2740 | ntfs_debug("NTFS driver registered successfully."); |
2712 | return 0; /* Success! */ | 2741 | return 0; /* Success! */ |
2713 | } | 2742 | } |
2714 | printk(KERN_CRIT "NTFS: Failed to register NTFS file system driver!\n"); | 2743 | printk(KERN_CRIT "NTFS: Failed to register NTFS filesystem driver!\n"); |
2715 | 2744 | ||
2716 | sysctl_err_out: | 2745 | sysctl_err_out: |
2717 | kmem_cache_destroy(ntfs_big_inode_cache); | 2746 | kmem_cache_destroy(ntfs_big_inode_cache); |
@@ -2725,7 +2754,7 @@ actx_err_out: | |||
2725 | kmem_cache_destroy(ntfs_index_ctx_cache); | 2754 | kmem_cache_destroy(ntfs_index_ctx_cache); |
2726 | ictx_err_out: | 2755 | ictx_err_out: |
2727 | if (!err) { | 2756 | if (!err) { |
2728 | printk(KERN_CRIT "NTFS: Aborting NTFS file system driver " | 2757 | printk(KERN_CRIT "NTFS: Aborting NTFS filesystem driver " |
2729 | "registration...\n"); | 2758 | "registration...\n"); |
2730 | err = -ENOMEM; | 2759 | err = -ENOMEM; |
2731 | } | 2760 | } |
@@ -2765,7 +2794,7 @@ static void __exit exit_ntfs_fs(void) | |||
2765 | } | 2794 | } |
2766 | 2795 | ||
2767 | MODULE_AUTHOR("Anton Altaparmakov <aia21@cantab.net>"); | 2796 | MODULE_AUTHOR("Anton Altaparmakov <aia21@cantab.net>"); |
2768 | MODULE_DESCRIPTION("NTFS 1.2/3.x driver - Copyright (c) 2001-2004 Anton Altaparmakov"); | 2797 | MODULE_DESCRIPTION("NTFS 1.2/3.x driver - Copyright (c) 2001-2005 Anton Altaparmakov"); |
2769 | MODULE_VERSION(NTFS_VERSION); | 2798 | MODULE_VERSION(NTFS_VERSION); |
2770 | MODULE_LICENSE("GPL"); | 2799 | MODULE_LICENSE("GPL"); |
2771 | #ifdef DEBUG | 2800 | #ifdef DEBUG |
diff --git a/fs/ntfs/sysctl.c b/fs/ntfs/sysctl.c index 75067e4f3036..1c23138d00b3 100644 --- a/fs/ntfs/sysctl.c +++ b/fs/ntfs/sysctl.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * the Linux-NTFS project. Adapted from the old NTFS driver, | 3 | * the Linux-NTFS project. Adapted from the old NTFS driver, |
4 | * Copyright (C) 1997 Martin von Löwis, Régis Duchesne | 4 | * Copyright (C) 1997 Martin von Löwis, Régis Duchesne |
5 | * | 5 | * |
6 | * Copyright (c) 2002-2004 Anton Altaparmakov | 6 | * Copyright (c) 2002-2005 Anton Altaparmakov |
7 | * | 7 | * |
8 | * This program/include file is free software; you can redistribute it and/or | 8 | * This program/include file is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License as published | 9 | * modify it under the terms of the GNU General Public License as published |
@@ -67,7 +67,7 @@ int ntfs_sysctl(int add) | |||
67 | return -ENOMEM; | 67 | return -ENOMEM; |
68 | #ifdef CONFIG_PROC_FS | 68 | #ifdef CONFIG_PROC_FS |
69 | /* | 69 | /* |
70 | * If the proc file system is in use and we are a module, need | 70 | * If the proc filesystem is in use and we are a module, need |
71 | * to set the owner of our proc entry to our module. In the | 71 | * to set the owner of our proc entry to our module. In the |
72 | * non-modular case, THIS_MODULE is NULL, so this is ok. | 72 | * non-modular case, THIS_MODULE is NULL, so this is ok. |
73 | */ | 73 | */ |
diff --git a/fs/ntfs/volume.h b/fs/ntfs/volume.h index 4b97fa8635a8..62be73ad0156 100644 --- a/fs/ntfs/volume.h +++ b/fs/ntfs/volume.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * volume.h - Defines for volume structures in NTFS Linux kernel driver. Part | 2 | * volume.h - Defines for volume structures in NTFS Linux kernel driver. Part |
3 | * of the Linux-NTFS project. | 3 | * of the Linux-NTFS project. |
4 | * | 4 | * |
5 | * Copyright (c) 2001-2004 Anton Altaparmakov | 5 | * Copyright (c) 2001-2005 Anton Altaparmakov |
6 | * Copyright (c) 2002 Richard Russon | 6 | * Copyright (c) 2002 Richard Russon |
7 | * | 7 | * |
8 | * This program/include file is free software; you can redistribute it and/or | 8 | * This program/include file is free software; you can redistribute it and/or |
@@ -54,7 +54,7 @@ typedef struct { | |||
54 | mode_t dmask; /* The mask for directory | 54 | mode_t dmask; /* The mask for directory |
55 | permissions. */ | 55 | permissions. */ |
56 | u8 mft_zone_multiplier; /* Initial mft zone multiplier. */ | 56 | u8 mft_zone_multiplier; /* Initial mft zone multiplier. */ |
57 | u8 on_errors; /* What to do on file system errors. */ | 57 | u8 on_errors; /* What to do on filesystem errors. */ |
58 | /* NTFS bootsector provided information. */ | 58 | /* NTFS bootsector provided information. */ |
59 | u16 sector_size; /* in bytes */ | 59 | u16 sector_size; /* in bytes */ |
60 | u8 sector_size_bits; /* log2(sector_size) */ | 60 | u8 sector_size_bits; /* log2(sector_size) */ |
@@ -141,6 +141,7 @@ typedef enum { | |||
141 | file names in WIN32 namespace. */ | 141 | file names in WIN32 namespace. */ |
142 | NV_LogFileEmpty, /* 1: $LogFile journal is empty. */ | 142 | NV_LogFileEmpty, /* 1: $LogFile journal is empty. */ |
143 | NV_QuotaOutOfDate, /* 1: $Quota is out of date. */ | 143 | NV_QuotaOutOfDate, /* 1: $Quota is out of date. */ |
144 | NV_SparseEnabled, /* 1: May create sparse files. */ | ||
144 | } ntfs_volume_flags; | 145 | } ntfs_volume_flags; |
145 | 146 | ||
146 | /* | 147 | /* |
@@ -167,5 +168,6 @@ NVOL_FNS(ShowSystemFiles) | |||
167 | NVOL_FNS(CaseSensitive) | 168 | NVOL_FNS(CaseSensitive) |
168 | NVOL_FNS(LogFileEmpty) | 169 | NVOL_FNS(LogFileEmpty) |
169 | NVOL_FNS(QuotaOutOfDate) | 170 | NVOL_FNS(QuotaOutOfDate) |
171 | NVOL_FNS(SparseEnabled) | ||
170 | 172 | ||
171 | #endif /* _LINUX_NTFS_VOLUME_H */ | 173 | #endif /* _LINUX_NTFS_VOLUME_H */ |