fs/orangefs/inode.c
Source file repositories/reference/linux-study-clean/fs/orangefs/inode.c
File Facts
- System
- Linux kernel
- Corpus path
fs/orangefs/inode.c- Extension
.c- Size
- 29538 bytes
- Lines
- 1168
- 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/blkdev.hlinux/fileattr.hprotocol.horangefs-kernel.horangefs-bufmap.h
Detected Declarations
struct orangefs_writepagesfunction orangefs_writepage_lockedfunction orangefs_writepages_workfunction orangefs_writepages_callbackfunction orangefs_writepagesfunction orangefs_readaheadfunction orangefs_read_foliofunction orangefs_write_beginfunction orangefs_write_endfunction orangefs_invalidate_foliofunction folio_posfunction folio_posfunction folio_posfunction orangefs_release_foliofunction orangefs_free_foliofunction orangefs_launder_foliofunction orangefs_direct_IOfunction orangefs_page_mkwritefunction orangefs_setattr_sizefunction __orangefs_setattrfunction __orangefs_setattr_modefunction orangefs_setattrfunction orangefs_getattrfunction orangefs_permissionfunction orangefs_update_timefunction orangefs_fileattr_getfunction orangefs_fileattr_setfunction orangefs_init_iopsfunction identifierfunction orangefs_set_inodefunction orangefs_test_inode
Annotated Snippet
struct orangefs_writepages {
loff_t off;
size_t len;
kuid_t uid;
kgid_t gid;
int maxpages;
int nfolios;
struct address_space *mapping;
struct folio **folios;
struct bio_vec *bv;
};
static int orangefs_writepages_work(struct orangefs_writepages *ow,
struct writeback_control *wbc)
{
struct inode *inode = ow->mapping->host;
struct orangefs_write_range *wrp, wr;
struct iov_iter iter;
ssize_t ret;
size_t start;
loff_t len, off;
int i;
len = i_size_read(inode);
start = offset_in_folio(ow->folios[0], ow->off);
for (i = 0; i < ow->nfolios; i++) {
folio_start_writeback(ow->folios[i]);
bvec_set_folio(&ow->bv[i], ow->folios[i],
folio_size(ow->folios[i]) - start, start);
start = 0;
}
iov_iter_bvec(&iter, ITER_SOURCE, ow->bv, ow->nfolios, ow->len);
WARN_ON(ow->off >= len);
if (ow->off + ow->len > len)
ow->len = len - ow->off;
off = ow->off;
wr.uid = ow->uid;
wr.gid = ow->gid;
ret = wait_for_direct_io(ORANGEFS_IO_WRITE, inode, &off, &iter, ow->len,
0, &wr, NULL, NULL);
if (ret < 0)
mapping_set_error(ow->mapping, ret);
else
ret = 0;
for (i = 0; i < ow->nfolios; i++) {
wrp = folio_detach_private(ow->folios[i]);
kfree(wrp);
folio_end_writeback(ow->folios[i]);
folio_unlock(ow->folios[i]);
}
return ret;
}
static int orangefs_writepages_callback(struct folio *folio,
struct writeback_control *wbc, struct orangefs_writepages *ow)
{
struct orangefs_write_range *wr = folio->private;
int ret;
if (!wr) {
folio_unlock(folio);
/* It's not private so there's nothing to write, right? */
printk("writepages_callback not private!\n");
BUG();
return 0;
}
ret = -1;
if (ow->nfolios == 0) {
ow->off = wr->pos;
ow->len = wr->len;
ow->uid = wr->uid;
ow->gid = wr->gid;
ow->folios[ow->nfolios++] = folio;
ret = 0;
goto done;
}
if (!uid_eq(ow->uid, wr->uid) || !gid_eq(ow->gid, wr->gid)) {
orangefs_writepages_work(ow, wbc);
ow->nfolios = 0;
ret = -1;
goto done;
}
if (ow->off + ow->len == wr->pos) {
ow->len += wr->len;
Annotation
- Immediate include surface: `linux/blkdev.h`, `linux/fileattr.h`, `protocol.h`, `orangefs-kernel.h`, `orangefs-bufmap.h`.
- Detected declarations: `struct orangefs_writepages`, `function orangefs_writepage_locked`, `function orangefs_writepages_work`, `function orangefs_writepages_callback`, `function orangefs_writepages`, `function orangefs_readahead`, `function orangefs_read_folio`, `function orangefs_write_begin`, `function orangefs_write_end`, `function orangefs_invalidate_folio`.
- 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.