|
|
Subscribe / Log in / New account

Libublk-rs v0.1.0

From:  Ming Lei <ming.lei-AT-redhat.com>
To:  linux-block-AT-vger.kernel.org, io-uring <io-uring-AT-vger.kernel.org>, Andreas Hindborg <nmi-AT-metaspace.dk>, Shinichiro Kawasaki <shinichiro.kawasaki-AT-wdc.com>, German Maglione <gmaglione-AT-redhat.com>, Stefano Garzarella <sgarzare-AT-redhat.com>, Joe Thornber <ethornbe-AT-redhat.com>
Subject:  Libublk-rs v0.1.0
Date:  Mon, 14 Aug 2023 10:56:37 +0800
Message-ID:  <ZNmX5UQev4qvFMaq@fedora>
Cc:  ming.lei-AT-redhat.com
Archive-link:  Article

Hello,

Libublk-rs(Rust)[1][2] 0.1.0 is released.

The original idea is to use Rust to write ublk target for covering all
kinds of block queue limits/parameters combination easily when talking
with Andreas and Shinichiro about blktests in LSFMM/BPF 2023.

Finally it is evolved into one generic library. Attributed to Rust's
some modern language features, libublk interfaces are pretty simple:

- one closure(tgt_init) for user to customize device by providing all
  kind of parameter

- the other closure(io handling) for user to handling IO which is
  completely io_uring CQE driven: a) IO command CQE from ublk driver,
  b) target IO CQE originated from target io handling code, c) eventfd
  CQE if IO is offloaded to other context

With low level APIs, <50 LoC can build one ublk-null, and if high level
APIs are used, 30 LoC is enough.

Performance is basically aligned with pure C ublk implementation[3].

The library has been verified on null, ramdisk, loop and zoned target.
The plan is to support async/await in 0.2 or 0.3 so that libublk can
be used to build complicated target easily and efficiently.

Thanks Andreas for reviewing and providing lots of good ideas for
improvement & cleanup. Thanks German Maglione for some suggestions, such
as eventfd support. Thanks Joe for providing excellent Rust programming
guide.

Any feedback is welcome!

[1] https://crates.io/crates/libublk 
[2] https://github.com/ming1/libublk-rs
[3] https://github.com/osandov/blktests/blob/master/src/miniu...

Thanks,
Ming



Copyright © 2023, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds