Lines Matching +full:non +full:- +full:contiguous

1 // SPDX-License-Identifier: GPL-2.0
21 * - encountering a page which has buffers
22 * - encountering a page which has a non-hole after a hole
23 * - encountering a page with non-contiguous blocks
25 * then this code just gives up and calls the buffer_head-based read function.
26 * It does handle a page which has holes at the end - that is a common case:
27 * the end-of-file on blocksize < PAGE_SIZE setups.
44 #include <linux/backing-dev.h>
74 folio_end_read(fi.folio, bio->bi_status == 0); in __read_end_io()
75 if (bio->bi_private) in __read_end_io()
76 mempool_free(bio->bi_private, bio_post_read_ctx_pool); in __read_end_io()
86 struct bio *bio = ctx->bio; in decrypt_work()
98 struct bio *bio = ctx->bio; in verity_work()
105 * This is safe because verity is the last post-read step. in verity_work()
109 bio->bi_private = NULL; in verity_work()
123 switch (++ctx->cur_step) { in bio_post_read_processing()
125 if (ctx->enabled_steps & (1 << STEP_DECRYPT)) { in bio_post_read_processing()
126 INIT_WORK(&ctx->work, decrypt_work); in bio_post_read_processing()
127 fscrypt_enqueue_decrypt_work(&ctx->work); in bio_post_read_processing()
130 ctx->cur_step++; in bio_post_read_processing()
133 if (ctx->enabled_steps & (1 << STEP_VERITY)) { in bio_post_read_processing()
134 INIT_WORK(&ctx->work, verity_work); in bio_post_read_processing()
135 fsverity_enqueue_verify_work(&ctx->work); in bio_post_read_processing()
138 ctx->cur_step++; in bio_post_read_processing()
141 __read_end_io(ctx->bio); in bio_post_read_processing()
147 return bio->bi_private && !bio->bi_status; in bio_post_read_required()
153 * The mpage code never puts partial pages into a BIO (except for end-of-file).
154 * If a page does not map to a contiguous run of blocks then it simply falls
165 struct bio_post_read_ctx *ctx = bio->bi_private; in mpage_end_io()
167 ctx->cur_step = STEP_INITIAL; in mpage_end_io()
177 idx < DIV_ROUND_UP(inode->i_size, PAGE_SIZE); in ext4_need_verity()
197 ctx->bio = bio; in ext4_set_bio_post_read_ctx()
198 ctx->enabled_steps = post_read_steps; in ext4_set_bio_post_read_ctx()
199 bio->bi_private = ctx; in ext4_set_bio_post_read_ctx()
206 return inode->i_sb->s_maxbytes; in ext4_readpage_limit()
217 const unsigned blkbits = inode->i_blkbits; in ext4_mpage_readpages()
226 struct block_device *bdev = inode->i_sb->s_bdev; in ext4_mpage_readpages()
237 for (; nr_pages; nr_pages--) { in ext4_mpage_readpages()
243 prefetchw(&folio->flags); in ext4_mpage_readpages()
249 (sector_t)folio->index << (PAGE_SHIFT - blkbits); in ext4_mpage_readpages()
252 blocksize - 1) >> blkbits; in ext4_mpage_readpages()
263 unsigned map_offset = block_in_file - map.m_lblk; in ext4_mpage_readpages()
264 unsigned last = map.m_len - map_offset; in ext4_mpage_readpages()
287 map.m_len = last_block - block_in_file; in ext4_mpage_readpages()
306 goto confused; /* hole -> non-hole */ in ext4_mpage_readpages()
308 /* Contiguous blocks? */ in ext4_mpage_readpages()
328 if (ext4_need_verity(inode, folio->index) && in ext4_mpage_readpages()
342 if (bio && (last_block_in_bio != first_block - 1 || in ext4_mpage_readpages()
357 ext4_set_bio_post_read_ctx(bio, inode, folio->index); in ext4_mpage_readpages()
358 bio->bi_iter.bi_sector = first_block << (blkbits - 9); in ext4_mpage_readpages()
359 bio->bi_end_io = mpage_end_io; in ext4_mpage_readpages()
361 bio->bi_opf |= REQ_RAHEAD; in ext4_mpage_readpages()
374 last_block_in_bio = first_block + blocks_per_page - 1; in ext4_mpage_readpages()
409 return -ENOMEM; in ext4_init_post_read_processing()