Commit 877845cf authored by inaam's avatar inaam

branches/innodb+

Refactor slot selection code in AIO interface.

Pointed by: Sunny
parent 8a3ea85c
...@@ -3451,6 +3451,7 @@ os_aio_array_reserve_slot( ...@@ -3451,6 +3451,7 @@ os_aio_array_reserve_slot(
#endif #endif
ulint i; ulint i;
ulint counter;
ulint slots_per_seg; ulint slots_per_seg;
ulint local_seg; ulint local_seg;
...@@ -3481,17 +3482,13 @@ os_aio_array_reserve_slot( ...@@ -3481,17 +3482,13 @@ os_aio_array_reserve_slot(
goto loop; goto loop;
} }
/* First try to find a slot in the preferred local segment */ /* We start our search for an available slot from our preferred
for (i = local_seg * slots_per_seg; i < array->n_slots; i++) { local segment and do a full scan of the array. We are
slot = os_aio_array_get_nth_slot(array, i); guaranteed to find a slot in full scan. */
for (i = local_seg * slots_per_seg, counter = 0;
if (slot->reserved == FALSE) { counter < array->n_slots; i++, counter++) {
goto found;
}
}
/* Fall back to a full scan. We are guaranteed to find a slot */ i %= array->n_slots;
for (i = 0;; i++) {
slot = os_aio_array_get_nth_slot(array, i); slot = os_aio_array_get_nth_slot(array, i);
if (slot->reserved == FALSE) { if (slot->reserved == FALSE) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment