drivers/block/drbd/drbd_int.h
Source file repositories/reference/linux-study-clean/drivers/block/drbd/drbd_int.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/block/drbd/drbd_int.h- Extension
.h- Size
- 77348 bytes
- Lines
- 2225
- Domain
- Driver Families
- Bucket
- drivers/block
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- 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
crypto/hash.hlinux/compiler.hlinux/types.hlinux/list.hlinux/sched/signal.hlinux/bitops.hlinux/slab.hlinux/ratelimit.hlinux/tcp.hlinux/mutex.hlinux/major.hlinux/blkdev.hlinux/backing-dev.hlinux/idr.hlinux/dynamic_debug.hnet/tcp.hlinux/lru_cache.hlinux/prefetch.hlinux/drbd.hdrbd_config.hdrbd_nl_gen.hdrbd_strings.hdrbd_state.hdrbd_protocol.hdrbd_polymorph_printk.hdrbd_interval.h
Detected Declarations
struct drbd_devicestruct drbd_connectionstruct drbd_peer_devicestruct bm_xfer_ctxstruct drbd_threadstruct drbd_workstruct drbd_device_workstruct drbd_requeststruct drbd_epochstruct digest_infostruct drbd_peer_requeststruct drbd_bitmapstruct drbd_work_queuestruct drbd_socketstruct drbd_mdstruct drbd_backing_devstruct drbd_md_iostruct bm_io_workstruct fifo_bufferstruct drbd_resourcestruct drbd_thread_timing_detailsstruct drbd_connectionstruct submit_workerstruct drbd_peer_devicestruct drbd_devicestruct drbd_bm_aio_ctxstruct drbd_config_contextstruct bm_extentstruct sib_infoenum drbd_thread_stateenum epoch_eventenum bm_flagenum which_stateenum dds_flagsenum determine_dev_sizeenum update_sync_bits_modeenum drbd_force_detach_flagsfunction drbd_insert_faultfunction bm_xfer_ctx_bit_to_word_offsetfunction get_t_statefunction has_net_conffunction conn_peer_devicefunction device_to_minorfunction ov_out_of_sync_printfunction drbd_submit_bio_noacctfunction drbd_read_statefunction __drbd_chk_io_error_function drbd_chk_io_error_
Annotated Snippet
struct bm_xfer_ctx {
/* "const"
* stores total bits and long words
* of the bitmap, so we don't need to
* call the accessor functions over and again. */
unsigned long bm_bits;
unsigned long bm_words;
/* during xfer, current position within the bitmap */
unsigned long bit_offset;
unsigned long word_offset;
/* statistics; index: (h->command == P_BITMAP) */
unsigned packets[2];
unsigned bytes[2];
};
extern void INFO_bm_xfer_stats(struct drbd_peer_device *peer_device,
const char *direction, struct bm_xfer_ctx *c);
static inline void bm_xfer_ctx_bit_to_word_offset(struct bm_xfer_ctx *c)
{
/* word_offset counts "native long words" (32 or 64 bit),
* aligned at 64 bit.
* Encoded packet may end at an unaligned bit offset.
* In case a fallback clear text packet is transmitted in
* between, we adjust this offset back to the last 64bit
* aligned "native long word", which makes coding and decoding
* the plain text bitmap much more convenient. */
#if BITS_PER_LONG == 64
c->word_offset = c->bit_offset >> 6;
#elif BITS_PER_LONG == 32
c->word_offset = c->bit_offset >> 5;
c->word_offset &= ~(1UL);
#else
# error "unsupported BITS_PER_LONG"
#endif
}
extern unsigned int drbd_header_size(struct drbd_connection *connection);
/**********************************************************************/
enum drbd_thread_state {
NONE,
RUNNING,
EXITING,
RESTARTING
};
struct drbd_thread {
spinlock_t t_lock;
struct task_struct *task;
struct completion stop;
enum drbd_thread_state t_state;
int (*function) (struct drbd_thread *);
struct drbd_resource *resource;
struct drbd_connection *connection;
int reset_cpu_mask;
const char *name;
};
static inline enum drbd_thread_state get_t_state(struct drbd_thread *thi)
{
/* THINK testing the t_state seems to be uncritical in all cases
* (but thread_{start,stop}), so we can read it *without* the lock.
* --lge */
smp_rmb();
return thi->t_state;
}
struct drbd_work {
struct list_head list;
int (*cb)(struct drbd_work *, int cancel);
};
struct drbd_device_work {
struct drbd_work w;
struct drbd_device *device;
};
#include "drbd_interval.h"
extern int drbd_wait_misc(struct drbd_device *, struct drbd_interval *);
extern void lock_all_resources(void);
extern void unlock_all_resources(void);
struct drbd_request {
struct drbd_work w;
struct drbd_device *device;
Annotation
- Immediate include surface: `crypto/hash.h`, `linux/compiler.h`, `linux/types.h`, `linux/list.h`, `linux/sched/signal.h`, `linux/bitops.h`, `linux/slab.h`, `linux/ratelimit.h`.
- Detected declarations: `struct drbd_device`, `struct drbd_connection`, `struct drbd_peer_device`, `struct bm_xfer_ctx`, `struct drbd_thread`, `struct drbd_work`, `struct drbd_device_work`, `struct drbd_request`, `struct drbd_epoch`, `struct digest_info`.
- Atlas domain: Driver Families / drivers/block.
- 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.