소스 검색

ext4_journal: improve jbd_journal_alloc_block performance

Purge only one journal transaction if we are run out of journal
device space.
gkostka 9 년 전
부모
커밋
ca673ab65b
1개의 변경된 파일6개의 추가작업 그리고 4개의 파일을 삭제
  1. 6 4
      src/ext4_journal.c

+ 6 - 4
src/ext4_journal.c

@@ -1459,10 +1459,12 @@ static uint32_t jbd_journal_alloc_block(struct jbd_journal *journal,
 	trans->alloc_blocks++;
 	wrap(&journal->jbd_fs->sb, journal->last);
 	
-	/* If there is no space left, flush all journalled
-	 * blocks to disk first.*/
-	if (journal->last == journal->start)
-		jbd_journal_purge_cp_trans(journal, true, false);
+	/* If there is no space left, flush just one journalled
+	 * transaction.*/
+	if (journal->last == journal->start) {
+		jbd_journal_purge_cp_trans(journal, true, true);
+		ext4_assert(journal->last != journal->start);
+	}
 
 	return start_block;
 }