From: Ming Lei <ming.lei@canonical.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Jens Axboe <axboe@kernel.dk>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Dave Kleikamp <dave.kleikamp@oracle.com>,
Zach Brown <zab@zabbo.net>,
Maxim Patlasov <mpatlasov@parallels.com>,
Andrew Morton <akpm@linux-foundation.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Tejun Heo <tj@kernel.org>, Dave Chinner <david@fromorbit.com>,
linux-api@vger.kernel.org
Subject: Re: [PATCH v8 4/6] block: loop: prepare for supporing direct IO
Date: Thu, 30 Jul 2015 11:21:44 -0400 [thread overview]
Message-ID: <CACVXFVNKcpL=OQ+9NrCSogKDX2=q1MBmsgUBaFb0SgPMhT96tA@mail.gmail.com> (raw)
In-Reply-To: <20150730150900.GA13082@infradead.org>
On Thu, Jul 30, 2015 at 11:09 AM, Christoph Hellwig <hch@infradead.org> wrote:
> On Thu, Jul 30, 2015 at 07:36:22AM -0400, Ming Lei wrote:
>> This patches provides one interface for enabling direct IO
>> from user space:
>>
>> - userspace(such as losetup) can pass 'file' which is
>> opened/fcntl as O_DIRECT
>>
>> Also __loop_update_dio() is introduced to check if direct I/O
>> can be used on current loop setting.
>>
>> The last big change is to introduce LO_FLAGS_DIRECT_IO flag
>> for userspace to know if direct IO is used to access backing
>> file.
>
> Maybe i'm missing something because I was too busy to follow the
> current discussion, but this still doesn't check that the loop
> device sector size is aligned to the sector size of the underlying
> filesystem.
>
> E.g. with this you could create a loop device with a 512 byte
> sector size on a filesystem with 4k sector size, and it would attempt
> to use direct I/O and fail.
The I/O size & offset has to be checked in I/O path, see patch 6 please,
could you comment on that patch?
>
>> + unsigned dio_align = inode->i_sb->s_bdev ?
>> + (bdev_io_min(inode->i_sb->s_bdev) - 1) : 0;
>> +
>> + /*
>> + * We support direct I/O only if lo_offset is aligned
>> + * with the min I/O size of backing device.
>> + *
>> + * Request's offset and size will be checked in I/O path.
>> + */
>> + if (dio) {
>> + if (!dio_align || (lo->lo_offset & dio_align))
>> + use_dio = false;
>
> Also this means you'll never use direct I/O on network filesystems,
> which really would benefit from it.
OK, that can be done by removing !dio_align in above check.
Thanks,
next prev parent reply other threads:[~2015-07-30 15:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1438256184-23645-1-git-send-email-ming.lei@canonical.com>
2015-07-30 11:36 ` [PATCH v8 4/6] block: loop: prepare for supporing direct IO Ming Lei
[not found] ` <1438256184-23645-5-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2015-07-30 15:09 ` Christoph Hellwig
2015-07-30 15:21 ` Ming Lei [this message]
2015-07-30 15:30 ` Dave Kleikamp
[not found] ` <55BA432F.3050603-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2015-07-30 15:45 ` Ming Lei
2015-07-30 11:36 ` [PATCH v8 5/6] block: loop: introduce ioctl command of LOOP_SET_DIRECT_IO Ming Lei
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='CACVXFVNKcpL=OQ+9NrCSogKDX2=q1MBmsgUBaFb0SgPMhT96tA@mail.gmail.com' \
--to=ming.lei@canonical.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=dave.kleikamp@oracle.com \
--cc=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatlasov@parallels.com \
--cc=tj@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=zab@zabbo.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).