change __resize_to_minimal function, use default param "-M" to minimalize 41/175841/2
authorXiao Jin <jin.xiao@samsung.com>
Wed, 28 Mar 2018 14:25:14 +0000 (22:25 +0800)
committerJin Xiao <jin.xiao@samsung.com>
Fri, 13 Apr 2018 01:43:21 +0000 (01:43 +0000)
Change-Id: I7b50e83cc8b1294f1d9b524ffbd69769eebd914b

mic/utils/fs_related.py [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 0040fa2..9be1a10
@@ -539,21 +539,8 @@ class ExtDiskMount(DiskMount):
     def __resize_to_minimal(self):
         msger.info("Resizing filesystem to minimal ...")
         self.__fsck()
-
-        #
-        # Use a binary search to find the minimal size
-        # we can resize the image to
-        #
-        bot = 0
-        top = self.__get_size_from_filesystem()
-        while top != (bot + 1):
-            t = bot + ((top - bot) / 2)
-
-            if not resize2fs(self.disk.lofile, t):
-                top = t
-            else:
-                bot = t
-        return top
+        resize2fs(self.disk.lofile, 0)
+        return self.__get_size_from_filesystem()
 
     def resparse(self, size = None):
         self.cleanup()