mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 03:06:10 +00:00
Merge git://git.kernel.org/pub/scm/linux/kernel/git/hirofumi/fatfs-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/hirofumi/fatfs-2.6: fat: make discard a mount option
This commit is contained in:
commit
337e4a1ab4
3 changed files with 23 additions and 11 deletions
|
@ -44,7 +44,8 @@ struct fat_mount_options {
|
||||||
nocase:1, /* Does this need case conversion? 0=need case conversion*/
|
nocase:1, /* Does this need case conversion? 0=need case conversion*/
|
||||||
usefree:1, /* Use free_clusters for FAT32 */
|
usefree:1, /* Use free_clusters for FAT32 */
|
||||||
tz_utc:1, /* Filesystem timestamps are in UTC */
|
tz_utc:1, /* Filesystem timestamps are in UTC */
|
||||||
rodir:1; /* allow ATTR_RO for directory */
|
rodir:1, /* allow ATTR_RO for directory */
|
||||||
|
discard:1; /* Issue discard requests on deletions */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FAT_HASH_BITS 8
|
#define FAT_HASH_BITS 8
|
||||||
|
|
|
@ -566,16 +566,21 @@ int fat_free_clusters(struct inode *inode, int cluster)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
if (sbi->options.discard) {
|
||||||
* Issue discard for the sectors we no longer care about,
|
/*
|
||||||
* batching contiguous clusters into one request
|
* Issue discard for the sectors we no longer
|
||||||
*/
|
* care about, batching contiguous clusters
|
||||||
if (cluster != fatent.entry + 1) {
|
* into one request
|
||||||
int nr_clus = fatent.entry - first_cl + 1;
|
*/
|
||||||
|
if (cluster != fatent.entry + 1) {
|
||||||
|
int nr_clus = fatent.entry - first_cl + 1;
|
||||||
|
|
||||||
sb_issue_discard(sb, fat_clus_to_blknr(sbi, first_cl),
|
sb_issue_discard(sb,
|
||||||
nr_clus * sbi->sec_per_clus);
|
fat_clus_to_blknr(sbi, first_cl),
|
||||||
first_cl = cluster;
|
nr_clus * sbi->sec_per_clus);
|
||||||
|
|
||||||
|
first_cl = cluster;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ops->ent_put(&fatent, FAT_ENT_FREE);
|
ops->ent_put(&fatent, FAT_ENT_FREE);
|
||||||
|
|
|
@ -858,6 +858,8 @@ static int fat_show_options(struct seq_file *m, struct vfsmount *mnt)
|
||||||
seq_puts(m, ",errors=panic");
|
seq_puts(m, ",errors=panic");
|
||||||
else
|
else
|
||||||
seq_puts(m, ",errors=remount-ro");
|
seq_puts(m, ",errors=remount-ro");
|
||||||
|
if (opts->discard)
|
||||||
|
seq_puts(m, ",discard");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -871,7 +873,7 @@ enum {
|
||||||
Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes,
|
Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes,
|
||||||
Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes,
|
Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes,
|
||||||
Opt_obsolate, Opt_flush, Opt_tz_utc, Opt_rodir, Opt_err_cont,
|
Opt_obsolate, Opt_flush, Opt_tz_utc, Opt_rodir, Opt_err_cont,
|
||||||
Opt_err_panic, Opt_err_ro, Opt_err,
|
Opt_err_panic, Opt_err_ro, Opt_discard, Opt_err,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const match_table_t fat_tokens = {
|
static const match_table_t fat_tokens = {
|
||||||
|
@ -899,6 +901,7 @@ static const match_table_t fat_tokens = {
|
||||||
{Opt_err_cont, "errors=continue"},
|
{Opt_err_cont, "errors=continue"},
|
||||||
{Opt_err_panic, "errors=panic"},
|
{Opt_err_panic, "errors=panic"},
|
||||||
{Opt_err_ro, "errors=remount-ro"},
|
{Opt_err_ro, "errors=remount-ro"},
|
||||||
|
{Opt_discard, "discard"},
|
||||||
{Opt_obsolate, "conv=binary"},
|
{Opt_obsolate, "conv=binary"},
|
||||||
{Opt_obsolate, "conv=text"},
|
{Opt_obsolate, "conv=text"},
|
||||||
{Opt_obsolate, "conv=auto"},
|
{Opt_obsolate, "conv=auto"},
|
||||||
|
@ -1136,6 +1139,9 @@ static int parse_options(char *options, int is_vfat, int silent, int *debug,
|
||||||
case Opt_rodir:
|
case Opt_rodir:
|
||||||
opts->rodir = 1;
|
opts->rodir = 1;
|
||||||
break;
|
break;
|
||||||
|
case Opt_discard:
|
||||||
|
opts->discard = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
/* obsolete mount options */
|
/* obsolete mount options */
|
||||||
case Opt_obsolate:
|
case Opt_obsolate:
|
||||||
|
|
Loading…
Reference in a new issue