fs/nilfs2/bmap.h
Source file repositories/reference/linux-study-clean/fs/nilfs2/bmap.h
File Facts
- System
- Linux kernel
- Corpus path
fs/nilfs2/bmap.h- Extension
.h- Size
- 8694 bytes
- Lines
- 284
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/fs.hlinux/buffer_head.hlinux/nilfs2_ondisk.halloc.hdat.h
Detected Declarations
struct nilfs_bmapstruct nilfs_bmap_statsstruct nilfs_bmap_operationsstruct nilfs_bmapstruct nilfs_bmap_storefunction nilfs_bmap_is_new_ptrfunction nilfs_bmap_lookupfunction nilfs_bmap_prepare_alloc_ptrfunction nilfs_bmap_commit_alloc_ptrfunction nilfs_bmap_abort_alloc_ptrfunction nilfs_bmap_prepare_end_ptrfunction nilfs_bmap_commit_end_ptrfunction nilfs_bmap_abort_end_ptrfunction nilfs_bmap_set_target_vfunction nilfs_bmap_dirtyfunction nilfs_bmap_set_dirtyfunction nilfs_bmap_clear_dirty
Annotated Snippet
struct nilfs_bmap_stats {
unsigned int bs_nblocks;
};
/**
* struct nilfs_bmap_operations - bmap operation table
* @bop_lookup: single block search operation
* @bop_lookup_contig: consecutive block search operation
* @bop_insert: block insertion operation
* @bop_delete: block delete operation
* @bop_clear: block mapping resource release operation
* @bop_propagate: operation to propagate dirty state towards the
* mapping root
* @bop_lookup_dirty_buffers: operation to collect dirty block buffers
* @bop_assign: disk block address assignment operation
* @bop_mark: operation to mark in-use blocks as dirty for
* relocation by GC
* @bop_seek_key: find valid block key operation
* @bop_last_key: find last valid block key operation
*/
struct nilfs_bmap_operations {
int (*bop_lookup)(const struct nilfs_bmap *, __u64, int, __u64 *);
int (*bop_lookup_contig)(const struct nilfs_bmap *, __u64, __u64 *,
unsigned int);
int (*bop_insert)(struct nilfs_bmap *, __u64, __u64);
int (*bop_delete)(struct nilfs_bmap *, __u64);
void (*bop_clear)(struct nilfs_bmap *);
int (*bop_propagate)(struct nilfs_bmap *, struct buffer_head *);
void (*bop_lookup_dirty_buffers)(struct nilfs_bmap *,
struct list_head *);
int (*bop_assign)(struct nilfs_bmap *,
struct buffer_head **,
sector_t,
union nilfs_binfo *);
int (*bop_mark)(struct nilfs_bmap *, __u64, int);
int (*bop_seek_key)(const struct nilfs_bmap *, __u64, __u64 *);
int (*bop_last_key)(const struct nilfs_bmap *, __u64 *);
/* private: internal use only */
int (*bop_check_insert)(const struct nilfs_bmap *, __u64);
int (*bop_check_delete)(struct nilfs_bmap *, __u64);
int (*bop_gather_data)(struct nilfs_bmap *, __u64 *, __u64 *, int);
};
#define NILFS_BMAP_SIZE (NILFS_INODE_BMAP_SIZE * sizeof(__le64))
#define NILFS_BMAP_KEY_BIT BITS_PER_LONG
#define NILFS_BMAP_NEW_PTR_INIT (1UL << (BITS_PER_LONG - 1))
static inline int nilfs_bmap_is_new_ptr(unsigned long ptr)
{
return !!(ptr & NILFS_BMAP_NEW_PTR_INIT);
}
/**
* struct nilfs_bmap - bmap structure
* @b_u: raw data
* @b_sem: semaphore
* @b_inode: owner of bmap
* @b_ops: bmap operation table
* @b_last_allocated_key: last allocated key for data block
* @b_last_allocated_ptr: last allocated ptr for data block
* @b_ptr_type: pointer type
* @b_state: state
* @b_nchildren_per_block: maximum number of child nodes for non-root nodes
*/
struct nilfs_bmap {
union {
__u8 u_flags;
__le64 u_data[NILFS_BMAP_SIZE / sizeof(__le64)];
} b_u;
struct rw_semaphore b_sem;
struct inode *b_inode;
const struct nilfs_bmap_operations *b_ops;
__u64 b_last_allocated_key;
__u64 b_last_allocated_ptr;
int b_ptr_type;
int b_state;
__u16 b_nchildren_per_block;
};
/* pointer type */
#define NILFS_BMAP_PTR_P 0 /* physical block number (i.e. LBN) */
#define NILFS_BMAP_PTR_VS 1 /*
* virtual block number (single
* version)
Annotation
- Immediate include surface: `linux/types.h`, `linux/fs.h`, `linux/buffer_head.h`, `linux/nilfs2_ondisk.h`, `alloc.h`, `dat.h`.
- Detected declarations: `struct nilfs_bmap`, `struct nilfs_bmap_stats`, `struct nilfs_bmap_operations`, `struct nilfs_bmap`, `struct nilfs_bmap_store`, `function nilfs_bmap_is_new_ptr`, `function nilfs_bmap_lookup`, `function nilfs_bmap_prepare_alloc_ptr`, `function nilfs_bmap_commit_alloc_ptr`, `function nilfs_bmap_abort_alloc_ptr`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
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.