From: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
To: jens.axboe@oracle.com, linux-kernel@vger.kernel.org,
linux-scsi@vger.kernel.org
Cc: dm-devel@redhat.com, j-nomura@ce.jp.nec.com, k-ueda@ct.jp.nec.com
Subject: [RFC PATCH 0/3] blk_end_request: full I/O completion handler
Date: Wed, 10 Jan 2007 18:06:27 -0500 (EST) [thread overview]
Message-ID: <20070110.180627.41627650.k-ueda@ct.jp.nec.com> (raw)
Hi Jens and device driver maintainers,
I would like to make block interface to hook in before completing
each chunk of request (for errors) to allow request-based multipath.
The first approach was to add a new hook in __end_that_request_first().
- http://marc.theaimsgroup.com/?l=linux-scsi&m=115520444515914&w=2
- http://marc.theaimsgroup.com/?l=linux-kernel&m=116656637425880&w=2
However, Jens pointed out that redesigning ->end_io() as a full
completion handler would be better:
On Thu, 21 Dec 2006 08:49:47 +0100, Jens Axboe <jens.axboe@oracle.com> wrote:
> Ok, I see what you are getting at. The current ->end_io() is called when
> the request has fully completed, you want notification for each chunk
> potentially completed.
>
> I think a better design here would be to use ->end_io() as the full
> completion handler, similar to how bio->bi_end_io() works. A request
> originating from __make_request() would set something ala:
.....
> instead of calling the functions manually. That would allow you to get
> notification right at the beginning and do what you need, without adding
> a special hook for this.
So I made a tentative patch based on Jens' suggestion.
Are the interface and the design acceptable for block layer and
device drivers, though a little bit big modification of device drivers
is needed to take this approach?
What is changed:
o blk_end_request() is a helper for drivers to call a full completion
handler (req->end_io) for the request.
(end_that_request_* are no longer used from outside of the handlers.)
o If blk_end_request() returns 0, the request is completed.
If blk_end_request() returns 1, the request isn't completed and
the caller should decide reactions for it.
o __make_request() sets blk_end_io() in req->end_io
o Added some templates to existing req->end_io users so they can be
full completion handler.
The interface of blk_end_request():
o About the 4th argument (int locked)
blk_end_request() has to get a queue lock before it calls
end_that_request_last(). On the other hand, some callers need to
call blk_end_request() with the lock held.
Callers can tell blk_end_request() by this argument whether a queue
lock needs to be held in blk_end_request().
o About the 5th and the 6th arguments (int (callback)(void *), void *arg)
Most of callers do caller-specific work between
end_that_request_{first,chunk} and end_that_request_last.
Callers now pass a callback for such work by these arguments.
By using the callback feature, critical sections protected by
single queue lock might need to be divided.
(e.g. In scsi_end_request(), blk_queue_end_tag() and
end_that_request_last() was protected by 1 spinlock but
1 spinlock is used for each call. See PATCH#3)
If it can't be divided, the caller has to get the lock before
calling blk_end_request(), though it may have performance affects.
To cover callers which wants to call only __end_that_request_first()
like PIO mode in cdrom_newpc_intr(), the callback can return int value.
If the return value is non 0, blk_end_request() returns 1 immediately
without the request completion. (See cdrom_newpc_intr() in PATCH#3)
If this is acceptable approach, I will break down, clean up and repost
the patch.
Thanks,
Kiyoshi Ueda
reply other threads:[~2007-01-10 22:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20070110.180627.41627650.k-ueda@ct.jp.nec.com \
--to=k-ueda@ct.jp.nec.com \
--cc=dm-devel@redhat.com \
--cc=j-nomura@ce.jp.nec.com \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®