Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1203638

Re: [PATCH v9 6/6] block: loop: support DIO & AIO

From Ming Lei <ming.lei@canonical.com>
Newsgroups linux.kernel
Subject Re: [PATCH v9 6/6] block: loop: support DIO & AIO
Date 2015-08-09 15:10 +0200
Message-ID <pVywp-6Xi-5@gated-at.bofh.it> (permalink)
References <pUp29-3HO-3@gated-at.bofh.it> <pUp2a-3HO-29@gated-at.bofh.it> <pUKzE-1p3-19@gated-at.bofh.it> <pULcm-2og-9@gated-at.bofh.it> <pVsAG-6A9-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, Aug 9, 2015 at 2:44 AM, Christoph Hellwig <hch@infradead.org> wrote:
> On Fri, Aug 07, 2015 at 04:25:52AM -0400, Ming Lei wrote:
>> On Fri, Aug 7, 2015 at 3:43 AM, Christoph Hellwig <hch@infradead.org> 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.

It isn't the problem which lo_drain_pending_dio() in this patch is
trying to avoid/fix.

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.

>
>> > 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.

For non-512 byte sector size of backing device, it is needed as
I described above.

Thanks,
Ming
--
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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v9 0/6] block: loop: improve loop with AIO Ming Lei <ming.lei@canonical.com> - 2015-08-06 10:50 +0200
  [PATCH v9 6/6] block: loop: support DIO & AIO Ming Lei <ming.lei@canonical.com> - 2015-08-06 10:50 +0200
    Re: [PATCH v9 6/6] block: loop: support DIO & AIO Christoph Hellwig <hch@infradead.org> - 2015-08-07 09:50 +0200
      Re: [PATCH v9 6/6] block: loop: support DIO & AIO Ming Lei <ming.lei@canonical.com> - 2015-08-07 10:30 +0200
        Re: [PATCH v9 6/6] block: loop: support DIO & AIO Christoph Hellwig <hch@infradead.org> - 2015-08-09 08:50 +0200
          Re: [PATCH v9 6/6] block: loop: support DIO & AIO Ming Lei <ming.lei@canonical.com> - 2015-08-09 15:10 +0200
            Re: [PATCH v9 6/6] block: loop: support DIO & AIO Christoph Hellwig <hch@infradead.org> - 2015-08-09 15:50 +0200
              Re: [PATCH v9 6/6] block: loop: support DIO & AIO Ming Lei <ming.lei@canonical.com> - 2015-08-09 16:30 +0200
                Re: [PATCH v9 6/6] block: loop: support DIO & AIO Dave Chinner <david@fromorbit.com> - 2015-08-10 01:50 +0200
                Re: [PATCH v9 6/6] block: loop: support DIO & AIO Ming Lei <ming.lei@canonical.com> - 2015-08-10 05:00 +0200
                Re: [PATCH v9 6/6] block: loop: support DIO & AIO Christoph Hellwig <hch@infradead.org> - 2015-08-10 10:10 +0200
                Re: [PATCH v9 6/6] block: loop: support DIO & AIO Ming Lei <ming.lei@canonical.com> - 2015-08-10 16:40 +0200

csiph-web