From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: discard and barriers Date: Mon, 16 Aug 2010 13:26:15 +0200 Message-ID: <20100816112615.GA10273@lst.de> References: <20100814115625.GA15902@lst.de> <20100814141451.GB14960@thunk.org> <20100814145210.GA23126@lst.de> <1281951711.2500.25.camel@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Christoph Hellwig , "Ted Ts'o" , hughd@google.com, hirofumi@mail.parknet.co.jp, chris.mason@oracle.com, linux-fsdevel@vger.kernel.org, jaxboe@fusionio.com, martin.petersen@oracle.com To: Steven Whitehouse Return-path: Received: from verein.lst.de ([213.95.11.210]:59408 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752408Ab0HPL0n (ORCPT ); Mon, 16 Aug 2010 07:26:43 -0400 Content-Disposition: inline In-Reply-To: <1281951711.2500.25.camel@localhost> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, Aug 16, 2010 at 10:41:51AM +0100, Steven Whitehouse wrote: > GFS2 has a similar concept, which compares two bit maps to generate the > extent list to generate the discards. This is done after each resource > group has been committed to the journal, and just before the resource > group bitmap is updated with the newly freed blocks (and marked dirty). > > Any remote node wanting to use that new space will cause a further > journal flush when it requests the resource group lock (as well as in > place write back of that resource group, of course). > > If the local node wants to reuse the recently freed space, then that can > happen as soon as the log commit has finished, so in this case the > barrier and the waiting are required. I don't think you need the barrier for that. The wait means the discard has finished, and from that point writes to the blocks discarded are safe. There's no need to flush the volatile write cache after a discard either. The big question is if you need the drain before the discard. Given that you did a log commit before I suspect not as the log commit waits on all I/Os related to this commit.