On Thu, Jul 22, 2021 at 11:55:58PM +0100, Wedson Almeida Filho wrote: > On Thu, Jul 08, 2021 at 01:58:32AM +0100, Matthew Wilcox wrote: > > A simple NVMe driver is less than a thousand lines of C. > > I know the one in the kernel now is ridiculously complicated and has > > been thoroughly messed up with abstractions to support NVMeoF instead > > of having a separate driver, but it's really a simple interface at heart. > > The latest NVMe spec is 452 pages long, which seems to contradict your claim > that it's simple. In any case, translating less than 1K lines of C shouldn't be > too hard (after I've built the abstractions, of course). Would you mind sharing > the simple driver you mention above? You can use the 1.0 spec, which is much shorter. A 1.0 capable driver should be forward compatible with newer devices, too. The current nvme driver became less simple since blk-mq integration and has only gotten more complicated since then with other transports and more advanced features. For a simpler example, you can reference an in kernel version <= 3.16, and ignore the "nvme-scsi" parts.