# Diff of /trunk/src/GLIStorageDevice.py

Revision 205 Revision 207
101 101
102 def remove_partition(self, minor): 102 def remove_partition(self, minor):
103 del self._partitions[int(minor)] 103 del self._partitions[int(minor)]
104 104
105 def get_free_space(self, start): 105 def get_free_space(self, start):
106 GAP_SIZE = 100
106 parts = self._partitions.keys() 107 parts = self._partitions.keys()
107 parts.sort() 108 parts.sort()
108 lastend_pri = 0 109 lastend_pri = 0
109 lastend_log = 0 110 lastend_log = 0
110 free_start = -1 111 free_start = -1
111 free_end = -1 112 free_end = -1
112 if start > self._total_sectors: return (-1, -1) 113 if start > self._total_sectors: return (-1, -1)
113 for part in parts: 114 for part in parts:
114 if part > 4: break 115 if part > 4: break
115 tmppart = self._partitions[part] 116 tmppart = self._partitions[part]
116 if (tmppart.get_start() > lastend_pri) and (lastend_pri >= start): 117 if (tmppart.get_start() > (lastend_pri + GAP_SIZE)) and (lastend_pri >= start):
117 free_start = lastend_pri 118 free_start = lastend_pri
118 free_end = tmppart.get_start() - 1 119 free_end = tmppart.get_start() - 1
119 break 120 break
120 if tmppart.is_extended() and start < tmppart.get_end(): 121 if tmppart.is_extended() and start < tmppart.get_end():
121 lastend_log = tmppart.get_start() 122 lastend_log = tmppart.get_start()