fs/btrfs/raid56.h
Source file repositories/reference/linux-study-clean/fs/btrfs/raid56.h
File Facts
- System
- Linux kernel
- Corpus path
fs/btrfs/raid56.h- Extension
.h- Size
- 8628 bytes
- Lines
- 292
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/list.hlinux/spinlock.hlinux/bio.hlinux/refcount.hlinux/workqueue.hvolumes.h
Detected Declarations
struct pagestruct btrfs_fs_infostruct btrfs_raid_biostruct raid56_bio_trace_infostruct btrfs_deviceenum btrfs_rbio_opsfunction nr_data_stripesfunction nr_bioc_data_stripes
Annotated Snippet
struct btrfs_raid_bio {
struct btrfs_io_context *bioc;
/*
* While we're doing RMW on a stripe we put it into a hash table so we
* can lock the stripe and merge more rbios into it.
*/
struct list_head hash_list;
/* LRU list for the stripe cache */
struct list_head stripe_cache;
/* For scheduling work in the helper threads */
struct work_struct work;
/*
* bio_list and bio_list_lock are used to add more bios into the stripe
* in hopes of avoiding the full RMW
*/
struct bio_list bio_list;
spinlock_t bio_list_lock;
/*
* Also protected by the bio_list_lock, the plug list is used by the
* plugging code to collect partial bios while plugged. The stripe
* locking code also uses it to hand off the stripe lock to the next
* pending IO.
*/
struct list_head plug_list;
/* Flags that tell us if it is safe to merge with this bio. */
unsigned long flags;
/*
* Set if we're doing a parity rebuild for a read from higher up, which
* is handled differently from a parity rebuild as part of RMW.
*/
enum btrfs_rbio_ops operation;
/* How many pages there are for the full stripe including P/Q */
u16 nr_pages;
/* How many sectors there are for the full stripe including P/Q */
u16 nr_sectors;
/* Number of data stripes (no p/q) */
u8 nr_data;
/* Number of all stripes (including P/Q) */
u8 real_stripes;
/* How many pages there are for each stripe */
u8 stripe_npages;
/* How many sectors there are for each stripe */
u8 stripe_nsectors;
/*
* How many steps there are for one sector.
*
* For bs > ps cases, it's sectorsize / PAGE_SIZE.
* For bs <= ps cases, it's always 1.
*/
u8 sector_nsteps;
/* Stripe number that we're scrubbing */
u8 scrubp;
/*
* Size of all the bios in the bio_list. This helps us decide if the
* rbio maps to a full stripe or not.
*/
int bio_list_bytes;
refcount_t refs;
atomic_t stripes_pending;
wait_queue_head_t io_wait;
/* Bitmap to record which horizontal stripe has data */
unsigned long dbitmap;
/* Allocated with stripe_nsectors-many bits for finish_*() calls */
unsigned long finish_pbitmap;
/*
* These are two arrays of pointers. We allocate the rbio big enough
* to hold them both and setup their locations when the rbio is
* allocated.
Annotation
- Immediate include surface: `linux/types.h`, `linux/list.h`, `linux/spinlock.h`, `linux/bio.h`, `linux/refcount.h`, `linux/workqueue.h`, `volumes.h`.
- Detected declarations: `struct page`, `struct btrfs_fs_info`, `struct btrfs_raid_bio`, `struct raid56_bio_trace_info`, `struct btrfs_device`, `enum btrfs_rbio_ops`, `function nr_data_stripes`, `function nr_bioc_data_stripes`.
- 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.