From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Woodhouse Subject: Re: [PATCH 0/7] Discard requests, v2 Date: Mon, 11 Aug 2008 14:17:34 +0100 Message-ID: <1218460654.2977.4.camel@pmac.infradead.org> References: <1218299181.26926.88.camel@pmac.infradead.org> <87abflrejb.fsf@devron.myhome.or.jp> <1218363946.5063.25.camel@pmac.infradead.org> <20080810163718.GA528@shareable.org> <871w0wrbzu.fsf@devron.myhome.or.jp> <1218398875.5063.53.camel@pmac.infradead.org> <87wsiopn0u.fsf@devron.myhome.or.jp> <1218447616.12956.3.camel@pmac.infradead.org> <87ej4vn904.fsf@devron.myhome.or.jp> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: Jamie Lokier , Jens Axboe , Andrew Morton , Ric Wheeler , linux-fsdevel@vger.kernel.org, gilad@codefidence.com, matthew@wil.cx To: OGAWA Hirofumi Return-path: Received: from bombadil.infradead.org ([18.85.46.34]:42894 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751681AbYHKNSj (ORCPT ); Mon, 11 Aug 2008 09:18:39 -0400 In-Reply-To: <87ej4vn904.fsf@devron.myhome.or.jp> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, 2008-08-11 at 19:25 +0900, OGAWA Hirofumi wrote: > David Woodhouse writes: > > >> [I don't know whether blkdev_issue_flush() > >> really want to use (1 << BIO_RW_BARRIER) or not.] > > > > I think it seems reasonable, but let's do it in a separate patch. Do you > > want me to put it in my tree, or will you send it to Jens directly? > > Thanks. Could you put it in your tree Will do. Can I have it with a signed-off-by? Now I'm happy that request merging works, I'll stress it a little less, too... diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c index a8b10ac..0942a54 100644 --- a/fs/fat/fatent.c +++ b/fs/fat/fatent.c @@ -536,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); @@ -552,9 +553,15 @@ 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); + /* 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, NULL); + first_cl = cluster; + } ops->ent_put(&fatent, FAT_ENT_FREE); if (sbi->free_clusters != -1) { -- David Woodhouse Open Source Technology Centre David.Woodhouse@intel.com Intel Corporation