All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <tom.leiming@gmail.com>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux@vger.kernel.org
Subject: Re: [PATCH 0/2] losetup: support direct-IO to backing file
Date: Tue, 10 Nov 2015 23:20:58 +0800	[thread overview]
Message-ID: <CACVXFVMGoAhz0RAqc57UV_5qsi_OLxtVB4fGd0DRKuWd8-mRjQ@mail.gmail.com> (raw)
In-Reply-To: <20151110114004.GX19508@ws.net.home>

On Tue, Nov 10, 2015 at 7:40 PM, Karel Zak <kzak@redhat.com> wrote:
> On Tue, Nov 10, 2015 at 02:05:39PM +0800, Ming Lei wrote:
>> On Mon, Nov 9, 2015 at 7:46 PM, Karel Zak <kzak@redhat.com> 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.

Yes, that might work, but I am opt to use LOOP_SET_DIRECT_IO cmd
because set_status is already too fat and it is always safe to use one
specific cmd for chaning direct-io.

Also there have been bugs in set_status() already and it is always difficult to
change things together/atomaticaly especially, for example:

     - changing lo->transfer may cause oops
     - partial change in case of failure from figuring size
     - for direct-io, it may fail too, so it may introduce more
trouble to set_status
     for handling the failure.

Thanks,
Ming Lei

      reply	other threads:[~2015-11-10 15:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-07  0:40 [PATCH 0/2] losetup: support direct-IO to backing file Ming Lei
2015-11-07  0:40 ` [PATCH 1/2] losetup: support ioctl cmd of LOOP_SET_DIRECT_IO Ming Lei
2015-11-07  0:40 ` [PATCH 2/2] losetup: support list direct io Ming Lei
2015-11-09 10:29 ` [PATCH 0/2] losetup: support direct-IO to backing file Karel Zak
2015-11-09 11:29   ` Ming Lei
2015-11-09 11:46     ` Karel Zak
2015-11-10  6:05       ` Ming Lei
2015-11-10 11:40         ` Karel Zak
2015-11-10 15:20           ` Ming Lei [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACVXFVMGoAhz0RAqc57UV_5qsi_OLxtVB4fGd0DRKuWd8-mRjQ@mail.gmail.com \
    --to=tom.leiming@gmail.com \
    --cc=kzak@redhat.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.