fs/gfs2/xattr.c
Source file repositories/reference/linux-study-clean/fs/gfs2/xattr.c
File Facts
- System
- Linux kernel
- Corpus path
fs/gfs2/xattr.c- Extension
.c- Size
- 33769 bytes
- Lines
- 1513
- 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.
- 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/slab.hlinux/spinlock.hlinux/completion.hlinux/buffer_head.hlinux/xattr.hlinux/gfs2_ondisk.hlinux/posix_acl_xattr.hlinux/uaccess.hgfs2.hincore.hacl.hxattr.hglock.hinode.hmeta_io.hquota.hrgrp.hsuper.htrans.hutil.h
Detected Declarations
struct ea_findstruct ea_liststruct ea_setfunction Copyrightfunction ea_check_sizefunction gfs2_eatype_validfunction ea_foreach_ifunction ea_foreachfunction ea_find_ifunction gfs2_ea_findfunction ea_dealloc_unstuffedfunction ea_remove_unstuffedfunction ea_list_ifunction gfs2_listxattrfunction gfs2_iter_unstuffedfunction gfs2_ea_get_copyfunction gfs2_xattr_acl_getfunction __gfs2_xattr_getfunction gfs2_xattr_getfunction ea_alloc_blkfunction ea_writefunction ea_alloc_skeletonfunction ea_init_ifunction ea_initfunction ea_set_remove_stuffedfunction ea_set_simple_noallocfunction ea_set_simple_allocfunction ea_set_simplefunction ea_set_blockfunction ea_set_ifunction ea_set_remove_unstuffedfunction ea_remove_stuffedfunction thefunction gfs2_xattr_removefunction gfs2_xattr_setfunction ea_dealloc_indirectfunction ea_dealloc_blockfunction gfs2_ea_deallocfunction gfs2_xattr_trusted_list
Annotated Snippet
struct ea_find {
int type;
const char *name;
size_t namel;
struct gfs2_ea_location *ef_el;
};
static int ea_find_i(struct gfs2_inode *ip, struct buffer_head *bh,
struct gfs2_ea_header *ea, struct gfs2_ea_header *prev,
void *private)
{
struct ea_find *ef = private;
if (ea->ea_type == GFS2_EATYPE_UNUSED)
return 0;
if (ea->ea_type == ef->type) {
if (ea->ea_name_len == ef->namel &&
!memcmp(GFS2_EA2NAME(ea), ef->name, ea->ea_name_len)) {
struct gfs2_ea_location *el = ef->ef_el;
get_bh(bh);
el->el_bh = bh;
el->el_ea = ea;
el->el_prev = prev;
return 1;
}
}
return 0;
}
static int gfs2_ea_find(struct gfs2_inode *ip, int type, const char *name,
struct gfs2_ea_location *el)
{
struct ea_find ef;
int error;
ef.type = type;
ef.name = name;
ef.namel = strlen(name);
ef.ef_el = el;
memset(el, 0, sizeof(struct gfs2_ea_location));
error = ea_foreach(ip, ea_find_i, &ef);
if (error > 0)
return 0;
return error;
}
/*
* ea_dealloc_unstuffed
*
* Take advantage of the fact that all unstuffed blocks are
* allocated from the same RG. But watch, this may not always
* be true.
*
* Returns: errno
*/
static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
struct gfs2_ea_header *ea,
struct gfs2_ea_header *prev, void *private)
{
int *leave = private;
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct gfs2_rgrpd *rgd;
struct gfs2_holder rg_gh;
__be64 *dataptrs;
u64 bn = 0;
u64 bstart = 0;
unsigned int blen = 0;
unsigned int blks = 0;
unsigned int x;
int error;
error = gfs2_rindex_update(sdp);
if (error)
return error;
if (GFS2_EA_IS_STUFFED(ea))
return 0;
dataptrs = GFS2_EA2DATAPTRS(ea);
for (x = 0; x < ea->ea_num_ptrs; x++, dataptrs++) {
if (*dataptrs) {
blks++;
bn = be64_to_cpu(*dataptrs);
}
Annotation
- Immediate include surface: `linux/slab.h`, `linux/spinlock.h`, `linux/completion.h`, `linux/buffer_head.h`, `linux/xattr.h`, `linux/gfs2_ondisk.h`, `linux/posix_acl_xattr.h`, `linux/uaccess.h`.
- Detected declarations: `struct ea_find`, `struct ea_list`, `struct ea_set`, `function Copyright`, `function ea_check_size`, `function gfs2_eatype_valid`, `function ea_foreach_i`, `function ea_foreach`, `function ea_find_i`, `function gfs2_ea_find`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
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.