From 63be4e5afa2e3337571ff4670493e93897f7ec8a Mon Sep 17 00:00:00 2001 From: Jungwoo Date: Wed, 13 May 2020 21:09:10 +0900 Subject: [PATCH] Increase max loop device number upto 255 According to loop manual, kernel provides the /dev/loop-control device since Linux 3.1, which permits an application to dynamically find a free device, and to add and remove loop devices from the system. The limit is the maximum number of minor devices for a single major device(since loop has a single major, block 7), which is limited by MINORBITS which is located in kdev_t.h file of Linux. Therefore, it actually 2 to the power of 20, just over a million. In result, Linux could support lots number of loop devices. To use more than 100 loop devices, increase max loop device number in mic. Change-Id: I2e763f3c70c5aa919e67621bc54d37c0def9d07b --- mic/utils/fs_related.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mic/utils/fs_related.py b/mic/utils/fs_related.py index 32c8777..87daea3 100755 --- a/mic/utils/fs_related.py +++ b/mic/utils/fs_related.py @@ -906,11 +906,11 @@ class LoopDevice(object): return 10 fint = lambda x: x[9:].isdigit() and int(x[9:]) or 0 - maxid = 1 + max(filter(lambda x: x<100, + maxid = 1 + max(filter(lambda x: x<256, map(fint, glob.glob("/dev/loop[0-9]*")))) if maxid < 10: maxid = 10 - if maxid >= 100: - raise Exception("maxid >= 100") + if maxid >= 256: + raise Exception("maxid >= 256") return maxid def _kpseek(self, device): -- 2.7.4