From: Theodore Ts'o <tytso@mit.edu>
To: Jan Kara <jack@suse.cz>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH 5/6] ext4: Simplify io_end handling for AIO DIO
Date: Tue, 8 Mar 2016 23:38:34 -0500 [thread overview]
Message-ID: <20160309043834.GE3150@thunk.org> (raw)
In-Reply-To: <1455897582-13292-6-git-send-email-jack@suse.cz>
On Fri, Feb 19, 2016 at 04:59:41PM +0100, Jan Kara wrote:
> When mapping blocks for direct IO, we allocate io_end structure before
> mapping blocks and store pointer to it in the inode. This creates a
> requirement that any AIO DIO using io_end must be protected by i_mutex.
> This created problems in the past with dioread_nolock mode which was
> corrupting io_end pointers. Also io_end is allocated unnecessarily in
> case where we don't need to convert any extents (which is a common case
> for example when overwriting file).
>
> We fix the problem by allocating io_end only once we return unwritten
> extent from block mapping function for AIO DIO (so we can save some
> pointless io_end allocations) and we pass pointer to it in bh->b_private
> which generic DIO code later passes to our end IO callback. That way we
> remove any need for global pointer to io_end structure and thus fix the
> races.
>
> The downside of this change is that the checking for unwritten IO in
> flight in ext4_extents_can_be_merged() is more racy since we now
> increment i_unwritten / set EXT4_STATE_DIO_UNWRITTEN only after dropping
> i_data_sem. However the check has been racy already before because
> ext4_writepages() already increment i_unwritten after dropping
> i_data_sem and reserved blocks save us from hitting ENOSPC in the worst
> case.
>
> Signed-off-by: Jan Kara <jack@suse.cz>
Thanks, applied.
- Ted
next prev parent reply other threads:[~2016-03-09 4:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-19 15:59 [PATCH 0/6] ext4: Clean up io_end handling for AIO DIO Jan Kara
2016-02-19 15:59 ` [PATCH 1/6] ext4: Pack ioend structure better Jan Kara
2016-03-09 3:39 ` Theodore Ts'o
2016-02-19 15:59 ` [PATCH 2/6] ext4: Use i_mutex to serialize unaligned AIO DIO Jan Kara
2016-03-09 3:53 ` Theodore Ts'o
2016-02-19 15:59 ` [PATCH 3/6] ext4: Rename and split get blocks functions Jan Kara
2016-03-09 4:09 ` Theodore Ts'o
2016-02-19 15:59 ` [PATCH 4/6] ext4: Move trans handling and completion deferal out of _ext4_get_block Jan Kara
2016-03-09 4:27 ` Theodore Ts'o
2016-02-19 15:59 ` [PATCH 5/6] ext4: Simplify io_end handling for AIO DIO Jan Kara
2016-03-09 4:38 ` Theodore Ts'o [this message]
2016-02-19 15:59 ` [PATCH 6/6] ext4: Remove i_ioend_count Jan Kara
2016-03-09 4:53 ` Theodore Ts'o
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=20160309043834.GE3150@thunk.org \
--to=tytso@mit.edu \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
/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.