Function report |
Source Code:fs\block_dev.c |
Create Date:2022-07-28 20:14:45 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:__blkdev_direct_IO
Proto:static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
Type:ssize_t
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct kiocb * | iocb | |
| struct iov_iter * | iter | |
| int | nr_pages |
| 341 | inode = bdev_file_inode(file) |
| 346 | is_poll = (ki_flags & IOCB_HIPRI) != 0 |
| 349 | qc = BLK_QC_T_NONE |
| 350 | ret = 0 |
| 352 | If (pos | iov_iter_alignment(iter)) & bdev_logical_block_size(bdev) - 1 Then Return -EINVAL |
| 356 | bio = bio_alloc_bioset(GFP_KERNEL, nr_pages, & blkdev_dio_pool) |
| 359 | is_sync = is_sync = is_sync_kiocb(iocb) |
| 360 | If is_sync Then |
| 361 | waiter = current process |
| 363 | Else |
| 367 | size = 0 |
| 368 | multi_bio = false |
| 369 | should_dirty = is_read && iter_is_iovec(iter) |
| 375 | If Not is_poll Then blk_start_plug( & plug) |
| 378 | cycle |
| 379 | bio_set_dev(bio, bdev) |
| 380 | device address in 512 byte sectors = pos >> 9 |
| 381 | bi_write_hint = ki_hint |
| 382 | bi_private = dio |
| 383 | bi_end_io = blkdev_bio_end_io |
| 384 | bi_ioprio = See linux/ioprio.h |
| 386 | ret = bio_iov_iter_get_pages(bio, iter) |
| 393 | If is_read Then |
| 395 | If should_dirty Then bio_set_pages_dirty(bio) |
| 397 | Else |
| 402 | size += residual I/O count |
| 403 | pos += residual I/O count |
| 405 | nr_pages = iov_iter_npages(iter, BIO_MAX_PAGES) |
| 406 | If Not nr_pages Then |
| 407 | bool polled = false |
| 409 | If ki_flags & IOCB_HIPRI Then |
| 411 | polled = true |
| 414 | qc = submit_bio(bio) |
| 416 | If polled Then WRITE_ONCE( for ->iopoll , qc) |
| 418 | Break |
| 421 | If Not multi_bio Then |
| 429 | multi_bio = true |
| 430 | atomic_set( & ref, 2) |
| 431 | Else |
| 432 | atomic_inc( & ref) |
| 435 | submit_bio(bio) |
| 436 | bio = bio_alloc(GFP_KERNEL, nr_pages) |
| 439 | If Not is_poll Then blk_finish_plug( & plug) |
| 442 | If Not is_sync Then Return -cb queued, will get completion event |
| 445 | cycle |
| 450 | If Not (ki_flags & IOCB_HIPRI) || Not blk_poll(bdev_get_queue(bdev), qc, true) Then io_schedule() |
| 456 | If Not ret Then ret = blk_status_to_errno(bi_status) |
| 458 | If Value is more likely to compile time(!ret) Then ret = size |
| 462 | Return ret |
| Name | Describe |
|---|---|
| blkdev_direct_IO |
| 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 |