From: Andrew Morton <akpm@osdl.org>
To: Zach Brown <zach.brown@oracle.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-aio@kvack.org
Subject: Re: [PATCH take2 1/5] dio: centralize completion in dio_complete()
Date: Tue, 3 Oct 2006 15:26:03 -0700 [thread overview]
Message-ID: <20061003152603.3de68390.akpm@osdl.org> (raw)
In-Reply-To: <20061002232125.18827.52078.sendpatchset@tetsuo.zabbo.net>
On Mon, 2 Oct 2006 16:21:25 -0700 (PDT)
Zach Brown <zach.brown@oracle.com> wrote:
> dio: centralize completion in dio_complete()
>
> The mechanics which decide the result of a direct IO operation were duplicated
> in the sync and async paths.
>
> The async path didn't check page_errors which can manifest as silently
> returning success when the final pointer in an operation faults and its
> matching file region is filled with zeros.
>
> The sync path and async path differed in whether they passed errors to the
> caller's dio->end_io operation. The async path was passing errors to it which
> trips an assertion in XFS, though it is apparently harmless.
>
> This centralizes the completion phase of dio ops in one place. AIO will now
> return EFAULT consistently and all paths fall back to the previously sync
> behaviour of passing the number of bytes 'transferred' to the dio->end_io
> callback, regardless of errors.
>
> dio_await_completion() doesn't have to propogate EIO from non-uptodate
> bios now that it's being propogated through dio_complete() via dio->io_error.
> This lets it return void which simplifies its sole caller.
>
> ...
>
> -static void dio_complete(struct dio *dio, loff_t offset, ssize_t bytes)
> +static int dio_complete(struct dio *dio, loff_t offset, int ret)
> {
> + ssize_t transferred = 0;
> +
> + if (dio->result) {
> + transferred = dio->result;
> +
> + /* Check for short read case */
> + if ((dio->rw == READ) && ((offset + transferred) > dio->i_size))
> + transferred = dio->i_size - offset;
On 32-bit machines ssize_t is `int' and loff_t is `long long'. I guess
`transferred' cannot overflow because you can't write >4G. And I guess
`transferred' cannot go negative because you cannot write >=2G. Can you
confirm that thinking?
next prev parent reply other threads:[~2006-10-03 22:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-02 23:21 [PATCH take2 0/5] dio: clean up completion phase of direct_io_worker() Zach Brown
2006-10-02 23:21 ` [PATCH take2 1/5] dio: centralize completion in dio_complete() Zach Brown
2006-10-03 22:26 ` Andrew Morton [this message]
2006-10-03 23:05 ` Zach Brown
2006-10-02 23:21 ` [PATCH take2 2/5] dio: call blk_run_address_space() once per op Zach Brown
2006-10-02 23:21 ` [PATCH take2 3/5] dio: formalize bio counters as a dio reference count Zach Brown
2006-10-03 22:44 ` Andrew Morton
2006-10-03 23:23 ` Zach Brown
2006-10-02 23:21 ` [PATCH take2 4/5] dio: remove duplicate bio wait code Zach Brown
2006-10-02 23:21 ` [PATCH take2 5/5] dio: only call aio_complete() after returning -EIOCBQUEUED Zach Brown
2006-10-03 21:47 ` [PATCH take2 0/5] dio: clean up completion phase of direct_io_worker() Jeff Moyer
2006-10-03 22:20 ` Andrew Morton
2006-10-03 23:00 ` Zach Brown
2006-10-04 10:12 ` Jens Axboe
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=20061003152603.3de68390.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=linux-aio@kvack.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zach.brown@oracle.com \
/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