From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Woodhouse Subject: [PATCH 2/5, v2] [FAT] Let the block device know when sectors can be discarded Date: Thu, 07 Aug 2008 17:33:22 +0100 Message-ID: <1218126802.12232.74.camel@pmac.infradead.org> References: <488B7281.4020007@gmail.com> <20080726130200.f541e604.akpm@linux-foundation.org> <1217900716.3454.667.camel@pmac.infradead.org> <20080805114210.GW20055@kernel.dk> <1217953741.3454.784.camel@pmac.infradead.org> <1217957140.3454.800.camel@pmac.infradead.org> <1218014720.5111.37.camel@pmac.infradead.org> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: hirofumi@mail.parknet.co.jp, Andrew Morton , Ric Wheeler , linux-fsdevel@vger.kernel.org, gilad@codefidence.com To: Jens Axboe Return-path: Received: from bombadil.infradead.org ([18.85.46.34]:34801 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752646AbYHGQdr (ORCPT ); Thu, 7 Aug 2008 12:33:47 -0400 In-Reply-To: <1218014720.5111.37.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