From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tejun Heo Subject: Re: [PATCH 02/41] block/loop: queue ordered mode should be DRAIN_FLUSH Date: Sun, 12 Sep 2010 13:41:04 +0200 Message-ID: <4C8CBC50.1070400@kernel.org> References: <1283509796-1510-1-git-send-email-tj@kernel.org> <1283509796-1510-3-git-send-email-tj@kernel.org> <4C8C9175.5030404@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org To: Tao Ma Return-path: Received: from hera.kernel.org ([140.211.167.34]:53585 "EHLO hera.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751658Ab0ILLlJ (ORCPT ); Sun, 12 Sep 2010 07:41:09 -0400 In-Reply-To: <4C8C9175.5030404@oracle.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hello, On 09/12/2010 10:38 AM, Tao Ma wrote: > According to Documentation/block/barrier.txt, > QUEUE_ORDERED_DRAIN > Requests are ordered by draining the request queue and cache > flushing isn't needed. > > Sequence: drain => barrier > > QUEUE_ORDERED_DRAIN_FLUSH > Requests are ordered by draining the request queue and both > pre-barrier and post-barrier cache flushings are needed. > > Sequence: drain => preflush => barrier => postflush > > And for loop device, it call fsync in barrier request. See do_bio_filebacked in drivers/block/loop.c > bool barrier = !!(bio->bi_rw & REQ_HARDBARRIER); > struct file *file = lo->lo_backing_file; > > if (barrier) { > if (unlikely(!file->f_op->fsync)) { > ret = -EOPNOTSUPP; > goto out; > } > > ret = vfs_fsync(file, 0); > if (unlikely(ret)) { > ret = -EIO; > goto out; > } > } > > So actually the sync is done in barrier and no extra flush is needed? > Or Do I misread the rules in barrier.txt? Hmmm... maybe the doc was a bit confusing. Any device which has writeback cache should have FLUSH in the queue ordered configuration. The loop device used vfs_fsync() for cache flushing and didn't support ordered sequence. As such, it should use draining for request ordering and suports FLUSH, so the mode to use is DRAIN_FLUSH. Thanks. -- tejun