-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for asynchronous dmu operations #10303
Conversation
b9b53bb
to
1610845
Compare
Codecov Report
@@ Coverage Diff @@
## master #10303 +/- ##
==========================================
- Coverage 79.67% 79.58% -0.09%
==========================================
Files 390 390
Lines 123336 123867 +531
==========================================
+ Hits 98263 98580 +317
- Misses 25073 25287 +214
Continue to review full report at Codecov.
|
474c4de
to
c730c91
Compare
Good to see it resurrected after so many years. I am still reviewing it. |
378e6a1
to
916bff6
Compare
1ec0c79
to
ba8a896
Compare
while (n && uio->uio_resid) { | ||
cnt = MIN(iov->iov_len, n); | ||
switch (uio->uio_segflg) { | ||
case UIO_SYSSPACE: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just have ASSERT(uio->uio_segflag == UIO_SYSSPACE)?
mutex_exit(&tq->tq_lock); | ||
tq->tq_dtor(tq); | ||
mutex_enter(&tq->tq_lock); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason, since this is all new code and the dtor callback would be new, to not simply have it deal with any locking if it needs to?
Other than my questions above, it looks ok to me. |
Signed-off-by: Matt Macy <[email protected]>
ba8a896
to
b1dcf7f
Compare
Codecov Report
@@ Coverage Diff @@
## master #10303 +/- ##
==========================================
- Coverage 79.24% 70.99% -8.26%
==========================================
Files 390 387 -3
Lines 123336 123455 +119
==========================================
- Hits 97737 87643 -10094
- Misses 25599 35812 +10213
Continue to review full report at Codecov.
|
The only user visible change for existing code is the removal of
DMU_READ_NO_PREFETCH
and the replacement of
DMU_READ_PREFETCH
andDMU_READ_NO_DECRYPT
There are two new data structures:
dmu_ctx_t
maintains dmu context during operationsdmu_buf_set_t
maintains references to dbufs and is used for dbuf read completions.For most purposes the new functions of interest are:
Two helper functions have been added to simplify the most straightforward case.
These two functions are used to exercise the async completion logic in ztest.
Read and write in zvol on both FreeBSD and Linux no longer require a dedicated thread for async semantics. This could be later extended to support delete.
Platforms with VFS interfaces that accept completion routines can use the new interfaces to eliminate the need for a dedicated kernel thread to support posix AIO on ZFS.
Some further implementation details:
Internally,
dmu_buf_set_t
is used for managing state and tracking completions. Thedbs_holds
field is used as a count of pending read operations that need to be completed before the data transfer callback can be executed. The completions are handled bydmu_buf_set_rele
whendbs_holds
goes to zero it calls the data transfer callback. The initial set up for this occurs indbuf_hold_impl
. Whendbuf_hold_impl
is called indmu_buf_set_setup_buffers
, we now also pass it admu_buf_set_t
. If the dbuf in question is notDB_CACHED
it will add it to a list attached to the dbuf fordmu_buf_set_rele
to be called at read completion time, otherwise it release the hold immediately.As far as this change goes, only L0 buffer reads are asynchronous.
dmu_ctx_setup_tx
anddbuf_hold_{...}
still issue synchronous reads. In #10317 I extended this to restartdmu_issue
calls in dbuf_read completions ifdbuf_hold_level_async
(new wrapper for dbuf_hold_impl) would block. It would be straightforward to do the same fordmu_ctx_setup_tx
in a future PR.Authored-by: Will Andrews [email protected]
Co-authored-by: Matt Macy [email protected]
Signed-off-by: Matt Macy [email protected]
Motivation and Context
Description
How Has This Been Tested?
Types of changes
Checklist:
Signed-off-by
.