From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932879AbbHIGoo (ORCPT ); Sun, 9 Aug 2015 02:44:44 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:46451 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754314AbbHIGol (ORCPT ); Sun, 9 Aug 2015 02:44:41 -0400 Date: Sat, 8 Aug 2015 23:44:39 -0700 From: Christoph Hellwig To: Ming Lei Cc: Christoph Hellwig , Jens Axboe , Linux Kernel Mailing List , Dave Kleikamp , Zach Brown , Maxim Patlasov , Andrew Morton , Alexander Viro , Tejun Heo , Dave Chinner Subject: Re: [PATCH v9 6/6] block: loop: support DIO & AIO Message-ID: <20150809064439.GC2436@infradead.org> References: <1438850538-15682-1-git-send-email-ming.lei@canonical.com> <1438850538-15682-7-git-send-email-ming.lei@canonical.com> <20150807074342.GA30547@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 07, 2015 at 04:25:52AM -0400, Ming Lei wrote: > On Fri, Aug 7, 2015 at 3:43 AM, Christoph Hellwig wrote: > > I really disagree with the per-cmd use_dio tracking. > > Could you explain it in a bit? > > > > > If we know at setup time that the loop device sector size is smaller > > than the sector size of the underlying device we should never allow > > dio, and othewise it should always work for data. > > Yes, that is just what I did in v7, and we can only do dio in case > of 512 byte sector size of backing device(not considering the > following patches from Hannes). > > When sector size of backing device isn't 512, most of transfer(buffered I/O > and normal dio) is still 4k aligned, that is why I suggest to use per-cmd > use_dio tracking. > > The patch avoids the race between buffered io and dio, doesn't it? > The introduced cost is trivial and most of times it needn't to wait for > completion of pending dio. All block filesystems can do direct I/O on a _sector size_, not _block size_ boundary, e.g. for the typical setup of a 4k block size xfs/btrfs/ext4 file system on a 512 byte sector device you can do 512 byte aligned direct I/O. > > is no need for draining or mode checking for an fsync - FLUSH is always > > only guranteed to flush out I/O that has completed by the time it's > > issued. > > Could you point it out in the patch? Basically your lo_drain_pending_dio() functionality is not needed.