Function report |
Source Code:fs\mpage.c |
Create Date:2022-07-28 20:15:32 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:This is the worker routine which does all the work of mapping the disk* blocks and constructs largest possible bios, submits them for IO if the* blocks are not contiguous on the disk
Proto:static struct bio *do_mpage_readpage(struct mpage_readpage_args *args)
Type:struct bio
Parameter:
Type | Parameter | Name |
---|---|---|
struct mpage_readpage_args * | args |
161 | blocks_per_page = PAGE_SIZE >> blkbits |
169 | first_hole = blocks_per_page |
170 | struct block_device * bdev = NULL |
172 | fully_mapped = 1 |
178 | If is_readahead Then |
181 | Else |
186 | If page_has_buffers(page) Then Go to confused |
190 | last_block = block_in_file + nr_pages * blocks_per_page |
192 | If last_block > last_block_in_file Then last_block = last_block_in_file |
194 | page_block = 0 |
199 | nblocks = size of mapping >> blkbits |
200 | If buffer_mapped(map_bh) && block_in_file > first_logical_block && block_in_file < first_logical_block + nblocks Then |
204 | last = nblocks - map_offset |
206 | cycle |
207 | If relative_block == last Then |
209 | Break |
211 | If page_block == blocks_per_page Then Break |
213 | blocks[page_block] = start block number + map_offset + relative_block |
215 | page_block++ |
216 | block_in_file++ |
225 | When page_block < blocks_per_page cycle |
226 | buffer state bitmap (see above) = 0 |
227 | size of mapping = 0 |
229 | If block_in_file < last_block Then |
230 | size of mapping = last_block - block_in_file << blkbits |
231 | If get_block(inode, block_in_file, map_bh, 0) Then Go to confused |
236 | If Not buffer_mapped(map_bh) Then |
237 | fully_mapped = 0 |
238 | If first_hole == blocks_per_page Then first_hole = page_block |
240 | page_block++ |
241 | block_in_file++ |
242 | Continue |
253 | Go to confused |
256 | If first_hole != blocks_per_page Then Go to confused |
260 | If page_block && blocks[page_block - 1] != start block number - 1 Then Go to confused |
262 | nblocks = size of mapping >> blkbits |
263 | cycle |
264 | If relative_block == nblocks Then |
266 | Break |
267 | Else if page_block == blocks_per_page Then Break |
269 | blocks[page_block] = start block number + relative_block |
270 | page_block++ |
271 | block_in_file++ |
276 | If first_hole != blocks_per_page Then |
277 | zero_user_segment(page, first_hole << blkbits, PAGE_SIZE) |
278 | If first_hole == 0 Then |
279 | SetPageUptodate(page) |
281 | Go to out |
283 | Else if fully_mapped Then |
284 | SetPageMappedToDisk(page) |
287 | If fully_mapped && blocks_per_page == 1 && Not PageUptodate(page) && cleancache_get_page(page) == 0 Then |
289 | SetPageUptodate(page) |
290 | Go to confused |
296 | If bio && last_block_in_bio != blocks[0] - 1 Then bio = mpage_bio_submit(REQ_OP_READ, op_flags, bio) |
299 | alloc_new : |
300 | If (bio == NULL) Then |
301 | If first_hole == blocks_per_page Then |
314 | length = first_hole << blkbits |
315 | If bio_add_page(bio, page, length, 0) < length Then |
316 | bio = mpage_bio_submit(REQ_OP_READ, op_flags, bio) |
317 | Go to alloc_new |
321 | nblocks = size of mapping >> blkbits |
322 | If buffer_boundary(map_bh) && relative_block == nblocks || first_hole != blocks_per_page Then bio = mpage_bio_submit(REQ_OP_READ, op_flags, bio) |
325 | Else last_block_in_bio = blocks[blocks_per_page - 1] |
327 | out : |
328 | Return bio |
330 | confused : |
331 | If bio Then bio = mpage_bio_submit(REQ_OP_READ, op_flags, bio) |
333 | If Not PageUptodate(page) Then Generic "read page" function for block devices that have the normal* get_block functionality |
337 | Go to out |
Name | Describe |
---|---|
mpage_readpages | mpage_readpages - populate an address space with some pages & start reads against them*@mapping: the address_space*@pages: The address of a list_head which contains the target pages. These |
mpage_readpage | This isn't called much at all |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |