summaryrefslogtreecommitdiffstats
path: root/fs/fat/fatent.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2009-11-21 20:28:52 +0900
committerOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>2009-11-21 20:36:52 +0900
commit681142f9211b23e6aa2984259d38b76d7bdc05a8 (patch)
treecad526094c576b74eb12b0cdb1b497bbb4765128 /fs/fat/fatent.c
parenta8a8a669ea13d792296737505adc43ccacf3a648 (diff)
downloadop-kernel-dev-681142f9211b23e6aa2984259d38b76d7bdc05a8.zip
op-kernel-dev-681142f9211b23e6aa2984259d38b76d7bdc05a8.tar.gz
fat: make discard a mount option
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> [hirofumi@mail.parknet.co.jp: tweaks, and add "discard" to fat_show_options] Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Diffstat (limited to 'fs/fat/fatent.c')
-rw-r--r--fs/fat/fatent.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c
index a810377..81184d3 100644
--- a/fs/fat/fatent.c
+++ b/fs/fat/fatent.c
@@ -566,16 +566,21 @@ int fat_free_clusters(struct inode *inode, int cluster)
goto error;
}
- /*
- * Issue discard for the sectors we no longer care about,
- * batching contiguous clusters into one request
- */
- 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);
- first_cl = cluster;
+ if (sbi->options.discard) {
+ /*
+ * Issue discard for the sectors we no longer
+ * care about, batching contiguous clusters
+ * into one request
+ */
+ 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);
+
+ first_cl = cluster;
+ }
}
ops->ent_put(&fatent, FAT_ENT_FREE);
OpenPOWER on IntegriCloud