fs/ceph/addr.c
Source file repositories/reference/linux-study-clean/fs/ceph/addr.c
File Facts
- System
- Linux kernel
- Corpus path
fs/ceph/addr.c- Extension
.c- Size
- 72060 bytes
- Lines
- 2636
- 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/ceph/ceph_debug.hlinux/backing-dev.hlinux/fs.hlinux/mm.hlinux/swap.hlinux/pagemap.hlinux/slab.hlinux/folio_batch.hlinux/task_io_accounting_ops.hlinux/signal.hlinux/iversion.hlinux/ktime.hlinux/netfs.htrace/events/netfs.hsuper.hmds_client.hcache.hmetric.hsubvolume_metrics.hcrypto.hlinux/ceph/osd_client.hlinux/ceph/striper.h
Detected Declarations
struct ceph_writeback_ctlfunction ceph_dirty_foliofunction foliofunction ceph_netfs_expand_readaheadfunction finish_netfs_readfunction ceph_netfs_issue_op_inlinefunction ceph_netfs_prepare_readfunction ceph_netfs_issue_readfunction ceph_init_requestfunction ceph_netfs_free_requestfunction ceph_set_page_fscachefunction ceph_fscache_write_terminatedfunction ceph_fscache_write_to_cachefunction ceph_set_page_fscachefunction get_oldest_contextfunction get_writepages_data_lengthfunction list_for_each_entryfunction accountingfunction writepages_finishfunction is_forced_umountfunction ceph_define_write_sizefunction ceph_folio_batch_initfunction ceph_folio_batch_reinitfunction ceph_init_writeback_ctlfunction ceph_define_writeback_rangefunction has_writeback_donefunction can_next_page_be_processedfunction ceph_check_page_before_writefunction __ceph_allocate_page_arrayfunction ceph_allocate_page_arrayfunction is_folio_index_contiguousfunction is_num_ops_too_bigfunction is_write_congestion_happenedfunction move_dirty_folio_in_page_arrayfunction ceph_process_folio_batchfunction ceph_shift_unused_folios_leftfunction ceph_submit_writefunction ceph_wait_until_current_writes_completefunction ceph_writepages_startfunction context_is_writeable_or_writtenfunction ceph_find_incompatiblefunction ceph_netfs_check_write_beginfunction ceph_write_beginfunction ceph_write_endfunction ceph_block_sigsfunction ceph_restore_sigsfunction ceph_filemap_faultfunction ceph_page_mkwrite
Annotated Snippet
if (IS_ENCRYPTED(inode) && err > 0) {
err = ceph_fscrypt_decrypt_extents(inode,
osd_data->pages, subreq->start,
op->extent.sparse_ext,
op->extent.sparse_ext_cnt);
if (err > subreq->len)
err = subreq->len;
}
if (err > 0)
__set_bit(NETFS_SREQ_CLEAR_TAIL, &subreq->flags);
}
if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGES) {
ceph_put_page_vector(osd_data->pages,
calc_pages_for(osd_data->alignment,
osd_data->length), false);
}
if (err > 0) {
ceph_subvolume_metrics_record_io(fsc->mdsc, ceph_inode(inode),
false, err,
req->r_start_latency,
req->r_end_latency);
subreq->transferred = err;
err = 0;
}
subreq->error = err;
trace_netfs_sreq(subreq, netfs_sreq_trace_io_progress);
netfs_read_subreq_terminated(subreq);
iput(req->r_inode);
ceph_dec_osd_stopping_blocker(fsc->mdsc);
}
static bool ceph_netfs_issue_op_inline(struct netfs_io_subrequest *subreq)
{
struct netfs_io_request *rreq = subreq->rreq;
struct inode *inode = rreq->inode;
struct ceph_mds_reply_info_parsed *rinfo;
struct ceph_mds_reply_info_in *iinfo;
struct ceph_mds_request *req;
struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(inode->i_sb);
struct ceph_inode_info *ci = ceph_inode(inode);
ssize_t err = 0;
size_t len;
int mode;
if (rreq->origin != NETFS_UNBUFFERED_READ &&
rreq->origin != NETFS_DIO_READ)
__set_bit(NETFS_SREQ_CLEAR_TAIL, &subreq->flags);
__clear_bit(NETFS_SREQ_COPY_TO_CACHE, &subreq->flags);
if (subreq->start >= inode->i_size)
goto out;
/* We need to fetch the inline data. */
mode = ceph_try_to_choose_auth_mds(inode, CEPH_STAT_CAP_INLINE_DATA);
req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_GETATTR, mode);
if (IS_ERR(req)) {
err = PTR_ERR(req);
goto out;
}
req->r_ino1 = ci->i_vino;
req->r_args.getattr.mask = cpu_to_le32(CEPH_STAT_CAP_INLINE_DATA);
req->r_num_caps = 2;
trace_netfs_sreq(subreq, netfs_sreq_trace_submit);
err = ceph_mdsc_do_request(mdsc, NULL, req);
if (err < 0)
goto out;
rinfo = &req->r_reply_info;
iinfo = &rinfo->targeti;
if (iinfo->inline_version == CEPH_INLINE_NONE) {
/* The data got uninlined */
ceph_mdsc_put_request(req);
return false;
}
len = min_t(size_t, iinfo->inline_len - subreq->start, subreq->len);
err = copy_to_iter(iinfo->inline_data + subreq->start, len, &subreq->io_iter);
if (err == 0) {
err = -EFAULT;
} else {
subreq->transferred += err;
err = 0;
}
ceph_mdsc_put_request(req);
out:
subreq->error = err;
trace_netfs_sreq(subreq, netfs_sreq_trace_io_progress);
Annotation
- Immediate include surface: `linux/ceph/ceph_debug.h`, `linux/backing-dev.h`, `linux/fs.h`, `linux/mm.h`, `linux/swap.h`, `linux/pagemap.h`, `linux/slab.h`, `linux/folio_batch.h`.
- Detected declarations: `struct ceph_writeback_ctl`, `function ceph_dirty_folio`, `function folio`, `function ceph_netfs_expand_readahead`, `function finish_netfs_read`, `function ceph_netfs_issue_op_inline`, `function ceph_netfs_prepare_read`, `function ceph_netfs_issue_read`, `function ceph_init_request`, `function ceph_netfs_free_request`.
- 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.