手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Linux I/O Block--递交I/O请求

[日期:2012-12-10] 来源:Linux社区  作者:vanbreaker [字体:大 中 小]

在通用块层中,bio用来描述单一的I/O请求,它记录了一次I/O操作所必需的相关信息,如用于I/O操作的数据缓存位置,I/O操作的块设备起始扇区,是读操作还是写操作等等。struct bio的定义如下

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

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款