Linux-ext4 Archive on lore.kernel.org
 help / color / Atom feed
From: Matthew Bobrowski <mbobrowski@mbobrowski.org>
To: Jan Kara <jack@suse.cz>
Cc: tytso@mit.edu, 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: Wed, 6 Nov 2019 07:32:00 +1100
Message-ID: <20191105203158.GA1739@bobrowski> (raw)
In-Reply-To: <20191105135932.GN22379@quack2.suse.cz>

On Tue, Nov 05, 2019 at 02:59:32PM +0100, Jan Kara wrote:
> 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.

Er, yes. That's right, it should rather be 'err' instead or else we
would write/invalidate too much. I actually had this originally, but I
must've muddled it up while rewriting this patch on my other computer.

Thanks for picking that up!

/M

  reply index

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 " 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
2019-11-05 20:32     ` Matthew Bobrowski [this message]
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=20191105203158.GA1739@bobrowski \
    --to=mbobrowski@mbobrowski.org \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.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

Linux-ext4 Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-ext4/0 linux-ext4/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-ext4 linux-ext4/ https://lore.kernel.org/linux-ext4 \
		linux-ext4@vger.kernel.org
	public-inbox-index linux-ext4

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-ext4


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git