Re: [RFC v2 1/6] scsi: xarray hctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 25, 2020 at 10:01:59PM -0400, Douglas Gilbert wrote:
> When using xarray to store a bitset (e.g. say the 9 states in:
>    enum scsi_device_state   [include/scsi/scsi_device.h]
> as 2**0, 2**1, 2**2 .... 2**8), is there a mask to indicate which bit
> positions are used internally by xarray? Or are the full 32 bits available,
> other than the special value 0 aka NULL?

erm ... not quite sure what you mean by 'bitset'.  Are you saying that
you want to store a number between [0..511] at a particular offset in
the array?  If so, you want xa_mk_value(N) to turn a value into an xarray
entry.  When you load it, you can check it's a value with xa_is_value()
and convert it back to an integer with xa_to_value().  You han have up
to 31/63 bits that way, depending on sizeof(void *).

> Plus, based on the answers I get from above questions, in the
> scsi_lu_low32 class I would like to add another xarray, that holds
> bitsets rather than pointers. Each bitset holds amongst other things
> the 9 scsi_device states. That way you could iterate through all
> LU devices looking for an uncommon state _without_ dereferencing
> pointers to any sdev_s that are bypassed. And if xarray is cache
> efficient in storing its data, then it would be much faster. The
> same thing (i.e. bitset xarray) could be done in scsi_channel, for
> starget states.

Sounds like you really want more search marks.  This is a relatively common request and is disappointingly hard to do efficiently with the current XArray.
It's a request that should be solved with the new data structure, but
see earlier comments on when you might see that.

In the meantime, you might consider using an IDA for an efficient
expandable bitmap.  It's built on top of the XArray, but stores only
one bit per index instead of a pointer.  You'd need nine IDAs for nine
bits of state ...





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux