Increase max loop device number upto 255 04/233304/1
authorJungwoo <jungwoo0.lee@samsung.com>
Wed, 13 May 2020 12:09:10 +0000 (21:09 +0900)
committerJungwoo <jungwoo0.lee@samsung.com>
Wed, 13 May 2020 12:26:41 +0000 (21:26 +0900)
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

index 32c8777..87daea3 100755 (executable)
@@ -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):