Whamcloud - gitweb
LU-8802 obd: remove MAX_OBD_DEVICES 40/51040/17
authorTimothy Day <timday@amazon.com>
Tue, 9 May 2023 05:07:36 +0000 (05:07 +0000)
committerOleg Drokin <green@whamcloud.com>
Wed, 25 Oct 2023 18:05:21 +0000 (18:05 +0000)
commitc5e5060d9502c2e4fb43579d02c983ccbec9b063
tree5bacb032e61807b208cfde2c81c5dfcabcb268a9
parent0f2bc318d7a31d6a8960ab1e198d2bc686132b8f
LU-8802 obd: remove MAX_OBD_DEVICES

Remove this arbitrary limit by reimplementing the array as an
Xarray. Xarray can grow and shink dynamically, hence saving
memory and allow for many more OBD devices. There is still
technically a limit OBD_MAX_INDEX, which is xa_limit_31b.max
or around 2 billion. This is far more than is practically
useful.

This patch also adds various iterators for OBD devices, which
are used to simplify code in various places.

Removing class_obd_list() since it is unused. Rename
class_dev_by_str() to class_str2obd() to keep the pattern.
Several class_* functions have been refactored to improve
locking. The larger issue of OBD device locking will be
addressed separately.

Update the OBD device lifecycle test to try loading
more devices (about 24,000 for now).

Currently, adding an additional OBD device is an O(n^2)
operation due to the class_name2dev calls in
class_register_device(). This will be addressed in a future
patch adding a hash table for OBD device name lookups.

Further, OBD life cycle management could likely be simplified
by using Xarray marks. Right now, it is handled by a bit
field in the obd_device struct. Since the scope of the changes
needed to simplify this seem large, this will also be addressed
separately.

Test-Parameters: testlist=sanity env=ONLY=55,ONLY_REPEAT=10
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: Icb2cd94a5529e79f5d3ebd0de5e0f225cf212075
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51040
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
13 files changed:
lustre/include/obd.h
lustre/include/obd_class.h
lustre/ldlm/ldlm_lib.c
lustre/llite/llite_lib.c
lustre/lov/lov_dev.c
lustre/mgs/mgs_llog.c
lustre/obdclass/class_obd.c
lustre/obdclass/genops.c
lustre/obdclass/kernelcomm.c
lustre/obdclass/obd_config.c
lustre/obdclass/obd_mount.c
lustre/obdclass/obd_sysfs.c
lustre/tests/sanity.sh