From 1244cca442a69b581db76afd9ed84c2c0ea4887d Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 5 Aug 2008 18:05:46 +0100 Subject: [PATCH] --- yaml --- r: 110448 b: refs/heads/master c: 8c540a96c175bdf55bda8707db04cec78b816454 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/fat/fatent.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index d9909af7d554..cae3ae162f9e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: fb2dce862d9f9a68e6b9374579056ec9eca02a63 +refs/heads/master: 8c540a96c175bdf55bda8707db04cec78b816454 diff --git a/trunk/fs/fat/fatent.c b/trunk/fs/fat/fatent.c index 302e95c4af7e..fb98b3d847ed 100644 --- a/trunk/fs/fat/fatent.c +++ b/trunk/fs/fat/fatent.c @@ -6,6 +6,7 @@ #include #include #include +#include struct fatent_operations { void (*ent_blocknr)(struct super_block *, int, int *, sector_t *); @@ -535,6 +536,7 @@ int fat_free_clusters(struct inode *inode, int cluster) struct fat_entry fatent; struct buffer_head *bhs[MAX_BUF_PER_PAGE]; int i, err, nr_bhs; + int first_cl = cluster; nr_bhs = 0; fatent_init(&fatent); @@ -551,6 +553,18 @@ 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; + } + ops->ent_put(&fatent, FAT_ENT_FREE); if (sbi->free_clusters != -1) { sbi->free_clusters++;