From: Christoph Hellwig <hch@lst.de>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH] fat: make discard a mount option
Date: Wed, 18 Nov 2009 18:08:41 +0100 [thread overview]
Message-ID: <20091118170841.GA25541@lst.de> (raw)
Currently shipping discard capable SSDs and arrays have rather sub-optimal
implementations of the command and can the use of it can cause massive
slowdowns. Make issueing these commands option as it's already in btrfs
and gfs2.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: linux-2.6/fs/fat/fat.h
===================================================================
--- linux-2.6.orig/fs/fat/fat.h 2009-11-18 13:47:49.380003970 +0100
+++ linux-2.6/fs/fat/fat.h 2009-11-18 13:48:13.169014622 +0100
@@ -44,7 +44,8 @@ struct fat_mount_options {
nocase:1, /* Does this need case conversion? 0=need case conversion*/
usefree:1, /* Use free_clusters for FAT32 */
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
Index: linux-2.6/fs/fat/fatent.c
===================================================================
--- linux-2.6.orig/fs/fat/fatent.c 2009-11-18 13:48:24.102254108 +0100
+++ linux-2.6/fs/fat/fatent.c 2009-11-18 13:49:14.338033708 +0100
@@ -573,8 +573,11 @@ int fat_free_clusters(struct inode *inod
if (cluster != fatent.entry + 1) {
int nr_clus = fatent.entry - first_cl + 1;
- sb_issue_discard(sb, fat_clus_to_blknr(sbi, first_cl),
- nr_clus * sbi->sec_per_clus);
+ if (sbi->options.discard) {
+ sb_issue_discard(sb,
+ fat_clus_to_blknr(sbi, first_cl),
+ nr_clus * sbi->sec_per_clus);
+ }
first_cl = cluster;
}
Index: linux-2.6/fs/fat/inode.c
===================================================================
--- linux-2.6.orig/fs/fat/inode.c 2009-11-18 13:46:40.484256340 +0100
+++ linux-2.6/fs/fat/inode.c 2009-11-18 13:47:39.457256306 +0100
@@ -871,7 +871,7 @@ enum {
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_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 = {
@@ -910,6 +910,7 @@ static const match_table_t fat_tokens =
{Opt_obsolate, "cvf_format=%20s"},
{Opt_obsolate, "cvf_options=%100s"},
{Opt_obsolate, "posix"},
+ {Opt_discard, "discard"},
{Opt_err, NULL},
};
static const match_table_t msdos_tokens = {
@@ -1136,6 +1137,9 @@ static int parse_options(char *options,
case Opt_rodir:
opts->rodir = 1;
break;
+ case Opt_discard:
+ opts->discard = 1;
+ break;
/* obsolete mount options */
case Opt_obsolate:
next reply other threads:[~2009-11-18 17:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-18 17:08 Christoph Hellwig [this message]
2009-11-18 18:38 ` [PATCH] fat: make discard a mount option OGAWA Hirofumi
2009-11-18 18:53 ` Christoph Hellwig
2009-11-18 19:09 ` OGAWA Hirofumi
2009-11-18 19:15 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091118170841.GA25541@lst.de \
--to=hch@lst.de \
--cc=hirofumi@mail.parknet.co.jp \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.