[stgt] [PATCH] Make the backing-store modules shared objects that are loaded at runtime

ronnie sahlberg ronniesahlberg at gmail.com
Mon Aug 19 01:44:45 CEST 2013

On Sun, Aug 18, 2013 at 3:57 PM, FUJITA Tomonori
<fujita.tomonori at lab.ntt.co.jp> wrote:
> On Sat, 10 Aug 2013 02:33:44 -0700
> Ronnie Sahlberg <ronniesahlberg at gmail.com> wrote:
>> Turn most of TGTD into a shared library libtgt.so and install it under
>> $(PREFIX)/lib/tgtd
> What does this mean? Why we need libtgt.so?

When the backing stores become shared objects they can only link
against/use symbols from other shared objects.
The backing store files bs_*.c calls and need to be able to link with
other symbols outside of the bs_*.c file itself.

For example bs_aio.c bs_rdwr.c and bs_ssc.c all need to link with
bs_thread_open() is similar.

Any symbol that the bs_*.c files reference must also be from  a shared
The easiest way to do that is to make all of tgtd, except for main(),
into a shared library.

>> Change the six backing stores  bs_aio/null/rbd/rdwr/sg/ssc into shared objec
>> and install them under $(PREFIX)/lib/tgtd/backing-store
>> When tgtd is starting, have it traverse the directory for backing stores and
>> automatically load and initialize all backing stores files that are found.
>> This allows for example to distribute bs_aio.so as a separate package
>> since it has additional dependencies (libaio) that tgtd itself does not have
>> Similarly for bs_rbd.so.
>> This means that core TGTD can be distributed with minimal dependencies
>> and backends that add additional dependencies can be distributed separately.
>> Once we have this basics for a modularized TGTD later patches can build onto
>> of this and add features such as :
>> * list all modules and which luns are using them
>> * unload module if unused
>> * re-load module
>> But that can come in later patches. Lets get the basics in first.
> I understand why some people this feature. I'm not a big fan of C
> dynamic loading feature though. I don't merge unloading/reloading
> feature. These features are not what the people are looking for
> anyway.
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

More information about the stgt mailing list