[PATCH] Support for large number of md(4) disks
sobomax at portaone.com
Mon Jan 16 13:56:45 PST 2006
IMHO there is better approach to fetch unknown amount of data from the
kernel using ioctl(2) facility. The main idea is that you allocate some
buffer of size sufficient in 95% of cases (for md(4) I think 8-16
entries are enough), attach it to some structure which has size of the
buffer as one of its members and send pointer to that structure as an
argument to ioctl(2).
Upon receiving this structure the kernel compares size of the buffer
with amount of information that it needs to send back. If buffer size is
sufficient to hold this information it copies it out and returns number
of entries in the buffer as one of members of this structure.
If the buffer size is insufficient, the kernel fills in desired size of
the buffer in structure members and returns some error code indicating
that the provided buffer is insufficient. Upon receiving this error
userland increases the buffer size to the size suggested by the kernel
(perhaps adding some extra space) and repeats the ioctl(2) calls.
Wojciech A. Koszek wrote:
> Here is a patch for md(4) which fixes current limit for ~95 devices.
> (It's possible to create > 95 md(4) based, disks,but they won't be listed
> in mdconfig -l). This change breaks ABI, so both geom_md.ko and
> mdconfig(8) has to be rebuilt.
> Comments are welcome.
More information about the freebsd-current