From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751702AbbHIXlc (ORCPT ); Sun, 9 Aug 2015 19:41:32 -0400 Received: from ipmail06.adl6.internode.on.net ([150.101.137.145]:37078 "EHLO ipmail06.adl6.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750980AbbHIXl3 (ORCPT ); Sun, 9 Aug 2015 19:41:29 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2AVCQDr48dVPBkyLHldgxuBPYZSoxoBAQEBAQEGmzYCAgEBAoEfTQEBAQEBAQcBAQEBQT+EJAEBBDocIxAIAxgJJQ8FJQMHGhOILc0YAQEBBwIBHxmGBoUyhQkHgxiBFAWVC4xgmgCENSwzgkwBAQE Date: Mon, 10 Aug 2015 09:41:26 +1000 From: Dave Chinner To: Ming Lei Cc: Christoph Hellwig , Jens Axboe , Linux Kernel Mailing List , Dave Kleikamp , Zach Brown , Maxim Patlasov , Andrew Morton , Alexander Viro , Tejun Heo Subject: Re: [PATCH v9 6/6] block: loop: support DIO & AIO Message-ID: <20150809234126.GA906@dastard> 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> <20150809064439.GC2436@infradead.org> <20150809134404.GA7190@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 09, 2015 at 10:27:14AM -0400, Ming Lei wrote: > On Sun, Aug 9, 2015 at 9:44 AM, Christoph Hellwig wrote: > > On Sun, Aug 09, 2015 at 09:04:32AM -0400, Ming Lei wrote: > >> Now the logical block size of loop is 512byte, but the sector size of > >> backing device may be 4K, so we can't do 512 byte algined direct > >> I/O to the filesystem in this situation. > >> > >> With runtime switch to buffered I/O we can fix this problem, but > >> most of times it won't fall in this case. > > > > The right way to handle this case is to not allow direct I/O at all, > > you'll be constantly switching between direct and buffered I/O > > otherwise, which is a bad idea. > > In theory we should not allow dio for this case, but in reality, > as Dave Chinner mentioned, all buffered I/O and normal dio > are page aligned, so we can make most of sane applications > benefited from this patch, and for few insane applications, > frequent swich between buffered I/O and direct I/O shouldn't > be very bad too since draining dio is just like batched sync I/O. If Christoph thinks we should not allow this case, then go with what Christoph says. Cheers, Dave. -- Dave Chinner david@fromorbit.com