westerndigitalcorporation / zenfs

ZenFS is a storage backend for RocksDB that enables support for ZNS SSDs and SMR HDDs.
GNU General Public License v2.0
235 stars 86 forks source link

Trying to include spdk lib. #290

Closed N96114297 closed 2 months ago

N96114297 commented 4 months ago

Hi, I am trying to change some of the zone manage command's operation in ZenFS from libzbd to spdk. Is this possible?

Because I'm facing many difficulties on the way, and I found that problems occurred after including spdk.

yhr commented 4 months ago

Hi!

It would be possible to use sdk as a storage back end. We currently support libzbd and zonefs, spdk could be added to that list. NVME passthrough is also an alternative if you would want to bypass the kernel.

You would have to implement this interface: https://github.com/westerndigitalcorporation/zenfs/blob/master/fs/zbdlib_zenfs.h

On Wed, Apr 10, 2024 at 2:29 PM N96114297 @.***> wrote:

Hi, I am trying to change some of the zone manage command's operation in ZenFS from libzbd to spdk. Is this possible?

Because I'm facing many difficulties on the way, and I found that problems occurred after including spdk.

— Reply to this email directly, view it on GitHub https://github.com/westerndigitalcorporation/zenfs/issues/290, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADNGOAVVO7TLGB6DATW37LY4UWCVAVCNFSM6AAAAABGALEDQKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGIZTKNBYGIYDOMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

N96114297 commented 4 months ago

Thanks for your reply.

Because my current approach is to create new code files at the same level as zbdlib_zenfs.h in order to avoid damaging the original system, but many problems occur in compilation.

It turns out that only need to modify zbdlib_zenfs.h first.

N96114297 commented 4 months ago

Sorry, I want to ask the question again.

The current compilation steps are to compile rocksdb first and then zenfs, but I cannot refer to it when I use the spdk API.

I also added some C code under the zenfs/fs/ .

I have currently modified the Makefile under rocksdb/ and the zenfs.mk under zenfs/.

yhr commented 4 months ago

What is the question? I'm not sure what issue you are facing.

Thanks, Hans

On Tue, Apr 16, 2024 at 4:24 PM N96114297 @.***> wrote:

Sorry, I want to ask the question again.

The current compilation steps are to compile rocksdb first and then zenfs, but I cannot refer to it when I use the spdk API.

I also added some C code under the zenfs/fs/ .

I have currently modified the makefile and CMakeLists.txt under rocksdb/ and the zenfs.mk and CMakeLists.txt under zenfs/.

— Reply to this email directly, view it on GitHub https://github.com/westerndigitalcorporation/zenfs/issues/290#issuecomment-2059223624, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADNGOBJLCBW6KWLQMUTWHTY5UYCBAVCNFSM6AAAAABGALEDQKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJZGIZDGNRSGQ . You are receiving this because you commented.Message ID: @.***>

N96114297 commented 4 months ago

Hi, sorry, maybe I'm not explain clearly.

I added some C API (using the zone management command of spdk) under zenfs/fs. These C API interfaces are similar to spdk. So i want to change libzbd API to my C API, now I only change the Reset command for testing.

But now I'm stuck on compilation problem.

I have currently modified the Makefile under rocksdb/ and the zenfs.mk under plugin/zenfs/, the compilation of rocksdb is pass, but when compiling zenfs, errors similar to #279 will appear.

I used the #279 solution, but it doesn't work.

I don't know which parts of the Makefile should be modified so that I can compile successfully.

/usr/bin/ld: /usr/local/lib/librocksdb.a(zbd_zenfs.o): in function `rocksdb::ZbdlibBackend::~ZbdlibBackend()':
/home/znsvm/rocksdb/plugin/zenfs/fs/zbdlib_zenfs.h:30: undefined reference to `zbd_close'
/usr/bin/ld: /home/znsvm/rocksdb/plugin/zenfs/fs/zbdlib_zenfs.h:31: undefined reference to `zbd_close'
/usr/bin/ld: /home/znsvm/rocksdb/plugin/zenfs/fs/zbdlib_zenfs.h:32: undefined reference to `zbd_close'
/usr/bin/ld: /usr/local/lib/librocksdb.a(zbd_zenfs.o): in function `rocksdb::ZbdlibBackend::~ZbdlibBackend()':
/home/znsvm/rocksdb/plugin/zenfs/fs/zbdlib_zenfs.h:30: undefined reference to `zbd_close'
/usr/bin/ld: /home/znsvm/rocksdb/plugin/zenfs/fs/zbdlib_zenfs.h:31: undefined reference to `zbd_close'
/usr/bin/ld: /usr/local/lib/librocksdb.a(zbd_zenfs.o):/home/znsvm/rocksdb/plugin/zenfs/fs/zbdlib_zenfs.h:32: more undefined references to `zbd_close' follow
/usr/bin/ld: /usr/local/lib/librocksdb.a(zbdlib_zenfs.o): in function `rocksdb::ZbdlibBackend::ListZones()':
/home/znsvm/rocksdb/plugin/zenfs/fs/zbdlib_zenfs.cc:118: undefined reference to `zbd_list_zones'
/usr/bin/ld: /usr/local/lib/librocksdb.a(zbdlib_zenfs.o): in function `rocksdb::ZbdlibBackend::Finish(unsigned long)':
/usr/include/libzbd/zbd.h:486: undefined reference to `zbd_zones_operation'
/usr/bin/ld: /usr/local/lib/librocksdb.a(zbdlib_zenfs.o): in function `rocksdb::ZbdlibBackend::Close(unsigned long)':
/usr/include/libzbd/zbd.h:469: undefined reference to `zbd_zones_operation'
/usr/bin/ld: /usr/local/lib/librocksdb.a(zbdlib_zenfs.o): in function `rocksdb::ZbdlibBackend::Reset(unsigned long, bool*, unsigned long*)':
/home/znsvm/rocksdb/plugin/zenfs/fs/zbdlib_zenfs.cc:136: undefined reference to `zns_reset_zone(unsigned long, bool)'
/usr/bin/ld: /home/znsvm/rocksdb/plugin/zenfs/fs/zbdlib_zenfs.cc:139: undefined reference to `zbd_report_zones'
/usr/bin/ld: /usr/local/lib/librocksdb.a(zbdlib_zenfs.o): in function `rocksdb::ZbdlibBackend::Open(bool, bool, unsigned int*, unsigned int*)':
/home/znsvm/rocksdb/plugin/zenfs/fs/zbdlib_zenfs.cc:70: undefined reference to `zbd_open'
/usr/bin/ld: /home/znsvm/rocksdb/plugin/zenfs/fs/zbdlib_zenfs.cc:80: undefined reference to `zbd_open'
/usr/bin/ld: /home/znsvm/rocksdb/plugin/zenfs/fs/zbdlib_zenfs.cc:72: undefined reference to `zbd_open'
/usr/bin/ld: /home/znsvm/rocksdb/plugin/zenfs/fs/zbdlib_zenfs.cc:90: undefined reference to `zbd_open'
collect2: error: ld returned 1 exit status
make: *** [Makefile:31: zenfs] Error 1

Thanks for your reply! Justin