* This is the list priority from which the L2ARC will search for pages to * cache. This is used within loops (0..3) to cycle through lists in the * desired order. This order can have a significant effect on cache * performance. * * Currently the metadata lists are hit first, MFU then MRU, followed by * the data lists. This function returns a locked list, and also returns * the lock point
| 8614 | * the lock pointer. |
| 8615 | */ |
| 8616 | static multilist_sublist_t * |
| 8617 | l2arc_sublist_lock(int list_num) |
| 8618 | { |
| 8619 | multilist_t *ml = NULL; |
| 8620 | unsigned int idx; |
| 8621 | |
| 8622 | ASSERT(list_num >= 0 && list_num < L2ARC_FEED_TYPES); |
| 8623 | |
| 8624 | switch (list_num) { |
| 8625 | case 0: |
| 8626 | ml = arc_mfu->arcs_list[ARC_BUFC_METADATA]; |
| 8627 | break; |
| 8628 | case 1: |
| 8629 | ml = arc_mru->arcs_list[ARC_BUFC_METADATA]; |
| 8630 | break; |
| 8631 | case 2: |
| 8632 | ml = arc_mfu->arcs_list[ARC_BUFC_DATA]; |
| 8633 | break; |
| 8634 | case 3: |
| 8635 | ml = arc_mru->arcs_list[ARC_BUFC_DATA]; |
| 8636 | break; |
| 8637 | default: |
| 8638 | return (NULL); |
| 8639 | } |
| 8640 | |
| 8641 | /* |
| 8642 | * Return a randomly-selected sublist. This is acceptable |
| 8643 | * because the caller feeds only a little bit of data for each |
| 8644 | * call (8MB). Subsequent calls will result in different |
| 8645 | * sublists being selected. |
| 8646 | */ |
| 8647 | idx = multilist_get_random_index(ml); |
| 8648 | return (multilist_sublist_lock(ml, idx)); |
| 8649 | } |
| 8650 | |
| 8651 | /* |
| 8652 | * Calculates the maximum overhead of L2ARC metadata log blocks for a given |
no test coverage detected