[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAB0TPYELq72hjHvyFVmaAFZPCaSSxV-j6znM8peezqtep6i-1A@mail.gmail.com>
Date: Mon, 2 Sep 2019 21:37:39 +0200
From: Martijn Coenen <maco@...roid.com>
To: Christoph Hellwig <hch@...radead.org>
Cc: Jens Axboe <axboe@...nel.dk>,
linux-block <linux-block@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>, kernel-team@...roid.com,
Narayan Kamath <narayan@...gle.com>,
Dario Freni <dariofreni@...gle.com>,
Nikita Ioffe <ioffe@...gle.com>,
Jiyong Park <jiyong@...gle.com>,
Martijn Coenen <maco@...gle.com>,
Greg KH <gregkh@...uxfoundation.org>
Subject: Re: [PATCH] loop: change queue block size to match when using DIO.
On Fri, Aug 30, 2019 at 5:50 PM Christoph Hellwig <hch@...radead.org> wrote:
>
> On Wed, Aug 28, 2019 at 12:32:29PM +0200, Martijn Coenen wrote:
> > The loop driver assumes that if the passed in fd is opened with
> > O_DIRECT, the caller wants to use direct I/O on the loop device.
> > However, if the underlying filesystem has a different block size than
> > the loop block queue, direct I/O can't be enabled. Instead of requiring
> > userspace to manually change the blocksize and re-enable direct I/O,
> > just change the queue block size to match.
>
> Why can't we enable the block device in that case? All the usual
> block filesystems support 512 byte aligned direct I/O with a 4k
> file system block size (as long as the underlying block device
> sector size is also 512 bytes).
Sorry, I didn't word that correctly: it's not the logical block size
of the filesystem, but the logical block size of the underlying block
device that loop's queue must match (or exceed). With the current loop
code, if the backing file is opened with O_DIRECT and resides on a
block device with a 512 bytes logical block size, the loop device will
correctly use direct I/O. If instead the backing file happened to
reside on a block device with a 4k logical block size, the loop device
would silently fall back to cached mode. I think there's a benefit in
the behavior being consistent independent of the block size of the
backing device, and I don't see a good reason for not automatically
switching loop's logical/physical queue sizes to match the backing
device in this specific case.
Will send a v2.
Thanks,
Martijn
Powered by blists - more mailing lists