日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

关于BIO结构分析

發布時間:2025/3/21 45 豆豆
生活随笔 收集整理的這篇文章主要介紹了 关于BIO结构分析 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

struct bio {
??????? sector_t??????? bi_sector;?? /* 本次IO操作的其實扇區,扇區都是512字節大小 */
??????? struct bio??????? *bi_next;??? /* 用于鏈接處于同一個request中的BIO */
??????? struct block_device??? *bi_bdev; /* 該bio所請求的塊設備 */
??????? unsigned long??????? bi_flags;??? /* 狀態和命令標志 */
??????? unsigned long??????? bi_rw;??????? /* 標志位,主要用于區分讀寫*/

??????? unsigned short??????? bi_vcnt;??? /* vec向量數組中向量的個數 */
??????? unsigned short??????? bi_idx;??????? /* vec數組中當前處理的向量索引 */

??????? /* Number of segments in this BIO after
???????? * physical address coalescing is performed.
???????? */
??????? unsigned int??????? bi_phys_segments;? /* 合并后的片段數目 */

??????? unsigned int??????? bi_size;??? /* 本BIO數據量,以字節為單位 */

??????? /*
???????? * 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; /* 第一個可合并段的大小,與request合并相關 */
??????? unsigned int??????? bi_seg_back_size; /* 最后一個可合并段的大小,與request合并相關 */

??????? unsigned int??????? bi_max_vecs;??? /* vec向量數組中向量元素個數的上限 */

??????? atomic_t??????? bi_cnt;??????? /* 使用計數 */

??????? struct bio_vec??????? *bi_io_vec;??? /* vec向量數組指針 */

??????? bio_end_io_t??????? *bi_end_io;? /* 該bio結束時的回調函數,一般用于通知調用者該bio的完成情況 */

??????? void??????????? *bi_private; /* 私有指針,通用bio代碼不會使用該成員,一般供底層驅動程序使用 */
??? #if defined(CONFIG_BLK_DEV_INTEGRITY)
??????? struct bio_integrity_payload *bi_integrity; /* data integrity */
??? #endif

??????? bio_destructor_t??? *bi_destructor;??? /* 析構函數,用于在刪除一個bio實例時調用 */

??????? /*
???????? * 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[0];
??? };

?

有幾個重點:
第一:

一個BIO所請求的數據在塊設備中是連續的,對于不連續的數據塊需要放到多個BIO中。
第二:

一個BIO所攜帶的數據大小是有上限的,該上限值由bi_max_vecs間接指定,超過上限的數據塊必須放到多個BIO中。

第三:

使用bio_for_each_segment來遍歷 bio_vec

第四:

BIO、bi_io_vec、page之間的關系

?

總結

以上是生活随笔為你收集整理的关于BIO结构分析的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。