* Add buffer to list of pending writeback requests. */
| 5029 | * Add buffer to list of pending writeback requests. |
| 5030 | */ |
| 5031 | void |
| 5032 | ScheduleBufferTagForWriteback(WritebackContext *context, BufferTag *tag) |
| 5033 | { |
| 5034 | PendingWriteback *pending; |
| 5035 | |
| 5036 | /* |
| 5037 | * Add buffer to the pending writeback array, unless writeback control is |
| 5038 | * disabled. |
| 5039 | */ |
| 5040 | if (*context->max_pending > 0) |
| 5041 | { |
| 5042 | Assert(*context->max_pending <= WRITEBACK_MAX_PENDING_FLUSHES); |
| 5043 | |
| 5044 | pending = &context->pending_writebacks[context->nr_pending++]; |
| 5045 | |
| 5046 | pending->tag = *tag; |
| 5047 | } |
| 5048 | |
| 5049 | /* |
| 5050 | * Perform pending flushes if the writeback limit is exceeded. This |
| 5051 | * includes the case where previously an item has been added, but control |
| 5052 | * is now disabled. |
| 5053 | */ |
| 5054 | if (context->nr_pending >= *context->max_pending) |
| 5055 | IssuePendingWritebacks(context); |
| 5056 | } |
| 5057 | |
| 5058 | #define ST_SORT sort_pending_writebacks |
| 5059 | #define ST_ELEMENT_TYPE PendingWriteback |
no test coverage detected