From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jens Axboe Subject: Re: [PATCH 1/5] [BLOCK] Add 'discard' request handling Date: Fri, 8 Aug 2008 13:20:44 +0200 Message-ID: <20080808112044.GQ20055@kernel.dk> References: <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> <1218014703.5111.35.camel@pmac.infradead.org> <20080807184155.GE20055@kernel.dk> <1218187995.12232.95.camel@pmac.infradead.org> <20080808103041.GM20055@kernel.dk> <20080808104937.GN20055@kernel.dk> <1218193485.12232.116.camel@pmac.infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Andrew Morton , Ric Wheeler , linux-fsdevel@vger.kernel.org, gilad@codefidence.com To: David Woodhouse Return-path: Received: from brick.kernel.dk ([87.55.233.238]:19926 "EHLO kernel.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754986AbYHHLUq (ORCPT ); Fri, 8 Aug 2008 07:20:46 -0400 Content-Disposition: inline In-Reply-To: <1218193485.12232.116.camel@pmac.infradead.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, Aug 08 2008, David Woodhouse wrote: > On Fri, 2008-08-08 at 12:49 +0200, Jens Axboe wrote: > > This is what I came up with. You don't need the request discard flag, > > since you are using a specific request type for this. Additionally, we > > can move the request init where it is done for fs requests > > (init_req_from_bio) and get it set there. > > Hmmm. (qv) > > > I also added the small bits for merging. > > Nice. I was _hoping_ it would be that easy, but didn't want to get > involved with that yet. One tweak we might want to make to that would be > to allow discard requests to be _dropped_ if there's a subsequent write > to the same sectors -- if we expect it to be common that we deallocate > sectors then re-use them again before the discard request hits the disk, > that might be an interesting optimisation. Merging should be fairly easy, for discarding discard (ahem) requests, you would need to check for overlap. The merging doesn't do that, it'll only look for boundary matches. So it would require some extra logic and either runtime cost and/or an additional data structure to track that. -- Jens Axboe