Lines Matching full:flush
6 #include "flush.h"
29 /* The current flush generation of the vdo */
31 /* The first unacknowledged flush generation */
33 /* The queue of flush requests waiting to notify other threads */
35 /* The queue of flush requests waiting for VIOs to complete */
37 /* The flush generation for which notifications are being sent */
41 /* The ID of the thread on which flush requests should be made */
43 /* The pool of flush requests */
45 /* Bios waiting for a flush request to become available */
49 /* The rotor for selecting the bio queue for submitting flush bios */
103 struct vdo_flush *flush = NULL; in allocate_flush() local
106 flush = vdo_allocate_memory_nowait(sizeof(struct vdo_flush), __func__); in allocate_flush()
108 int result = vdo_allocate(1, struct vdo_flush, __func__, &flush); in allocate_flush()
111 vdo_log_error_strerror(result, "failed to allocate spare flush"); in allocate_flush()
114 if (flush != NULL) { in allocate_flush()
117 vdo_initialize_completion(&flush->completion, flusher->vdo, in allocate_flush()
121 return flush; in allocate_flush()
182 static void vdo_complete_flush(struct vdo_flush *flush);
189 * the notification of the next flush request if one came in while the current notification was in
206 * flush_packer_callback() - Flush the packer.
210 * flush request. This callback is registered in increment_generation().
222 * increment_generation() - Increment the flush generation in a logical zone.
246 * notify_flush() - Launch a flush notification.
251 struct vdo_flush *flush = in notify_flush() local
254 flusher->notify_generation = flush->flush_generation; in notify_flush()
262 * flush_vdo() - Start processing a flush request.
263 * @completion: A flush request (as a vdo_completion)
269 struct vdo_flush *flush = completion_as_vdo_flush(completion); in flush_vdo() local
279 vdo_complete_flush(flush); in flush_vdo()
283 flush->flush_generation = flusher->flush_generation++; in flush_vdo()
285 vdo_waitq_enqueue_waiter(&flusher->notifiers, &flush->waiter); in flush_vdo()
327 struct vdo_flush *flush = in vdo_complete_flushes() local
330 if (flush->flush_generation >= oldest_active_generation) in vdo_complete_flushes()
333 VDO_ASSERT_LOG_ONLY((flush->flush_generation == in vdo_complete_flushes()
335 "acknowledged next expected flush, %llu, was: %llu", in vdo_complete_flushes()
337 (unsigned long long) flush->flush_generation); in vdo_complete_flushes()
339 vdo_complete_flush(flush); in vdo_complete_flushes()
363 * @flush: The flush to initialize.
369 static void initialize_flush(struct vdo_flush *flush, struct vdo *vdo) in initialize_flush() argument
371 bio_list_init(&flush->bios); in initialize_flush()
372 bio_list_merge_init(&flush->bios, &vdo->flusher->waiting_flush_bios); in initialize_flush()
375 static void launch_flush(struct vdo_flush *flush) in launch_flush() argument
377 struct vdo_completion *completion = &flush->completion; in launch_flush()
385 * vdo_launch_flush() - Function called to start processing a flush request.
387 * @bio: The bio containing an empty flush request.
389 * This is called when we receive an empty flush bio from the block layer, and before acknowledging
395 * Try to allocate a vdo_flush to represent the flush request. If the allocation fails, in vdo_launch_flush()
398 struct vdo_flush *flush = mempool_alloc(vdo->flusher->flush_pool, GFP_NOWAIT); in vdo_launch_flush() local
410 if (flush == NULL) { in vdo_launch_flush()
416 initialize_flush(flush, vdo); in vdo_launch_flush()
420 launch_flush(flush); in vdo_launch_flush()
425 * @flush: The completed flush structure to re-use or free.
427 * If there are any pending flush requests whose vdo_flush allocation failed, they will be launched
431 static void release_flush(struct vdo_flush *flush) in release_flush() argument
434 struct flusher *flusher = flush->completion.vdo->flusher; in release_flush()
440 /* We have flushes to start. Capture them in a flush request. */ in release_flush()
441 initialize_flush(flush, flusher->vdo); in release_flush()
448 launch_flush(flush); in release_flush()
452 mempool_free(flush, flusher->flush_pool); in release_flush()
456 * vdo_complete_flush_callback() - Function called to complete and free a flush request, registered
458 * @completion: The flush request.
462 struct vdo_flush *flush = completion_as_vdo_flush(completion); in vdo_complete_flush_callback() local
466 while ((bio = bio_list_pop(&flush->bios)) != NULL) { in vdo_complete_flush_callback()
481 * Release the flush structure, freeing it, re-using it as the spare, or using it to launch in vdo_complete_flush_callback()
484 release_flush(flush); in vdo_complete_flush_callback()
488 * select_bio_queue() - Select the bio queue on which to finish a flush request.
512 * vdo_complete_flush() - Complete and free a vdo flush request.
513 * @flush: The flush request.
515 static void vdo_complete_flush(struct vdo_flush *flush) in vdo_complete_flush() argument
517 struct vdo_completion *completion = &flush->completion; in vdo_complete_flush()