Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754780AbbG0WG7 (ORCPT ); Mon, 27 Jul 2015 18:06:59 -0400 Received: from ipmail04.adl6.internode.on.net ([150.101.137.141]:63537 "EHLO ipmail04.adl6.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753391AbbG0WG5 (ORCPT ); Mon, 27 Jul 2015 18:06:57 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2D0CACqqrZVPG0mLHlbgxWBPYJVg3yiTwaaaQICAQECgUZNAQEBAQEBBwEBAQFAAT+EJAEBBCcTHCMQCAMYCSUPBSUDBxoTiC3RAwELAR8ZhgaFL4UHB4QsAQSUaYw/mSiBCoMrLDGCTAEBAQ Date: Tue, 28 Jul 2015 08:06:22 +1000 From: Dave Chinner To: Ming Lei Cc: Christoph Hellwig , Jens Axboe , Linux Kernel Mailing List , "Justin M. Forbes" , Jeff Moyer , Tejun Heo , linux-api@vger.kernel.org Subject: Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO Message-ID: <20150727220622.GJ3902@dastard> References: <1437061068-26118-1-git-send-email-ming.lei@canonical.com> <1437061068-26118-5-git-send-email-ming.lei@canonical.com> <20150727084020.GA28336@infradead.org> <20150727094530.GA15507@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 Content-Length: 1245 Lines: 33 On Mon, Jul 27, 2015 at 05:53:33AM -0400, Ming Lei wrote: > On Mon, Jul 27, 2015 at 5:45 AM, Christoph Hellwig wrote: > > On Mon, Jul 27, 2015 at 05:41:57AM -0400, Ming Lei wrote: > >> > Why the hardcoded value? I suspect this should be more like: > >> > > >> > if (dio && inode->i_sb->s_bdev && > >> > (lo->lo_offset & (bdev_io_min(inode->i_sb->s_bdev) - 1)) != 0) > >> > dio = false; > >> > >> The above can't work if the backing device has a bigger sector size > >> (such as 4K), that is why loop's direct-io requires 512 min_io_size of > >> backing device. > > > > Why doesn't it work? If the backing device sector size is 4k > > and lo_offset is 0 or a multiple of 4k it should allow direct I/O, > > and my code sniplet will allow that. > > Because size has to be 4k aligned too. So check that, too. Any >= 4k block size filesystem should be doing mostly 4k aligned and sized IO... Cheers, Dave. -- Dave Chinner david@fromorbit.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/