Skip to content

Commit 11506b3

Browse files
Andreas Hindborgaxboe
authored andcommitted
block: update docs for bio and bvec_iter
The documentation for bio and bvec_iter refers to a vector named bvl_vec. This does not exist. Update the documentation comment with correct use. Also update documentation comments for remaining fields of `bvec_iter` to improve readability. The fields of `bvec_iter` is using a mix of tabs and spaces for indentation. While at it, change them all to tabs, which is most prevalent in this struct definition. Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 453daec commit 11506b3

2 files changed

Lines changed: 28 additions & 9 deletions

File tree

include/linux/blk_types.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,13 @@ struct bio {
273273
* Everything starting with bi_max_vecs will be preserved by bio_reset()
274274
*/
275275

276-
unsigned short bi_max_vecs; /* max bvl_vecs we can hold */
276+
/*
277+
* Number of elements in `bi_io_vec` that were allocated for this bio.
278+
* Only used by the bio submitter to make `bio_add_page` fail once full
279+
* and to free the `bi_io_vec` allocation. Must not be used in drivers
280+
* and does not hold a useful value for cloned bios.
281+
*/
282+
unsigned short bi_max_vecs;
277283

278284
atomic_t __bi_cnt; /* pin count */
279285

include/linux/bvec.h

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,27 @@ static inline void bvec_set_virt(struct bio_vec *bv, void *vaddr,
7575
}
7676

7777
struct bvec_iter {
78-
sector_t bi_sector; /* device address in 512 byte
79-
sectors */
80-
unsigned int bi_size; /* residual I/O count */
81-
82-
unsigned int bi_idx; /* current index into bvl_vec */
83-
84-
unsigned int bi_bvec_done; /* number of bytes completed in
85-
current bvec */
78+
/*
79+
* Current device address in 512 byte sectors. Only updated by the bio
80+
* iter wrappers and not the bvec iterator helpers themselves.
81+
*/
82+
sector_t bi_sector;
83+
84+
/*
85+
* Remaining size in bytes.
86+
*/
87+
unsigned int bi_size;
88+
89+
/*
90+
* Current index into the bvec array. This indexes into `bi_io_vec` when
91+
* iterating a bvec array that is part of a `bio`.
92+
*/
93+
unsigned int bi_idx;
94+
95+
/*
96+
* Current offset in the bvec entry pointed to by `bi_idx`.
97+
*/
98+
unsigned int bi_bvec_done;
8699
} __packed __aligned(4);
87100

88101
struct bvec_iter_all {

0 commit comments

Comments
 (0)