From: Jan Kara <jack@suse.cz>
To: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Cc: tytso@mit.edu, jack@suse.cz, adilger.kernel@dilger.ca,
linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
riteshh@linux.ibm.com
Subject: Re: [PATCH v7 11/11] ext4: introduce direct I/O write using iomap infrastructure
Date: Tue, 5 Nov 2019 14:59:32 +0100 [thread overview]
Message-ID: <20191105135932.GN22379@quack2.suse.cz> (raw)
In-Reply-To: <e55db6f12ae6ff017f36774135e79f3e7b0333da.1572949325.git.mbobrowski@mbobrowski.org>
On Tue 05-11-19 23:02:39, Matthew Bobrowski wrote:
> + if (ret >= 0 && iov_iter_count(from)) {
> + ssize_t err;
> + loff_t endbyte;
> +
> + offset = iocb->ki_pos;
> + err = ext4_buffered_write_iter(iocb, from);
> + if (err < 0)
> + return err;
> +
> + /*
> + * We need to ensure that the pages within the page cache for
> + * the range covered by this I/O are written to disk and
> + * invalidated. This is in attempt to preserve the expected
> + * direct I/O semantics in the case we fallback to buffered I/O
> + * to complete off the I/O request.
> + */
> + ret += err;
> + endbyte = offset + ret - 1;
^^ err here?
Otherwise you would write out and invalidate too much AFAICT - the 'offset'
is position just before we fall back to buffered IO. Otherwise this hunk
looks good to me.
> + err = filemap_write_and_wait_range(iocb->ki_filp->f_mapping,
> + offset, endbyte);
> + if (!err)
> + invalidate_mapping_pages(iocb->ki_filp->f_mapping,
> + offset >> PAGE_SHIFT,
> + endbyte >> PAGE_SHIFT);
> + }
> +
> + return ret;
> +}
> +
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2019-11-05 13:59 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-05 11:58 [PATCH v7 00/11] ext4: port direct I/O to iomap infrastructure Matthew Bobrowski
2019-11-05 11:58 ` [PATCH v7 01/11] ext4: reorder map.m_flags checks within ext4_iomap_begin() Matthew Bobrowski
2019-11-05 11:59 ` [PATCH v7 02/11] ext4: update direct I/O read lock pattern for IOCB_NOWAIT Matthew Bobrowski
2019-11-05 11:59 ` [PATCH v7 03/11] ext4: iomap that extends beyond EOF should be marked dirty Matthew Bobrowski
2019-11-05 11:59 ` [PATCH v7 04/11] ext4: move set iomap routines into a separate helper ext4_set_iomap() Matthew Bobrowski
2019-11-05 12:00 ` [PATCH v7 05/11] ext4: split IOMAP_WRITE branch in ext4_iomap_begin() into helper Matthew Bobrowski
2019-11-05 12:01 ` [PATCH v7 07/11] ext4: introduce direct I/O read using iomap infrastructure Matthew Bobrowski
2019-11-05 12:01 ` [PATCH v7 08/11] ext4: move inode extension/truncate code out from ->iomap_end() callback Matthew Bobrowski
2019-11-05 15:49 ` Darrick J. Wong
2019-11-05 21:10 ` Matthew Bobrowski
2019-11-05 12:02 ` [PATCH v7 09/11] ext4: move inode extension check out from ext4_iomap_alloc() Matthew Bobrowski
2019-11-05 12:02 ` [PATCH v7 10/11] ext4: update ext4_sync_file() to not use __generic_file_fsync() Matthew Bobrowski
2019-11-05 12:02 ` [PATCH v7 11/11] ext4: introduce direct I/O write using iomap infrastructure Matthew Bobrowski
2019-11-05 13:59 ` Jan Kara [this message]
2019-11-05 20:32 ` Matthew Bobrowski
2019-11-05 20:53 ` Theodore Y. Ts'o
2019-11-05 21:00 ` Matthew Bobrowski
2019-11-06 0:59 ` Theodore Y. Ts'o
2019-11-05 16:28 ` Theodore Y. Ts'o
2019-11-05 20:57 ` Matthew Bobrowski
2019-11-05 12:03 ` [PATCH v7 06/11] ext4: introduce new callback for IOMAP_REPORT Matthew Bobrowski
2019-11-05 15:43 ` Darrick J. Wong
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=20191105135932.GN22379@quack2.suse.cz \
--to=jack@suse.cz \
--cc=adilger.kernel@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mbobrowski@mbobrowski.org \
--cc=riteshh@linux.ibm.com \
--cc=tytso@mit.edu \
/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).