fs/jbd2/revoke.c
Source file repositories/reference/linux-study-clean/fs/jbd2/revoke.c
File Facts
- System
- Linux kernel
- Corpus path
fs/jbd2/revoke.c- Extension
.c- Size
- 22084 bytes
- Lines
- 746
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
jfs_user.hlinux/time.hlinux/fs.hlinux/jbd2.hlinux/errno.hlinux/slab.hlinux/list.hlinux/init.hlinux/bio.hlinux/log2.hlinux/hash.h
Detected Declarations
struct jbd2_revoke_record_sstruct jbd2_revoke_table_sfunction hashfunction insert_revoke_hashfunction jbd2_journal_destroy_revoke_record_cachefunction jbd2_journal_destroy_revoke_table_cachefunction jbd2_journal_init_revoke_record_cachefunction jbd2_journal_init_revoke_table_cachefunction jbd2_journal_destroy_revoke_tablefunction jbd2_journal_init_revokefunction jbd2_journal_destroy_revokefunction jbd2_journal_revokefunction codefunction jbd2_clear_buffer_revoked_flagsfunction list_for_eachfunction jbd2_journal_switch_revoke_tablefunction jbd2_journal_write_revoke_recordsfunction write_one_revoke_recordfunction flush_descriptorfunction jbd2_journal_set_revokefunction jbd2_journal_test_revokefunction jbd2_journal_clear_revoke
Annotated Snippet
if (record->blocknr == blocknr) {
spin_unlock(&journal->j_revoke_lock);
return record;
}
record = (struct jbd2_revoke_record_s *) record->hash.next;
}
spin_unlock(&journal->j_revoke_lock);
return NULL;
}
void jbd2_journal_destroy_revoke_record_cache(void)
{
kmem_cache_destroy(jbd2_revoke_record_cache);
jbd2_revoke_record_cache = NULL;
}
void jbd2_journal_destroy_revoke_table_cache(void)
{
kmem_cache_destroy(jbd2_revoke_table_cache);
jbd2_revoke_table_cache = NULL;
}
int __init jbd2_journal_init_revoke_record_cache(void)
{
J_ASSERT(!jbd2_revoke_record_cache);
jbd2_revoke_record_cache = KMEM_CACHE(jbd2_revoke_record_s,
SLAB_HWCACHE_ALIGN|SLAB_TEMPORARY);
if (!jbd2_revoke_record_cache) {
pr_emerg("JBD2: failed to create revoke_record cache\n");
return -ENOMEM;
}
return 0;
}
int __init jbd2_journal_init_revoke_table_cache(void)
{
J_ASSERT(!jbd2_revoke_table_cache);
jbd2_revoke_table_cache = KMEM_CACHE(jbd2_revoke_table_s,
SLAB_TEMPORARY);
if (!jbd2_revoke_table_cache) {
pr_emerg("JBD2: failed to create revoke_table cache\n");
return -ENOMEM;
}
return 0;
}
struct jbd2_revoke_table_s *jbd2_journal_init_revoke_table(int hash_size)
{
int shift = 0;
int tmp = hash_size;
struct jbd2_revoke_table_s *table;
table = kmem_cache_alloc(jbd2_revoke_table_cache, GFP_KERNEL);
if (!table)
goto out;
while((tmp >>= 1UL) != 0UL)
shift++;
table->hash_size = hash_size;
table->hash_shift = shift;
table->hash_table =
kvmalloc_objs(struct list_head, hash_size);
if (!table->hash_table) {
kmem_cache_free(jbd2_revoke_table_cache, table);
table = NULL;
goto out;
}
for (tmp = 0; tmp < hash_size; tmp++)
INIT_LIST_HEAD(&table->hash_table[tmp]);
out:
return table;
}
void jbd2_journal_destroy_revoke_table(struct jbd2_revoke_table_s *table)
{
int i;
struct list_head *hash_list;
for (i = 0; i < table->hash_size; i++) {
hash_list = &table->hash_table[i];
J_ASSERT(list_empty(hash_list));
}
kvfree(table->hash_table);
kmem_cache_free(jbd2_revoke_table_cache, table);
}
Annotation
- Immediate include surface: `jfs_user.h`, `linux/time.h`, `linux/fs.h`, `linux/jbd2.h`, `linux/errno.h`, `linux/slab.h`, `linux/list.h`, `linux/init.h`.
- Detected declarations: `struct jbd2_revoke_record_s`, `struct jbd2_revoke_table_s`, `function hash`, `function insert_revoke_hash`, `function jbd2_journal_destroy_revoke_record_cache`, `function jbd2_journal_destroy_revoke_table_cache`, `function jbd2_journal_init_revoke_record_cache`, `function jbd2_journal_init_revoke_table_cache`, `function jbd2_journal_destroy_revoke_table`, `function jbd2_journal_init_revoke`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.