Lines Matching defs:bio

12 #include <linux/bio.h>
50 * concurrently) * (maximum recursive depth of a bio), so that we don't
58 "Number of bio crypto contexts to preallocate");
87 panic("Failed to allocate mem for bio crypt ctxs\n");
91 void bio_crypt_set_ctx(struct bio *bio, const struct blk_crypto_key *key,
107 bio->bi_crypt_context = bc;
110 void __bio_crypt_free_ctx(struct bio *bio)
112 mempool_free(bio->bi_crypt_context, bio_crypt_ctx_pool);
113 bio->bi_crypt_context = NULL;
116 int __bio_crypt_clone(struct bio *dst, struct bio *src, gfp_t gfp_mask)
144 void __bio_crypt_advance(struct bio *bio, unsigned int bytes)
146 struct bio_crypt_ctx *bc = bio->bi_crypt_context;
181 * Checks that two bio crypt contexts are compatible - i.e. that
193 bool bio_crypt_rq_ctx_compatible(struct request *rq, struct bio *bio)
195 return bio_crypt_ctx_compatible(rq->crypt_ctx, bio->bi_crypt_context);
199 * Checks that two bio crypt contexts are compatible, and also
213 static bool bio_crypt_check_alignment(struct bio *bio)
216 bio->bi_crypt_context->bc_key->crypto_cfg.data_unit_size;
220 bio_for_each_segment(bv, bio, iter) {
252 * __blk_crypto_bio_prep - Prepare bio for inline encryption
254 * @bio_ptr: pointer to original bio pointer
256 * If the bio crypt context provided for the bio is supported by the underlying
259 * Otherwise, try to perform en/decryption for this bio by falling back to the
261 * blk-crypto may choose to split the bio into 2 - the first one that will
263 * submit_bio_noacct. A bounce bio will be allocated to encrypt the contents
265 * bounce bio.
267 * Caller must ensure bio has bio_crypt_ctx.
269 * Return: true on success; false on error (and bio->bi_status will be set
270 * appropriately, and bio_endio() will have been called so bio
273 bool __blk_crypto_bio_prep(struct bio **bio_ptr)
275 struct bio *bio = *bio_ptr;
276 const struct blk_crypto_key *bc_key = bio->bi_crypt_context->bc_key;
278 /* Error if bio has no data. */
279 if (WARN_ON_ONCE(!bio_has_data(bio))) {
280 bio->bi_status = BLK_STS_IOERR;
284 if (!bio_crypt_check_alignment(bio)) {
285 bio->bi_status = BLK_STS_IOERR;
293 if (blk_crypto_config_supported_natively(bio->bi_bdev,
303 int __blk_crypto_rq_bio_prep(struct request *rq, struct bio *bio,
311 *rq->crypt_ctx = *bio->bi_crypt_context;