diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 10:29:26 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 10:29:26 -0800 |
commit | 337e4a1ab4d736b8c39a4c3a233ac21f1a6c036f (patch) | |
tree | 20c58600b42600b8f62f3cfb63fc62b1a7fbc78c /fs/fat/fatent.c | |
parent | 7949456b1b96924c2d9ae5aea5fa7d4c81c946ed (diff) | |
parent | 681142f9211b23e6aa2984259d38b76d7bdc05a8 (diff) |
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
Diffstat (limited to 'fs/fat/fatent.c')
-rw-r--r-- | fs/fat/fatent.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c index a81037721a6..81184d3b75a 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); |