aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/filesystems/vfat.txt7
-rw-r--r--fs/fat/inode.c14
-rw-r--r--include/linux/msdos_fs.h3
3 files changed, 20 insertions, 4 deletions
diff --git a/Documentation/filesystems/vfat.txt b/Documentation/filesystems/vfat.txt
index 069cb1094300..fcc123ffa252 100644
--- a/Documentation/filesystems/vfat.txt
+++ b/Documentation/filesystems/vfat.txt
@@ -57,6 +57,13 @@ nonumtail=<bool> -- When creating 8.3 aliases, normally the alias will
57 currently exist in the directory, 'longfile.txt' will 57 currently exist in the directory, 'longfile.txt' will
58 be the short alias instead of 'longfi~1.txt'. 58 be the short alias instead of 'longfi~1.txt'.
59 59
60usefree -- Use the "free clusters" value stored on FSINFO. It'll
61 be used to determine number of free clusters without
62 scanning disk. But it's not used by default, because
63 recent Windows don't update it correctly in some
64 case. If you are sure the "free clusters" on FSINFO is
65 correct, by this option you can avoid scanning disk.
66
60quiet -- Stops printing certain warning messages. 67quiet -- Stops printing certain warning messages.
61 68
62check=s|r|n -- Case sensitivity checking setting. 69check=s|r|n -- Case sensitivity checking setting.
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index a8129e82d594..2c55e8dce793 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -825,6 +825,8 @@ static int fat_show_options(struct seq_file *m, struct vfsmount *mnt)
825 } 825 }
826 if (opts->name_check != 'n') 826 if (opts->name_check != 'n')
827 seq_printf(m, ",check=%c", opts->name_check); 827 seq_printf(m, ",check=%c", opts->name_check);
828 if (opts->usefree)
829 seq_puts(m, ",usefree");
828 if (opts->quiet) 830 if (opts->quiet)
829 seq_puts(m, ",quiet"); 831 seq_puts(m, ",quiet");
830 if (opts->showexec) 832 if (opts->showexec)
@@ -850,7 +852,7 @@ static int fat_show_options(struct seq_file *m, struct vfsmount *mnt)
850 852
851enum { 853enum {
852 Opt_check_n, Opt_check_r, Opt_check_s, Opt_uid, Opt_gid, 854 Opt_check_n, Opt_check_r, Opt_check_s, Opt_uid, Opt_gid,
853 Opt_umask, Opt_dmask, Opt_fmask, Opt_codepage, Opt_nocase, 855 Opt_umask, Opt_dmask, Opt_fmask, Opt_codepage, Opt_usefree, Opt_nocase,
854 Opt_quiet, Opt_showexec, Opt_debug, Opt_immutable, 856 Opt_quiet, Opt_showexec, Opt_debug, Opt_immutable,
855 Opt_dots, Opt_nodots, 857 Opt_dots, Opt_nodots,
856 Opt_charset, Opt_shortname_lower, Opt_shortname_win95, 858 Opt_charset, Opt_shortname_lower, Opt_shortname_win95,
@@ -872,6 +874,7 @@ static match_table_t fat_tokens = {
872 {Opt_dmask, "dmask=%o"}, 874 {Opt_dmask, "dmask=%o"},
873 {Opt_fmask, "fmask=%o"}, 875 {Opt_fmask, "fmask=%o"},
874 {Opt_codepage, "codepage=%u"}, 876 {Opt_codepage, "codepage=%u"},
877 {Opt_usefree, "usefree"},
875 {Opt_nocase, "nocase"}, 878 {Opt_nocase, "nocase"},
876 {Opt_quiet, "quiet"}, 879 {Opt_quiet, "quiet"},
877 {Opt_showexec, "showexec"}, 880 {Opt_showexec, "showexec"},
@@ -951,7 +954,7 @@ static int parse_options(char *options, int is_vfat, int silent, int *debug,
951 opts->quiet = opts->showexec = opts->sys_immutable = opts->dotsOK = 0; 954 opts->quiet = opts->showexec = opts->sys_immutable = opts->dotsOK = 0;
952 opts->utf8 = opts->unicode_xlate = 0; 955 opts->utf8 = opts->unicode_xlate = 0;
953 opts->numtail = 1; 956 opts->numtail = 1;
954 opts->nocase = 0; 957 opts->usefree = opts->nocase = 0;
955 *debug = 0; 958 *debug = 0;
956 959
957 if (!options) 960 if (!options)
@@ -979,6 +982,9 @@ static int parse_options(char *options, int is_vfat, int silent, int *debug,
979 case Opt_check_n: 982 case Opt_check_n:
980 opts->name_check = 'n'; 983 opts->name_check = 'n';
981 break; 984 break;
985 case Opt_usefree:
986 opts->usefree = 1;
987 break;
982 case Opt_nocase: 988 case Opt_nocase:
983 if (!is_vfat) 989 if (!is_vfat)
984 opts->nocase = 1; 990 opts->nocase = 1;
@@ -1304,7 +1310,9 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
1304 le32_to_cpu(fsinfo->signature2), 1310 le32_to_cpu(fsinfo->signature2),
1305 sbi->fsinfo_sector); 1311 sbi->fsinfo_sector);
1306 } else { 1312 } else {
1307 sbi->free_clusters = le32_to_cpu(fsinfo->free_clusters); 1313 if (sbi->options.usefree)
1314 sbi->free_clusters =
1315 le32_to_cpu(fsinfo->free_clusters);
1308 sbi->prev_free = le32_to_cpu(fsinfo->next_cluster); 1316 sbi->prev_free = le32_to_cpu(fsinfo->next_cluster);
1309 } 1317 }
1310 1318
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index fa253fa73aa3..0e09c005dda8 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -205,7 +205,8 @@ struct fat_mount_options {
205 numtail:1, /* Does first alias have a numeric '~1' type tail? */ 205 numtail:1, /* Does first alias have a numeric '~1' type tail? */
206 atari:1, /* Use Atari GEMDOS variation of MS-DOS fs */ 206 atari:1, /* Use Atari GEMDOS variation of MS-DOS fs */
207 flush:1, /* write things quickly */ 207 flush:1, /* write things quickly */
208 nocase:1; /* Does this need case conversion? 0=need case conversion*/ 208 nocase:1, /* Does this need case conversion? 0=need case conversion*/
209 usefree:1; /* Use free_clusters for FAT32 */
209}; 210};
210 211
211#define FAT_HASH_BITS 8 212#define FAT_HASH_BITS 8