Lines Matching refs:journal
131 static inline int hash(journal_t *journal, unsigned long long block) in hash() argument
133 return hash_64(block, journal->j_revoke->hash_shift); in hash()
136 static int insert_revoke_hash(journal_t *journal, unsigned long long blocknr, in insert_revoke_hash() argument
151 hash_list = &journal->j_revoke->hash_table[hash(journal, blocknr)]; in insert_revoke_hash()
152 spin_lock(&journal->j_revoke_lock); in insert_revoke_hash()
154 spin_unlock(&journal->j_revoke_lock); in insert_revoke_hash()
160 static struct jbd2_revoke_record_s *find_revoke_record(journal_t *journal, in find_revoke_record() argument
166 hash_list = &journal->j_revoke->hash_table[hash(journal, blocknr)]; in find_revoke_record()
168 spin_lock(&journal->j_revoke_lock); in find_revoke_record()
172 spin_unlock(&journal->j_revoke_lock); in find_revoke_record()
177 spin_unlock(&journal->j_revoke_lock); in find_revoke_record()
263 int jbd2_journal_init_revoke(journal_t *journal, int hash_size) in jbd2_journal_init_revoke() argument
265 J_ASSERT(journal->j_revoke_table[0] == NULL); in jbd2_journal_init_revoke()
268 journal->j_revoke_table[0] = jbd2_journal_init_revoke_table(hash_size); in jbd2_journal_init_revoke()
269 if (!journal->j_revoke_table[0]) in jbd2_journal_init_revoke()
272 journal->j_revoke_table[1] = jbd2_journal_init_revoke_table(hash_size); in jbd2_journal_init_revoke()
273 if (!journal->j_revoke_table[1]) in jbd2_journal_init_revoke()
276 journal->j_revoke = journal->j_revoke_table[1]; in jbd2_journal_init_revoke()
278 spin_lock_init(&journal->j_revoke_lock); in jbd2_journal_init_revoke()
283 jbd2_journal_destroy_revoke_table(journal->j_revoke_table[0]); in jbd2_journal_init_revoke()
284 journal->j_revoke_table[0] = NULL; in jbd2_journal_init_revoke()
290 void jbd2_journal_destroy_revoke(journal_t *journal) in jbd2_journal_destroy_revoke() argument
292 journal->j_revoke = NULL; in jbd2_journal_destroy_revoke()
293 if (journal->j_revoke_table[0]) in jbd2_journal_destroy_revoke()
294 jbd2_journal_destroy_revoke_table(journal->j_revoke_table[0]); in jbd2_journal_destroy_revoke()
295 if (journal->j_revoke_table[1]) in jbd2_journal_destroy_revoke()
296 jbd2_journal_destroy_revoke_table(journal->j_revoke_table[1]); in jbd2_journal_destroy_revoke()
330 journal_t *journal; in jbd2_journal_revoke() local
338 journal = handle->h_transaction->t_journal; in jbd2_journal_revoke()
339 if (!jbd2_journal_set_features(journal, 0, 0, JBD2_FEATURE_INCOMPAT_REVOKE)){ in jbd2_journal_revoke()
344 bdev = journal->j_fs_dev; in jbd2_journal_revoke()
348 bh = __find_get_block(bdev, blocknr, journal->j_blocksize); in jbd2_journal_revoke()
358 bh2 = __find_get_block(bdev, blocknr, journal->j_blocksize); in jbd2_journal_revoke()
402 err = insert_revoke_hash(journal, blocknr, in jbd2_journal_revoke()
426 journal_t *journal = handle->h_transaction->t_journal; in jbd2_journal_cancel_revoke() local
445 record = find_revoke_record(journal, bh->b_blocknr); in jbd2_journal_cancel_revoke()
449 spin_lock(&journal->j_revoke_lock); in jbd2_journal_cancel_revoke()
451 spin_unlock(&journal->j_revoke_lock); in jbd2_journal_cancel_revoke()
459 record = find_revoke_record(journal, bh->b_blocknr); in jbd2_journal_cancel_revoke()
484 void jbd2_clear_buffer_revoked_flags(journal_t *journal) in jbd2_clear_buffer_revoked_flags() argument
486 struct jbd2_revoke_table_s *revoke = journal->j_revoke; in jbd2_clear_buffer_revoked_flags()
498 bh = __find_get_block(journal->j_fs_dev, in jbd2_clear_buffer_revoked_flags()
500 journal->j_blocksize); in jbd2_clear_buffer_revoked_flags()
513 void jbd2_journal_switch_revoke_table(journal_t *journal) in jbd2_journal_switch_revoke_table() argument
517 if (journal->j_revoke == journal->j_revoke_table[0]) in jbd2_journal_switch_revoke_table()
518 journal->j_revoke = journal->j_revoke_table[1]; in jbd2_journal_switch_revoke_table()
520 journal->j_revoke = journal->j_revoke_table[0]; in jbd2_journal_switch_revoke_table()
522 for (i = 0; i < journal->j_revoke->hash_size; i++) in jbd2_journal_switch_revoke_table()
523 INIT_LIST_HEAD(&journal->j_revoke->hash_table[i]); in jbd2_journal_switch_revoke_table()
533 journal_t *journal = transaction->t_journal; in jbd2_journal_write_revoke_records() local
545 revoke = journal->j_revoke == journal->j_revoke_table[0] ? in jbd2_journal_write_revoke_records()
546 journal->j_revoke_table[1] : journal->j_revoke_table[0]; in jbd2_journal_write_revoke_records()
562 flush_descriptor(journal, descriptor, offset); in jbd2_journal_write_revoke_records()
577 journal_t *journal = transaction->t_journal; in write_one_revoke_record() local
586 if (is_journal_aborted(journal)) in write_one_revoke_record()
593 if (jbd2_journal_has_csum_v2or3(journal)) in write_one_revoke_record()
596 if (jbd2_has_feature_64bit(journal)) in write_one_revoke_record()
603 if (offset + sz > journal->j_blocksize - csum_size) { in write_one_revoke_record()
604 flush_descriptor(journal, descriptor, offset); in write_one_revoke_record()
623 if (jbd2_has_feature_64bit(journal)) in write_one_revoke_record()
641 static void flush_descriptor(journal_t *journal, in flush_descriptor() argument
647 if (is_journal_aborted(journal)) in flush_descriptor()
652 jbd2_descriptor_block_csum_set(journal, descriptor); in flush_descriptor()
683 int jbd2_journal_set_revoke(journal_t *journal, in jbd2_journal_set_revoke() argument
689 record = find_revoke_record(journal, blocknr); in jbd2_journal_set_revoke()
697 return insert_revoke_hash(journal, blocknr, sequence); in jbd2_journal_set_revoke()
707 int jbd2_journal_test_revoke(journal_t *journal, in jbd2_journal_test_revoke() argument
713 record = find_revoke_record(journal, blocknr); in jbd2_journal_test_revoke()
726 void jbd2_journal_clear_revoke(journal_t *journal) in jbd2_journal_clear_revoke() argument
733 revoke = journal->j_revoke; in jbd2_journal_clear_revoke()