Commit d86eaa0f authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

block: remove the bi_inline_vecs variable sized array from struct bio



Bios are embedded into other structures, and at least spare is unhappy
about embedding structures with variable sized arrays.  There's no
real need to the array anyway, we can replace it with a helper pointing
to the memory just behind the bio, and with the previous cleanups there
is very few site doing anything special with it.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJohn Garry <john.g.garry@oracle.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 70a6f71b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -617,7 +617,8 @@ struct bio *bio_kmalloc(unsigned short nr_vecs, gfp_t gfp_mask)

	if (nr_vecs > BIO_MAX_INLINE_VECS)
		return NULL;
	return kmalloc(struct_size(bio, bi_inline_vecs, nr_vecs), gfp_mask);
	return kmalloc(sizeof(*bio) + nr_vecs * sizeof(struct bio_vec),
			gfp_mask);
}
EXPORT_SYMBOL(bio_kmalloc);

+3 −3
Original line number Diff line number Diff line
@@ -145,8 +145,8 @@ static void read_moving(struct cache_set *c)
			continue;
		}

		io = kzalloc(struct_size(io, bio.bio.bi_inline_vecs,
					 DIV_ROUND_UP(KEY_SIZE(&w->key), PAGE_SECTORS)),
		io = kzalloc(sizeof(*io) + sizeof(struct bio_vec) *
				DIV_ROUND_UP(KEY_SIZE(&w->key), PAGE_SECTORS),
				GFP_KERNEL);
		if (!io)
			goto err;
+3 −3
Original line number Diff line number Diff line
@@ -536,8 +536,8 @@ static void read_dirty(struct cached_dev *dc)
		for (i = 0; i < nk; i++) {
			w = keys[i];

			io = kzalloc(struct_size(io, bio.bi_inline_vecs,
						DIV_ROUND_UP(KEY_SIZE(&w->key), PAGE_SECTORS)),
			io = kzalloc(sizeof(*io) + sizeof(struct bio_vec) *
				DIV_ROUND_UP(KEY_SIZE(&w->key), PAGE_SECTORS),
				GFP_KERNEL);
			if (!io)
				goto err;
+1 −1
Original line number Diff line number Diff line
@@ -212,7 +212,7 @@ int vio_reset_bio_with_size(struct vio *vio, char *data, int size, bio_end_io_t
		return VDO_SUCCESS;

	bio->bi_ioprio = 0;
	bio->bi_io_vec = bio->bi_inline_vecs;
	bio->bi_io_vec = bio_inline_vecs(bio);
	bio->bi_max_vecs = vio->block_count + 1;
	if (VDO_ASSERT(size <= vio_size, "specified size %d is not greater than allocated %d",
		       size, vio_size) != VDO_SUCCESS)
+0 −1
Original line number Diff line number Diff line
@@ -62,7 +62,6 @@ struct promote_op {

	struct work_struct	work;
	struct data_update	write;
	struct bio_vec		bi_inline_vecs[]; /* must be last */
};

void bch2_data_update_to_text(struct printbuf *, struct data_update *);
Loading