bio中儲存私有數據

bio.bi_private是不能儲存私有數據的,內核中會頻繁使用這個成員。

找了好久也就只找到bio.bi_rw:

/*
 * bio bi_rw flags
 *
 * bit 0 -- data direction
 *	If not set, bio is a read from device. If set, it's a write to device.
 * bit 1 -- fail fast device errors
 * bit 2 -- fail fast transport errors
 * bit 3 -- fail fast driver errors
 * bit 4 -- rw-ahead when set
 * bit 5 -- barrier
 *	Insert a serialization point in the IO queue, forcing previously
 *	submitted IO to be completed before this one is issued.
 * bit 6 -- synchronous I/O hint.
 * bit 7 -- Unplug the device immediately after submitting this bio.
 * bit 8 -- metadata request
 *	Used for tracing to differentiate metadata and data IO. May also
 *	get some preferential treatment in the IO scheduler
 * bit 9 -- discard sectors
 *	Informs the lower level device that this range of sectors is no longer
 *	used by the file system and may thus be freed by the device. Used
 *	for flash based storage.
 *	Don't want driver retries for any fast fail whatever the reason.
 * bit 10 -- Tell the IO scheduler not to wait for more requests after this
	one has been submitted, even if it is a SYNC request.
 */
enum bio_rw_flags {
	BIO_RW,
	BIO_RW_FAILFAST_DEV,
	BIO_RW_FAILFAST_TRANSPORT,
	BIO_RW_FAILFAST_DRIVER,
	/* above flags must match REQ_* */
	BIO_RW_AHEAD,
	BIO_RW_BARRIER,
	BIO_RW_SYNCIO,
	BIO_RW_UNPLUG,
	BIO_RW_META,
	BIO_RW_DISCARD,
	BIO_RW_NOIDLE,
};

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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章