From: Christoph Hellwig <hch@lst.de>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH v9 4/5] gfs2: iomap direct I/O support
Date: Tue, 19 Jun 2018 08:42:34 +0200 [thread overview]
Message-ID: <20180619064234.GD24513@lst.de> (raw)
In-Reply-To: <20180615121922.13237-5-agruenba@redhat.com>
> } else if (flags & IOMAP_WRITE) {
> u64 size;
> +
> + if (flags & IOMAP_DIRECT)
> + goto out;
> +
Maybe add a comment here on why you don't allow block allocations for
direct I/O.
> + if (flags & IOMAP_DIRECT) {
> + ret = gfs2_iomap_get(inode, pos, length, flags, iomap, &mp);
> + release_metapath(&mp);
> + if (iomap->type != IOMAP_MAPPED)
> + ret = -ENOTBLK;
> + } else {
> + ret = gfs2_iomap_begin_write(inode, pos, length, flags, iomap);
> + }
A couple too long lines.
> } else {
> ret = gfs2_iomap_get(inode, pos, length, flags, iomap, &mp);
> release_metapath(&mp);
But shouldn't the direct I/O code try to reuse this part anyway?
E.g. something like:
if ((flags & (IOMAP_WRITE | IOMAP_DIRECT)) == IOMAP_WRITE)) {
ret = gfs2_iomap_begin_write(inode, pos, length, flags, iomap);
} else {
ret = gfs2_iomap_get(inode, pos, length, flags, iomap, &mp);
release_metapath(&mp);
if ((flags & IOMAP_WRITE) && iomap->type != IOMAP_MAPPED)
ret = -ENOTBLK;
> + /* fall back to buffered I/O for stuffed files */
> + ret = -ENOTBLK;
> + if (gfs2_is_stuffed(ip))
> + goto out;
I think we can handle stuffed files in the direct I/O code trivially
by copying out the inline data in the iomap. It would be great to
just handle this instead of adding fallbacks.
> + /* Silently fall back to buffered I/O for stuffed files */
> + if (gfs2_is_stuffed(ip))
> + goto out;
Same here.
> +static ssize_t gfs2_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
> +{
> + ssize_t ret;
> +
> + if (iocb->ki_flags & IOCB_DIRECT) {
> + ret = gfs2_file_direct_read(iocb, to);
> + if (likely(ret != -ENOTBLK))
> + goto out;
return ret;
> + iocb->ki_flags &= ~IOCB_DIRECT;
> + }
> + ret = generic_file_read_iter(iocb, to);
> +out:
> + return ret;
return generic_file_read_iter(iocb, to);
WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Andreas Gruenbacher <agruenba@redhat.com>
Cc: cluster-devel@redhat.com, Christoph Hellwig <hch@lst.de>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v9 4/5] gfs2: iomap direct I/O support
Date: Tue, 19 Jun 2018 08:42:34 +0200 [thread overview]
Message-ID: <20180619064234.GD24513@lst.de> (raw)
In-Reply-To: <20180615121922.13237-5-agruenba@redhat.com>
> } else if (flags & IOMAP_WRITE) {
> u64 size;
> +
> + if (flags & IOMAP_DIRECT)
> + goto out;
> +
Maybe add a comment here on why you don't allow block allocations for
direct I/O.
> + if (flags & IOMAP_DIRECT) {
> + ret = gfs2_iomap_get(inode, pos, length, flags, iomap, &mp);
> + release_metapath(&mp);
> + if (iomap->type != IOMAP_MAPPED)
> + ret = -ENOTBLK;
> + } else {
> + ret = gfs2_iomap_begin_write(inode, pos, length, flags, iomap);
> + }
A couple too long lines.
> } else {
> ret = gfs2_iomap_get(inode, pos, length, flags, iomap, &mp);
> release_metapath(&mp);
But shouldn't the direct I/O code try to reuse this part anyway?
E.g. something like:
if ((flags & (IOMAP_WRITE | IOMAP_DIRECT)) == IOMAP_WRITE)) {
ret = gfs2_iomap_begin_write(inode, pos, length, flags, iomap);
} else {
ret = gfs2_iomap_get(inode, pos, length, flags, iomap, &mp);
release_metapath(&mp);
if ((flags & IOMAP_WRITE) && iomap->type != IOMAP_MAPPED)
ret = -ENOTBLK;
> + /* fall back to buffered I/O for stuffed files */
> + ret = -ENOTBLK;
> + if (gfs2_is_stuffed(ip))
> + goto out;
I think we can handle stuffed files in the direct I/O code trivially
by copying out the inline data in the iomap. It would be great to
just handle this instead of adding fallbacks.
> + /* Silently fall back to buffered I/O for stuffed files */
> + if (gfs2_is_stuffed(ip))
> + goto out;
Same here.
> +static ssize_t gfs2_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
> +{
> + ssize_t ret;
> +
> + if (iocb->ki_flags & IOCB_DIRECT) {
> + ret = gfs2_file_direct_read(iocb, to);
> + if (likely(ret != -ENOTBLK))
> + goto out;
return ret;
> + iocb->ki_flags &= ~IOCB_DIRECT;
> + }
> + ret = generic_file_read_iter(iocb, to);
> +out:
> + return ret;
return generic_file_read_iter(iocb, to);
next prev parent reply other threads:[~2018-06-19 6:42 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-15 12:19 [Cluster-devel] [PATCH v9 0/5] gfs2 iomap write support Andreas Gruenbacher
2018-06-15 12:19 ` Andreas Gruenbacher
2018-06-15 12:19 ` [Cluster-devel] [PATCH v9 1/5] iomap: add private pointer to struct iomap Andreas Gruenbacher
2018-06-15 12:19 ` Andreas Gruenbacher
2018-06-18 15:25 ` [Cluster-devel] " Andreas Gruenbacher
2018-06-18 15:25 ` Andreas Gruenbacher
2018-06-19 6:29 ` [Cluster-devel] " Christoph Hellwig
2018-06-19 6:29 ` Christoph Hellwig
2018-06-15 12:19 ` [Cluster-devel] [PATCH v9 2/5] gfs2: iomap buffered write support Andreas Gruenbacher
2018-06-15 12:19 ` Andreas Gruenbacher
2018-06-19 6:36 ` [Cluster-devel] " Christoph Hellwig
2018-06-19 6:36 ` Christoph Hellwig
2018-06-15 12:19 ` [Cluster-devel] [PATCH v9 3/5] gfs2: gfs2_extent_length cleanup Andreas Gruenbacher
2018-06-15 12:19 ` Andreas Gruenbacher
2018-06-15 12:19 ` [Cluster-devel] [PATCH v9 4/5] gfs2: iomap direct I/O support Andreas Gruenbacher
2018-06-15 12:19 ` Andreas Gruenbacher
2018-06-19 6:42 ` Christoph Hellwig [this message]
2018-06-19 6:42 ` Christoph Hellwig
2018-06-20 16:00 ` [Cluster-devel] " Andreas Gruenbacher
2018-06-20 16:00 ` Andreas Gruenbacher
2018-06-15 12:19 ` [Cluster-devel] [PATCH v9 5/5] gfs2: Remove gfs2_write_{begin, end} Andreas Gruenbacher
2018-06-15 12:19 ` [PATCH v9 5/5] gfs2: Remove gfs2_write_{begin,end} Andreas Gruenbacher
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=20180619064234.GD24513@lst.de \
--to=hch@lst.de \
/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.