通用块层的核心数据结构称为bio描述符,它描述了块设备的io操作。每一个bio结构都包含一个磁盘存储区标识符(存储区中的起始扇区号和扇区数目)和一个或多个描述与IO操作相关的内存区段(bio_vec数组)
bio结构中的字段
/*
* main unit of I/O for the block layer and lower layers (ie drivers and
* stacking drivers)
*/
struct bio {
struct bio *bi_next; /* request queue link 链接到请求队列中的下一个bio*/
struct block_device *bi_bdev; /* 指向块设备描述符的指针 */
unsigned int bi_flags; /* status, command, etc bio的状态标志*/
int bi_error;
unsigned long bi_rw; /* bottom bits READ/WRITE, I/O操作标志(低位是读写位,高位是优先级)
* top bits priority
*/
struct bvec_iter bi_iter;
/* Number of segments in this BIO after
* physical address coalescing is performed.
*/
unsigned int bi_phys_segments; //合