mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-14 06:24:53 +08:00
71f28f3136
This is the driver part of userspace block driver(ublk driver), the other part is userspace daemon part(ublksrv)[1]. The two parts communicate by io_uring's IORING_OP_URING_CMD with one shared cmd buffer for storing io command, and the buffer is read only for ublksrv, each io command is indexed by io request tag directly, and is written by ublk driver. For example, when one READ io request is submitted to ublk block driver, ublk driver stores the io command into cmd buffer first, then completes one IORING_OP_URING_CMD for notifying ublksrv, and the URING_CMD is issued to ublk driver beforehand by ublksrv for getting notification of any new io request, and each URING_CMD is associated with one io request by tag. After ublksrv gets the io command, it translates and handles the ublk io request, such as, for the ublk-loop target, ublksrv translates the request into same request on another file or disk, like the kernel loop block driver. In ublksrv's implementation, the io is still handled by io_uring, and share same ring with IORING_OP_URING_CMD command. When the target io request is done, the same IORING_OP_URING_CMD is issued to ublk driver for both committing io request result and getting future notification of new io request. Another thing done by ublk driver is to copy data between kernel io request and ublksrv's io buffer: 1) before ubsrv handles WRITE request, copy the request's data into ublksrv's userspace io buffer, so that ublksrv can handle the write request 2) after ubsrv handles READ request, copy ublksrv's userspace io buffer into this READ request, then ublk driver can complete the READ request Zero copy may be switched if mm is ready to support it. ublk driver doesn't handle any logic of the specific user space driver, so it is small/simple enough. [1] ublksrv https://github.com/ming1/ubdsrv Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20220713140711.97356-2-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
45 lines
1.2 KiB
Makefile
45 lines
1.2 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
#
|
|
# Makefile for the kernel block device drivers.
|
|
#
|
|
# 12 June 2000, Christoph Hellwig <hch@infradead.org>
|
|
# Rewritten to use lists instead of if-statements.
|
|
#
|
|
|
|
# needed for trace events
|
|
ccflags-y += -I$(src)
|
|
|
|
obj-$(CONFIG_MAC_FLOPPY) += swim3.o
|
|
obj-$(CONFIG_BLK_DEV_SWIM) += swim_mod.o
|
|
obj-$(CONFIG_BLK_DEV_FD) += floppy.o
|
|
obj-$(CONFIG_AMIGA_FLOPPY) += amiflop.o
|
|
obj-$(CONFIG_PS3_DISK) += ps3disk.o
|
|
obj-$(CONFIG_PS3_VRAM) += ps3vram.o
|
|
obj-$(CONFIG_ATARI_FLOPPY) += ataflop.o
|
|
obj-$(CONFIG_AMIGA_Z2RAM) += z2ram.o
|
|
obj-$(CONFIG_N64CART) += n64cart.o
|
|
obj-$(CONFIG_BLK_DEV_RAM) += brd.o
|
|
obj-$(CONFIG_BLK_DEV_LOOP) += loop.o
|
|
obj-$(CONFIG_CDROM_PKTCDVD) += pktcdvd.o
|
|
obj-$(CONFIG_SUNVDC) += sunvdc.o
|
|
|
|
obj-$(CONFIG_BLK_DEV_NBD) += nbd.o
|
|
obj-$(CONFIG_VIRTIO_BLK) += virtio_blk.o
|
|
|
|
obj-$(CONFIG_BLK_DEV_SX8) += sx8.o
|
|
|
|
obj-$(CONFIG_XEN_BLKDEV_FRONTEND) += xen-blkfront.o
|
|
obj-$(CONFIG_XEN_BLKDEV_BACKEND) += xen-blkback/
|
|
obj-$(CONFIG_BLK_DEV_DRBD) += drbd/
|
|
obj-$(CONFIG_BLK_DEV_RBD) += rbd.o
|
|
obj-$(CONFIG_BLK_DEV_PCIESSD_MTIP32XX) += mtip32xx/
|
|
|
|
obj-$(CONFIG_ZRAM) += zram/
|
|
obj-$(CONFIG_BLK_DEV_RNBD) += rnbd/
|
|
|
|
obj-$(CONFIG_BLK_DEV_NULL_BLK) += null_blk/
|
|
|
|
obj-$(CONFIG_BLK_DEV_UBLK) += ublk_drv.o
|
|
|
|
swim_mod-y := swim.o swim_asm.o
|