@@ -337,8 +337,6 @@ int jbd2_cleanup_journal_tail(journal_t *journal)
337
337
338
338
/* Checkpoint list management */
339
339
340
- enum shrink_type {SHRINK_DESTROY , SHRINK_BUSY_STOP , SHRINK_BUSY_SKIP };
341
-
342
340
/*
343
341
* journal_shrink_one_cp_list
344
342
*
@@ -472,21 +470,25 @@ unsigned long jbd2_journal_shrink_checkpoint_list(journal_t *journal,
472
470
* journal_clean_checkpoint_list
473
471
*
474
472
* Find all the written-back checkpoint buffers in the journal and release them.
475
- * If 'destroy' is set, release all buffers unconditionally.
473
+ * If 'type' is SHRINK_DESTROY, release all buffers unconditionally. If 'type'
474
+ * is SHRINK_BUSY_STOP, will stop release buffers if encounters a busy buffer.
475
+ * To avoid wasting CPU cycles scanning the buffer list in some cases, don't
476
+ * pass SHRINK_BUSY_SKIP 'type' for this function.
476
477
*
477
478
* Called with j_list_lock held.
478
479
*/
479
- void __jbd2_journal_clean_checkpoint_list (journal_t * journal , bool destroy )
480
+ void __jbd2_journal_clean_checkpoint_list (journal_t * journal ,
481
+ enum shrink_type type )
480
482
{
481
483
transaction_t * transaction , * last_transaction , * next_transaction ;
482
- enum shrink_type type ;
483
484
bool released ;
484
485
486
+ WARN_ON_ONCE (type == SHRINK_BUSY_SKIP );
487
+
485
488
transaction = journal -> j_checkpoint_transactions ;
486
489
if (!transaction )
487
490
return ;
488
491
489
- type = destroy ? SHRINK_DESTROY : SHRINK_BUSY_STOP ;
490
492
last_transaction = transaction -> t_cpprev ;
491
493
next_transaction = transaction ;
492
494
do {
@@ -527,7 +529,7 @@ void jbd2_journal_destroy_checkpoint(journal_t *journal)
527
529
spin_unlock (& journal -> j_list_lock );
528
530
break ;
529
531
}
530
- __jbd2_journal_clean_checkpoint_list (journal , true );
532
+ __jbd2_journal_clean_checkpoint_list (journal , SHRINK_DESTROY );
531
533
spin_unlock (& journal -> j_list_lock );
532
534
cond_resched ();
533
535
}
0 commit comments