fs/xfs/xfs_buf.h
Source file repositories/reference/linux-study-clean/fs/xfs/xfs_buf.h
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/xfs_buf.h- Extension
.h- Size
- 11690 bytes
- Lines
- 377
- 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/list.hlinux/types.hlinux/spinlock.hlinux/mm.hlinux/fs.hlinux/dax.hlinux/uio.hlinux/list_lru.hlinux/lockref.h
Detected Declarations
struct xfs_bufstruct xfs_buftargstruct xfs_buf_mapstruct xfs_buf_opsstruct xfs_buffunction xfs_buf_incorefunction xfs_buf_getfunction xfs_buf_readfunction xfs_buf_readaheadfunction xfs_buf_relsefunction xfs_buf_zerofunction xfs_buf_daddrfunction xfs_buf_oneshotfunction xfs_buf_ispinnedfunction xfs_buf_verify_cksumfunction xfs_buf_update_cksum
Annotated Snippet
struct xfs_buftarg {
dev_t bt_dev;
struct block_device *bt_bdev;
struct dax_device *bt_daxdev;
struct file *bt_file;
u64 bt_dax_part_off;
struct xfs_mount *bt_mount;
unsigned int bt_meta_sectorsize;
size_t bt_meta_sectormask;
size_t bt_logical_sectorsize;
size_t bt_logical_sectormask;
xfs_daddr_t bt_nr_sectors;
/* LRU control structures */
struct shrinker *bt_shrinker;
struct list_lru bt_lru;
struct percpu_counter bt_readahead_count;
struct ratelimit_state bt_ioerror_rl;
/* Hardware atomic write unit values, bytes */
unsigned int bt_awu_min;
unsigned int bt_awu_max;
struct rhashtable bt_hash;
};
struct xfs_buf_map {
xfs_daddr_t bm_bn; /* block number for I/O */
int bm_len; /* size of I/O */
unsigned int bm_flags;
};
/*
* Online fsck is scanning the buffer cache for live buffers. Do not warn
* about length mismatches during lookups and do not return stale buffers.
*/
#define XBM_LIVESCAN (1U << 0)
#define DEFINE_SINGLE_BUF_MAP(map, blkno, numblk) \
struct xfs_buf_map (map) = { .bm_bn = (blkno), .bm_len = (numblk) };
struct xfs_buf_ops {
char *name;
union {
__be32 magic[2]; /* v4 and v5 on disk magic values */
__be16 magic16[2]; /* v4 and v5 on disk magic values */
};
void (*verify_read)(struct xfs_buf *);
void (*verify_write)(struct xfs_buf *);
xfs_failaddr_t (*verify_struct)(struct xfs_buf *bp);
};
struct xfs_buf {
/*
* first cacheline holds all the fields needed for an uncontended cache
* hit to be fully processed. The semaphore straddles the cacheline
* boundary, but the counter and lock sits on the first cacheline,
* which is the only bit that is touched if we hit the semaphore
* fast-path on locking.
*/
struct rhash_head b_rhash_head; /* pag buffer hash node */
xfs_daddr_t b_rhash_key; /* buffer cache index */
int b_length; /* size of buffer in BBs */
struct lockref b_lockref; /* refcount + lock */
atomic_t b_lru_ref; /* lru reclaim ref count */
xfs_buf_flags_t b_flags; /* status flags */
struct semaphore b_sema; /* semaphore for lockables */
/*
* concurrent access to b_lru and b_lru_flags are protected by
* bt_lru_lock and not by b_sema
*/
struct list_head b_lru; /* lru list */
wait_queue_head_t b_waiters; /* unpin waiters */
struct list_head b_list;
struct xfs_perag *b_pag;
struct xfs_mount *b_mount;
struct xfs_buftarg *b_target; /* buffer target (device) */
void *b_addr; /* virtual address of buffer */
struct work_struct b_ioend_work;
struct completion b_iowait; /* queue for I/O waiters */
struct xfs_buf_log_item *b_log_item;
struct list_head b_li_list; /* Log items list head */
struct xfs_trans *b_transp;
struct xfs_buf_map *b_maps; /* compound buffer map */
struct xfs_buf_map __b_map; /* inline compound buffer map */
int b_map_count;
atomic_t b_pin_count; /* pin count */
Annotation
- Immediate include surface: `linux/list.h`, `linux/types.h`, `linux/spinlock.h`, `linux/mm.h`, `linux/fs.h`, `linux/dax.h`, `linux/uio.h`, `linux/list_lru.h`.
- Detected declarations: `struct xfs_buf`, `struct xfs_buftarg`, `struct xfs_buf_map`, `struct xfs_buf_ops`, `struct xfs_buf`, `function xfs_buf_incore`, `function xfs_buf_get`, `function xfs_buf_read`, `function xfs_buf_readahead`, `function xfs_buf_relse`.
- 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.