|
|
About
TODO
Blog
RSS
Old blog
Projects
Gallery
Notes
Sat, 06 Jan 2007
Kevent celebrates its first birthday!
As present I have created
initial aio_sendfile() implementation.
/devel/kevent :: Link / Comments (0)
Initial aio_sendfile() implementation has been committed into kevent tree.
It is yet very rough and definitely must be cleaned (and some known bugs fixed),
but major part is done.
aio_sendfile() contains of two major parts: AIO state machine and
page processing code.
The former is just a small subsystem, which allows to queue callback for theirs invocation
in process' context on behalf of pool of kernel threads. It allows to queue caches
of callbacks to the local thread or to any other specified. Each cache of callbacks
is processed until there are callbacks in it, callbacks can requeue themselfs into
the same cache.
Real work is being done in page processing code - code which populates pages into
VFS cache and then sends pages to the destination socket via ->sendpage().
Unlike previous
aio_sendfile() implementation, new one does not require low-level filesystem specific
callbacks at all, instead I extended struct address_space_operations to contain
new member called ->aio_readpages(), which is exactly the same as
->readpage() (read: mpage_readpages()) except
different BIO allocation and sumbission routines.
I changed mpage_readpages() to provide mpage_alloc()
and mpage_bio_submit() to the new function called __mpage_readpages(),
which is exactly old mpage_readpages() with provided callback invocation
instead of usage for old functions. mpage_readpages_aio() provides
kevent
specific callbacks, which calls old functions, but with different destructor callbacks,
which are essentially the same, except that if page becomes uptodate, it is not unlocked,
so that it could not be removed until it is sent, and only then it is unlocked.
Code does contain bug (at least one) I know about - subsequent try to send pages happens not
after BIO is ready and thus pages are populated into VFS cache (i.e. pages are marked as uptodate),
but repeatedly in the state machine (rescheduling must happen in BIO destructor, not in the code,
which allocates pages). Another issues is that it is currently impossible to receive kevent notification
when aio_sendfile() is really completed.
/devel/kevent/aio :: Link / Comments (0)
|