Lines Matching defs:bio

12 #include <linux/bio.h>
41 * concurrently) * (maximum recursive depth of a bio), so that we don't
49 "Number of bio crypto contexts to preallocate");
78 panic("Failed to allocate mem for bio crypt ctxs\n");
82 void bio_crypt_set_ctx(struct bio *bio, const struct blk_crypto_key *key,
98 bio->bi_crypt_context = bc;
101 void __bio_crypt_free_ctx(struct bio *bio)
103 mempool_free(bio->bi_crypt_context, bio_crypt_ctx_pool);
104 bio->bi_crypt_context = NULL;
107 int __bio_crypt_clone(struct bio *dst, struct bio *src, gfp_t gfp_mask)
136 void __bio_crypt_advance(struct bio *bio, unsigned int bytes)
138 struct bio_crypt_ctx *bc = bio->bi_crypt_context;
173 * Checks that two bio crypt contexts are compatible - i.e. that
185 bool bio_crypt_rq_ctx_compatible(struct request *rq, struct bio *bio)
187 return bio_crypt_ctx_compatible(rq->crypt_ctx, bio->bi_crypt_context);
191 * Checks that two bio crypt contexts are compatible, and also
205 static bool bio_crypt_check_alignment(struct bio *bio)
208 bio->bi_crypt_context->bc_key->crypto_cfg.data_unit_size;
212 bio_for_each_segment(bv, bio, iter) {
243 * __blk_crypto_bio_prep - Prepare bio for inline encryption
245 * @bio_ptr: pointer to original bio pointer
247 * If the bio crypt context provided for the bio is supported by the underlying
250 * Otherwise, try to perform en/decryption for this bio by falling back to the
252 * blk-crypto may choose to split the bio into 2 - the first one that will
254 * submit_bio_noacct. A bounce bio will be allocated to encrypt the contents
256 * bounce bio.
258 * Caller must ensure bio has bio_crypt_ctx.
260 * Return: true on success; false on error (and bio->bi_status will be set
261 * appropriately, and bio_endio() will have been called so bio
264 bool __blk_crypto_bio_prep(struct bio **bio_ptr)
266 struct bio *bio = *bio_ptr;
267 const struct blk_crypto_key *bc_key = bio->bi_crypt_context->bc_key;
269 /* Error if bio has no data. */
270 if (WARN_ON_ONCE(!bio_has_data(bio))) {
271 bio->bi_status = BLK_STS_IOERR;
275 if (!bio_crypt_check_alignment(bio)) {
276 bio->bi_status = BLK_STS_IOERR;
284 if (blk_ksm_crypto_cfg_supported(bio->bi_disk->queue->ksm,
295 int __blk_crypto_rq_bio_prep(struct request *rq, struct bio *bio,
303 *rq->crypt_ctx = *bio->bi_crypt_context;