net/ceph/osd_client.c
Source file repositories/reference/linux-study-clean/net/ceph/osd_client.c
File Facts
- System
- Linux kernel
- Corpus path
net/ceph/osd_client.c- Extension
.c- Size
- 156251 bytes
- Lines
- 5924
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/module.hlinux/err.hlinux/highmem.hlinux/mm.hlinux/pagemap.hlinux/slab.hlinux/uaccess.hlinux/bio.hlinux/ceph/ceph_features.hlinux/ceph/libceph.hlinux/ceph/osd_client.hlinux/ceph/messenger.hlinux/ceph/decode.hlinux/ceph/auth.hlinux/ceph/pagelist.hlinux/ceph/striper.h
Detected Declarations
struct linger_workstruct MOSDOpReplystruct MOSDBackoffenum calc_target_resultfunction rwsem_is_wrlockedfunction verify_osdc_lockedfunction verify_osdc_wrlockedfunction verify_osd_lockedfunction verify_lreq_lockedfunction verify_osdc_lockedfunction ceph_osd_data_initfunction ceph_osd_data_pages_initfunction ceph_osd_data_pagelist_initfunction ceph_osd_data_bio_initfunction ceph_osd_data_bvecs_initfunction ceph_osd_iter_initfunction osd_req_op_raw_data_infunction osd_req_op_extent_osd_datafunction osd_req_op_raw_data_in_pagesfunction osd_req_op_extent_osd_data_pagesfunction osd_req_op_extent_osd_data_biofunction osd_req_op_extent_osd_data_bvecsfunction osd_req_op_extent_osd_data_bvec_posfunction osd_req_op_extent_osd_iterfunction osd_req_op_cls_request_info_pagelistfunction osd_req_op_cls_request_data_pagesfunction osd_req_op_cls_request_data_bvecsfunction osd_req_op_cls_response_data_pagesfunction ceph_osd_data_lengthfunction ceph_osd_data_releasefunction osd_req_op_data_releasefunction target_initfunction target_copyfunction target_destroyfunction request_release_checksfunction ceph_osdc_release_requestfunction ceph_osdc_get_requestfunction ceph_osdc_put_requestfunction request_initfunction ceph_oloc_encoding_sizefunction __ceph_osdc_alloc_messagesfunction osd_req_opcode_validfunction get_num_data_itemsfunction ceph_osdc_alloc_messagesfunction osd_req_op_initfunction osd_req_op_extent_initfunction osd_req_op_extent_updatefunction osd_req_op_extent_dup_last
Annotated Snippet
struct linger_work {
struct work_struct work;
struct ceph_osd_linger_request *lreq;
struct list_head pending_item;
unsigned long queued_stamp;
union {
struct {
u64 notify_id;
u64 notifier_id;
void *payload; /* points into @msg front */
size_t payload_len;
struct ceph_msg *msg; /* for ceph_msg_put() */
} notify;
struct {
int err;
} error;
};
};
static struct linger_work *lwork_alloc(struct ceph_osd_linger_request *lreq,
work_func_t workfn)
{
struct linger_work *lwork;
lwork = kzalloc_obj(*lwork, GFP_NOIO);
if (!lwork)
return NULL;
INIT_WORK(&lwork->work, workfn);
INIT_LIST_HEAD(&lwork->pending_item);
lwork->lreq = linger_get(lreq);
return lwork;
}
static void lwork_free(struct linger_work *lwork)
{
struct ceph_osd_linger_request *lreq = lwork->lreq;
mutex_lock(&lreq->lock);
list_del(&lwork->pending_item);
mutex_unlock(&lreq->lock);
linger_put(lreq);
kfree(lwork);
}
static void lwork_queue(struct linger_work *lwork)
{
struct ceph_osd_linger_request *lreq = lwork->lreq;
struct ceph_osd_client *osdc = lreq->osdc;
verify_lreq_locked(lreq);
WARN_ON(!list_empty(&lwork->pending_item));
lwork->queued_stamp = jiffies;
list_add_tail(&lwork->pending_item, &lreq->pending_lworks);
queue_work(osdc->notify_wq, &lwork->work);
}
static void do_watch_notify(struct work_struct *w)
{
struct linger_work *lwork = container_of(w, struct linger_work, work);
struct ceph_osd_linger_request *lreq = lwork->lreq;
if (!linger_registered(lreq)) {
dout("%s lreq %p not registered\n", __func__, lreq);
goto out;
}
WARN_ON(!lreq->is_watch);
dout("%s lreq %p notify_id %llu notifier_id %llu payload_len %zu\n",
__func__, lreq, lwork->notify.notify_id, lwork->notify.notifier_id,
lwork->notify.payload_len);
lreq->wcb(lreq->data, lwork->notify.notify_id, lreq->linger_id,
lwork->notify.notifier_id, lwork->notify.payload,
lwork->notify.payload_len);
out:
ceph_msg_put(lwork->notify.msg);
lwork_free(lwork);
}
static void do_watch_error(struct work_struct *w)
{
struct linger_work *lwork = container_of(w, struct linger_work, work);
struct ceph_osd_linger_request *lreq = lwork->lreq;
Annotation
- Immediate include surface: `linux/ceph/ceph_debug.h`, `linux/module.h`, `linux/err.h`, `linux/highmem.h`, `linux/mm.h`, `linux/pagemap.h`, `linux/slab.h`, `linux/uaccess.h`.
- Detected declarations: `struct linger_work`, `struct MOSDOpReply`, `struct MOSDBackoff`, `enum calc_target_result`, `function rwsem_is_wrlocked`, `function verify_osdc_locked`, `function verify_osdc_wrlocked`, `function verify_osd_locked`, `function verify_lreq_locked`, `function verify_osdc_locked`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: integration 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.