Skip to content

Commit

Permalink
Reinstate zvol_taskq to fix aio on zvol
Browse files Browse the repository at this point in the history
Commit 37f9dac removed the zvol_taskq for processing zvol requests.
This was removed as part of switching to make_request_fn and was
motivated by a concern at the time over dispatch latency.

However, this also made all bio request synchronous, and caused
serious performance issues as the bio submitter would wait for
every bio it submitted, effectively making the IO depth 1.

This patch reinstate zvol_taskq, and to make sure overlapped I/Os
are ordered properly, we take range lock in zvol_request, and pass
it along with bio to the I/O functions zvol_{write,discard,read}.

In order to facilitate benchmarks a zvol_request_sync module
option was added to switch between sync and async request handling.
For the moment, the default behavior is synchronous but this is
likely to change pending additional testing.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Chunwei Chen <[email protected]>
Closes #5824
  • Loading branch information
Chunwei Chen authored and behlendorf committed Apr 26, 2017
1 parent e815485 commit 692e55b
Show file tree
Hide file tree
Showing 3 changed files with 199 additions and 82 deletions.
11 changes: 9 additions & 2 deletions include/linux/blkdev_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,15 @@ blk_queue_discard_granularity(struct request_queue *q, unsigned int dg)
#define VDEV_HOLDER ((void *)0x2401de7)

#ifndef HAVE_GENERIC_IO_ACCT
#define generic_start_io_acct(rw, slen, part) ((void)0)
#define generic_end_io_acct(rw, part, start_jiffies) ((void)0)
static inline void
generic_start_io_acct(int rw, unsigned long sectors, struct hd_struct *part)
{
}

static inline void
generic_end_io_acct(int rw, struct hd_struct *part, unsigned long start_time)
{
}
#endif

#endif /* _ZFS_BLKDEV_H */
25 changes: 25 additions & 0 deletions man/man5/zfs-module-parameters.5
Original file line number Diff line number Diff line change
Expand Up @@ -2031,6 +2031,31 @@ table.
Default value: \fB131,072\fR.
.RE

.sp
.ne 2
.na
\fBzvol_request_sync\fR (uint)
.ad
.RS 12n
When processing I/O requests for a zvol submit them synchronously. This
effectively limits the queue depth to 1 for each I/O submitter. When set
to 0 requests are handled asynchronously by a thread pool. The number of
requests which can be handled concurrently is controller by \fBzvol_threads\fR.
.sp
Default value: \fB1\fR.
.RE

.sp
.ne 2
.na
\fBzvol_threads\fR (uint)
.ad
.RS 12n
Max number of threads which can handle zvol I/O requests concurrently.
.sp
Default value: \fB32\fR.
.RE

.sp
.ne 2
.na
Expand Down
Loading

0 comments on commit 692e55b

Please sign in to comment.