From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Woodhouse Subject: [PATCH 2/5] [FAT] Let the block device know when sectors can be discarded Date: Wed, 06 Aug 2008 10:25:20 +0100 Message-ID: <1218014720.5111.37.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> 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 To: Jens Axboe , hirofumi@mail.parknet.co.jp Return-path: Received: from bombadil.infradead.org ([18.85.46.34]:41180 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754979AbYHFKie (ORCPT ); Wed, 6 Aug 2008 06:38:34 -0400 In-Reply-To: <1217957140.3454.800.camel@pmac.infradead.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Signed-off-by: David Woodhouse --- fs/fat/fatent.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c index 302e95c..5970fd6 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 *); @@ -540,6 +541,11 @@ int fat_free_clusters(struct inode *inode, int cluster) fatent_init(&fatent); lock_fat(sbi); do { + /* Issue discard for the sectors we no longer care about */ + blkdev_issue_discard(sb->s_bdev, + fat_clus_to_blknr(sbi, cluster), + sbi->sec_per_clus, NULL); + cluster = fat_ent_read(inode, &fatent, cluster); if (cluster < 0) { err = cluster; -- 1.5.5.1 -- David Woodhouse Open Source Technology Centre David.Woodhouse@intel.com Intel Corporation