fs/ocfs2/quota_local.c
Source file repositories/reference/linux-study-clean/fs/ocfs2/quota_local.c
File Facts
- System
- Linux kernel
- Corpus path
fs/ocfs2/quota_local.c- Extension
.c- Size
- 36523 bytes
- Lines
- 1319
- 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
linux/fs.hlinux/slab.hlinux/quota.hlinux/quotaops.hlinux/module.hcluster/masklog.hocfs2_fs.hocfs2.hinode.halloc.hfile.hbuffer_head_io.hjournal.hsysfile.hdlmglue.hquota.huptodate.hsuper.hocfs2_trace.h
Detected Declarations
function ol_quota_entries_per_blockfunction ol_chunk_blocksfunction ol_chunk_entriesfunction ol_quota_chunk_blockfunction ol_dqblk_blockfunction ol_dqblk_block_offfunction ol_dqblk_offfunction ol_dqblk_block_offsetfunction ol_dqblk_chunk_offfunction ocfs2_modify_bhfunction ocfs2_read_quota_blockfunction ocfs2_local_check_quota_filefunction ocfs2_release_local_quota_bitmapsfunction list_for_each_entry_safefunction ocfs2_load_local_quota_bitmapsfunction olq_update_infofunction ocfs2_add_recovery_chunkfunction free_recovery_listfunction list_for_each_entry_safefunction ocfs2_free_quota_recoveryfunction ocfs2_recovery_load_quotafunction ocfs2_recover_local_quota_filefunction list_for_each_entry_safefunction for_each_set_bitfunction ocfs2_finish_quota_recoveryfunction ocfs2_local_read_infofunction ocfs2_local_write_infofunction ocfs2_local_free_infofunction ocfs2_dismount_volumefunction olq_set_dquotfunction ocfs2_local_write_dquotfunction list_for_each_entryfunction olq_alloc_dquotfunction ocfs2_create_local_dquotfunction ocfs2_local_release_dquot
Annotated Snippet
if (!newchunk) {
ocfs2_release_local_quota_bitmaps(head);
return -ENOMEM;
}
newchunk->qc_num = i;
newchunk->qc_headerbh = NULL;
status = ocfs2_read_quota_block(inode,
ol_quota_chunk_block(inode->i_sb, i),
&newchunk->qc_headerbh);
if (status) {
mlog_errno(status);
kmem_cache_free(ocfs2_qf_chunk_cachep, newchunk);
ocfs2_release_local_quota_bitmaps(head);
return status;
}
list_add_tail(&newchunk->qc_chunk, head);
}
return 0;
}
static void olq_update_info(struct buffer_head *bh, void *private)
{
struct mem_dqinfo *info = private;
struct ocfs2_mem_dqinfo *oinfo = info->dqi_priv;
struct ocfs2_local_disk_dqinfo *ldinfo;
ldinfo = (struct ocfs2_local_disk_dqinfo *)(bh->b_data +
OCFS2_LOCAL_INFO_OFF);
spin_lock(&dq_data_lock);
ldinfo->dqi_flags = cpu_to_le32(oinfo->dqi_flags);
ldinfo->dqi_chunks = cpu_to_le32(oinfo->dqi_chunks);
ldinfo->dqi_blocks = cpu_to_le32(oinfo->dqi_blocks);
spin_unlock(&dq_data_lock);
}
static int ocfs2_add_recovery_chunk(struct super_block *sb,
struct ocfs2_local_disk_chunk *dchunk,
int chunk,
struct list_head *head)
{
struct ocfs2_recovery_chunk *rc;
rc = kmalloc_obj(struct ocfs2_recovery_chunk, GFP_NOFS);
if (!rc)
return -ENOMEM;
rc->rc_chunk = chunk;
rc->rc_bitmap = kzalloc(sb->s_blocksize, GFP_NOFS);
if (!rc->rc_bitmap) {
kfree(rc);
return -ENOMEM;
}
memcpy(rc->rc_bitmap, dchunk->dqc_bitmap,
(ol_chunk_entries(sb) + 7) >> 3);
list_add_tail(&rc->rc_list, head);
return 0;
}
static void free_recovery_list(struct list_head *head)
{
struct ocfs2_recovery_chunk *next;
struct ocfs2_recovery_chunk *rchunk;
list_for_each_entry_safe(rchunk, next, head, rc_list) {
list_del(&rchunk->rc_list);
kfree(rchunk->rc_bitmap);
kfree(rchunk);
}
}
void ocfs2_free_quota_recovery(struct ocfs2_quota_recovery *rec)
{
int type;
for (type = 0; type < OCFS2_MAXQUOTAS; type++)
free_recovery_list(&(rec->r_list[type]));
kfree(rec);
}
/* Load entries in our quota file we have to recover*/
static int ocfs2_recovery_load_quota(struct inode *lqinode,
struct ocfs2_local_disk_dqinfo *ldinfo,
int type,
struct list_head *head)
{
struct super_block *sb = lqinode->i_sb;
struct buffer_head *hbh;
struct ocfs2_local_disk_chunk *dchunk;
int i, chunks = le32_to_cpu(ldinfo->dqi_chunks);
int status = 0;
Annotation
- Immediate include surface: `linux/fs.h`, `linux/slab.h`, `linux/quota.h`, `linux/quotaops.h`, `linux/module.h`, `cluster/masklog.h`, `ocfs2_fs.h`, `ocfs2.h`.
- Detected declarations: `function ol_quota_entries_per_block`, `function ol_chunk_blocks`, `function ol_chunk_entries`, `function ol_quota_chunk_block`, `function ol_dqblk_block`, `function ol_dqblk_block_off`, `function ol_dqblk_off`, `function ol_dqblk_block_offset`, `function ol_dqblk_chunk_off`, `function ocfs2_modify_bh`.
- 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.