bio(linux操作系统核心数据结构)

2023-01-28 58阅读

温馨提示:这篇文章已超过451天没有更新,请注意相关的内容是否还可用!

bio

linux操作系统核心数据结构

bio是linux内核中通用块层的一个核心数据结构,它描述了块设备的I/O操作。内核中块I/O操作的基本容器由bio结构体表示,它定义在文件include/linux/bio.h中。该结构体代表了正在活动的以段(segment)链表形式组织的块I/O操作。一个段是一小块连续的内存缓冲区。这样,单个缓冲区就不一定要连续。所以使用段来描述缓冲区,即使一个缓冲区分散在内存的多个位置上,bio结构体也能对内核保证I/O操作的执行。这样的向量I/O称为分散-聚合I/O。bio结构体中的主要成员变量都是用来管理I/O操作执行的相关信息的,其中最重要的几个成员变量是bi_io_vecs、bi_vcnt和bi_idx。

中文名幻灯片 24BIO
英文名bio
全 名Before in Office
类 型程序
用 途提供就业前的咨询和心理辅导

简介

幻灯片24BIO,Before in Office的缩写形式。

当前面临那些即将进入职场的人们,特别是应届学生们来说,如果找到一份适合自己的工作和如何才能在办公室政治中立于不败之地是非常重要的课题。

那么BIO应运而生,BIO主要为即将进入职场的朋友们提供就业前的咨询和心理辅导。

前缀pref.

表示"生命","生物"(如:biochemistry)

Biology(生物学)的缩写

一种不能用语言表示的奇怪的感觉或者生活状态,或者口头禅,仅适用与小部分人群,可能你的身边就有这种人存在,当你告诉他时,他会很吃惊。因为这很surprise,哇哈哈,还有它的变异体。比如阿啦BIO,在这种人群中,本词语在任何话语或感觉中都适用,因为它全都可以概括。

具体字段

bio(block input output)块的输入和输出

bio是linux内核中通用块层的一个核心数据结构,它描述了块设备的I/O操作。它联系了内存缓冲区与块设备。

具体字段如下:

/*

* main unit of I/O for the block layer and lower layers (ie drivers and

* stacking drivers)

*/

struct bio {

sector_t bi_sector; /* device address in 512 byte

sectors */

struct bio *bi_next; /* request queue link */

struct block_device *bi_bdev;

unsigned long bi_flags; /* status, command, etc */

unsigned long bi_rw; /* bottom bits READ/WRITE,

* top bits priority

*/

unsigned short bi_vcnt; /* how many bio_vec's */

unsigned short bi_idx; /* current index into bvl_vec */

/* Number of segments in this BIO after

* physical address coalescing is performed.

*/

unsigned int bi_phys_segments;

unsigned int bi_size; /* residual I/O count */

/*

* To keep track of the max segment size, we account for the

* sizes of the first and last mergeable segments in this bio.

*/

unsigned int bi_seg_front_size;

unsigned int bi_seg_back_size;

unsigned int bi_max_vecs; /* max bvl_vecs we can hold */

unsigned int bi_comp_cpu; /* completion CPU */

atomic_t bi_cnt; /* pin count */

struct bio_vec *bi_io_vec; /* the actual vec list */

bio_end_io_t *bi_end_io;

void *bi_private;

#if defined(CONFIG_BLK_DEV_INTEGRITY)

struct bio_integrity_payload *bi_integrity; /* data integrity */

#endif

bio_destructor_t *bi_destructor; /* destructor */

/*

* We can inline a number of vecs at the end of the bio, to avoid

* double allocations for a small number of bio_vecs. This member

* MUST obviously be kept at the very end of the bio.

*/

struct bio_vec bi_inline_vecs;

};

参考资料

1.内核基础(十)文件通用块层·chinaunix博客

2.bio详细资料大全·历史新知

目录[+]