主权项 |
1. A method for allocating space on a logical disk, the method comprising the steps of:
a computer receiving an allocation request to allocate a number of requested logical disk extents; the computer selecting one of a first group comprising an array of logical disk extents and a second group comprising an array of logical disk extents, the selected group having a number of free logical disk extents that is greater than or equal to the number of requested logical disk extents, the logical disk extents in the array of the first group and in the array of the second group corresponding to disk blocks on a logical disk, the logical disk spanning one or more physical random access disks; the computer locking the selected group to prevent allocating a logical disk extent other than in response to the allocation request; the computer allocating the number of requested logical disk extents in the selected group, starting at a first index in the array of the selected group; the computer moving a first pointer from the first index in the array of the selected group to a second index in the array of the selected group based at least in part on the number of requested logical disk extents; the computer releasing the lock on the selected group to allow allocating a logical disk extent other than in response to the allocation request; and the computer calculating the number of free logical disk extents, wherein: (a) if the second index, corresponding to the first pointer, in the array of the selected group is greater than or equal to a third index corresponding to the a second pointer indicative of a starting index for de-allocation of logical disk extents in the array of the selected group, the calculated number of free logical disk extents is equal to the sum of the third index in the array of the selected group and a size of the array in the selected group, minus the second index in the array of the selected group, and (b) if the second index in the array of the selected group is less than the third index in the array of the selected group, the calculated number of free logical disk extents is equal to the third index in the array of the selected group minus the second index in the array of the selected group. |