From: David Woodhouse Subject: [PATCH 4/7] [FAT] Let the block device know when sectors can be discarded Date: Sat, 09 Aug 2008 17:31:31 +0100 Message-ID: <1218299491.26926.105.camel@pmac.infradead.org> References: <1218299181.26926.88.camel@pmac.infradead.org> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: Andrew Morton , Ric Wheeler , linux-fsdevel@vger.kernel.org, gilad@codefidence.com, matthew@wil.cx To: Jens Axboe Return-path: Received: from bombadil.infradead.org ([18.85.46.34]:35505 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751052AbYHIQbo (ORCPT ); Sat, 9 Aug 2008 12:31:44 -0400 In-Reply-To: <1218299181.26926.88.camel@pmac.infradead.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: [hirofumi@mail.parknet.co.jp: discard _after_ checking for corrupt chains] Signed-off-by: David Woodhouse Signed-off-by: OGAWA Hirofumi --- fs/fat/fatent.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c index 302e95c..a8b10ac 100644 --- a/fs/fat/fatent.c +++ b/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 *); @@ -551,6 +552,10 @@ int fat_free_clusters(struct inode *inode, int cluster) goto error; } + /* Issue discard for the sectors we no longer care about */ + sb_issue_discard(sb, fat_clus_to_blknr(sbi, fatent.entry), + sbi->sec_per_clus, NULL); + ops->ent_put(&fatent, FAT_ENT_FREE); if (sbi->free_clusters != -1) { sbi->free_clusters++; -- 1.5.5.1 -- David Woodhouse Open Source Technology Centre David.Woodhouse@intel.com Intel Corporation