From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: util-linux-owner@vger.kernel.org Received: from mx1.redhat.com ([209.132.183.28]:49949 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751027AbbKJLkH (ORCPT ); Tue, 10 Nov 2015 06:40:07 -0500 Date: Tue, 10 Nov 2015 12:40:04 +0100 From: Karel Zak To: Ming Lei Cc: util-linux@vger.kernel.org Subject: Re: [PATCH 0/2] losetup: support direct-IO to backing file Message-ID: <20151110114004.GX19508@ws.net.home> References: <1446856818-26532-1-git-send-email-tom.leiming@gmail.com> <20151109102931.GU19508@ws.net.home> <20151109114613.GV19508@ws.net.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: Sender: util-linux-owner@vger.kernel.org List-ID: On Tue, Nov 10, 2015 at 02:05:39PM +0800, Ming Lei wrote: > On Mon, Nov 9, 2015 at 7:46 PM, Karel Zak wrote: > > On Mon, Nov 09, 2015 at 07:29:21PM +0800, Ming Lei wrote: > >> > It's fine to use --direct-io as toggle, but it would be nice to > >> > support it also when initialize the device. > >> > >> OK, looks a good idea, but we still need to support the standalone > >> command for direct-io for the case of 'mount -o loop'. > > > > Sure, I understand this use-case. I have talked bout loop_set_fd(), > > maybe all we need is: > > > > > > diff --git a/drivers/block/loop.c b/drivers/block/loop.c > > index 423f4ca..22642a0 100644 > > --- a/drivers/block/loop.c > > +++ b/drivers/block/loop.c > > @@ -925,7 +925,7 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, > > > > set_device_ro(bdev, (lo_flags & LO_FLAGS_READ_ONLY) != 0); > > > > - lo->use_dio = false; > > + lo->use_dio = (lo_flags & LO_FLAGS_DIRECT_IO); > > lo->lo_blocksize = lo_blocksize; > > lo->lo_device = bdev; > > lo->lo_flags = lo_flags; > > I don't think this change is doable because lo_flags is always started > as zero from loop_set_fd(). Sorry, wrong function -- should be loop_set_status() where we can modify lo->lo_flags by info->lo_flags. It's already used for LO_FLAGS_AUTOCLEAR and LO_FLAGS_PARTSCAN. Karel -- Karel Zak http://karelzak.blogspot.com