fs/squashfs/file_direct.c
Source file repositories/reference/linux-study-clean/fs/squashfs/file_direct.c
File Facts
- System
- Linux kernel
- Corpus path
fs/squashfs/file_direct.c- Extension
.c- Size
- 2988 bytes
- Lines
- 125
- 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/fs.hlinux/vfs.hlinux/kernel.hlinux/slab.hlinux/string.hlinux/pagemap.hlinux/mutex.hsquashfs_fs.hsquashfs_fs_sb.hsquashfs_fs_i.hsquashfs.hpage_actor.h
Detected Declarations
function Copyright
Annotated Snippet
if (PageUptodate(page[i])) {
unlock_page(page[i]);
put_page(page[i]);
continue;
}
i++;
}
pages = i;
/*
* Create a "page actor" which will kmap and kunmap the
* page cache pages appropriately within the decompressor
*/
actor = squashfs_page_actor_init_special(msblk, page, pages, expected,
start_index << PAGE_SHIFT);
if (actor == NULL)
goto out;
/* Decompress directly into the page cache buffers */
res = squashfs_read_data(inode->i_sb, block, bsize, NULL, actor);
last_page = squashfs_page_actor_free(actor);
if (res < 0)
goto mark_errored;
if (res != expected || IS_ERR(last_page)) {
res = -EIO;
goto mark_errored;
}
/* Last page (if present) may have trailing bytes not filled */
bytes = res % PAGE_SIZE;
if (end_index == file_end && last_page && bytes) {
pageaddr = kmap_local_page(last_page);
memset(pageaddr + bytes, 0, PAGE_SIZE - bytes);
kunmap_local(pageaddr);
}
/* Mark pages as uptodate, unlock and release */
for (i = 0; i < pages; i++) {
flush_dcache_page(page[i]);
SetPageUptodate(page[i]);
unlock_page(page[i]);
if (page[i] != target_page)
put_page(page[i]);
}
kfree(page);
return 0;
mark_errored:
/* Decompression failed. Target_page is
* dealt with by the caller
*/
for (i = 0; i < pages; i++) {
if (page[i] == NULL || page[i] == target_page)
continue;
flush_dcache_page(page[i]);
unlock_page(page[i]);
put_page(page[i]);
}
out:
kfree(page);
return res;
}
Annotation
- Immediate include surface: `linux/fs.h`, `linux/vfs.h`, `linux/kernel.h`, `linux/slab.h`, `linux/string.h`, `linux/pagemap.h`, `linux/mutex.h`, `squashfs_fs.h`.
- Detected declarations: `function Copyright`.
- 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.