From: OGAWA Hirofumi Subject: Re: [PATCH 2/5] [FAT] Let the block device know when sectors can be discarded Date: Thu, 07 Aug 2008 02:14:53 +0900 Message-ID: <87vdyeoyk2.fsf@devron.myhome.or.jp> 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> <873aliqepf.fsf@devron.myhome.or.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jens Axboe , Andrew Morton , Ric Wheeler , linux-fsdevel@vger.kernel.org, gilad@codefidence.com To: David Woodhouse Return-path: Received: from mail.parknet.ad.jp ([210.171.162.6]:44603 "EHLO mail.officemail.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754474AbYHFRO6 (ORCPT ); Wed, 6 Aug 2008 13:14:58 -0400 In-Reply-To: <873aliqepf.fsf@devron.myhome.or.jp> (OGAWA Hirofumi's message of "Thu, 07 Aug 2008 01:40:44 +0900") Sender: linux-fsdevel-owner@vger.kernel.org List-ID: OGAWA Hirofumi writes: > diff -puN fs/fat/fatent.c~test fs/fat/fatent.c > --- linux-2.6/fs/fat/fatent.c~test 2008-08-07 01:24:23.000000000 +0900 > +++ linux-2.6-hirofumi/fs/fat/fatent.c 2008-08-07 01:33:07.000000000 +0900 > @@ -551,6 +551,11 @@ int fat_free_clusters(struct inode *inod > goto error; > } > > + /* Issue discard for the sectors we no longer care about */ > + blkdev_issue_discard(sb->s_bdev, > + 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++; Ah, blkdev_issue_discard() assumes blocksize is 512bytes, um... blkdev_issue_discard() takes bytes, and instead add some helpers for sb or inode? -- OGAWA Hirofumi