函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\block_dev.c Create Date:2022-07-29 10:46:00
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:__blkdev_direct_IO

函数原型:static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)

返回类型:ssize_t

参数:

类型参数名称
struct kiocb *iocb
struct iov_iter *iter
intnr_pages
340  file等于文件指针
341  inode等于bdev_file_inode(file)
342  bdev等于I_BDEV(inode)
346  is_poll等于ki_flags按位与IOCB_HIPRI的值不等于0
347  is_read等于iov_iter_rw(iter)恒等于generic data direction definitions
348  pos等于文件偏移
349  qc等于BLK_QC_T_NONE
350  ret等于0
352  如果pos按位或iov_iter_alignment(iter)的值按位与bdev_logical_block_size(bdev)减1则返回:负EINVAL
356  bio等于bio_alloc_bioset(GFP_KERNEL, nr_pages, & blkdev_dio_pool)
358  dio等于container_of - cast a member of a structure out to the containing structure*@ptr: the pointer to the member.*@type: the type of the container struct this is embedded in.*@member: the name of the member within the struct.(bio, structblkdev_dio, bio)
359  is_sync等于is_sync等于is_sync_kiocb(iocb)
360  如果is_sync
361  waiter等于当前进程
362  get a reference to a bio, so it won't disappear. the intended use is* something like:* bio_get(bio);* submit_bio(rw, bio);* if (bio->bi_flags ...)* do_something* bio_put(bio);* without the bio_get(), it could potentially complete I/O before submit_bio
363  否则
364  iocb等于iocb
367  size等于0
368  multi_bio = false
369  should_dirty等于is_readiter_is_iovec(iter)
375  如果非is_pollblk_start_plug( & plug)
378  循环
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)
389  bio_endio(bio)
390  退出
393  如果is_read
397  否则
402  size加等于 residual I/O count
403  pos加等于 residual I/O count
405  nr_pages等于iov_iter_npages(iter, BIO_MAX_PAGES)
406  如果非nr_pages
407  bool polled = false
409  如果ki_flags按位与IOCB_HIPRI
414  qc等于submit_bio(bio)
418  退出
421  如果非multi_bio
429  multi_bio = true
430  atomic_set( & ref, 2)
431  否则
432  atomic_inc( & ref)
435  submit_bio(bio)
436  bio等于bio_alloc(GFP_KERNEL, nr_pages)
439  如果非is_pollblk_finish_plug( & plug)
442  如果非is_sync则返回:负cb queued, will get completion event
445  循环
446  set_current_state(深度睡眠态)
447  如果非READ_ONCE(waiter)则退出
450  如果非ki_flags按位与IOCB_HIPRI的值或非blk_poll(bdev_get_queue(bdev), qc, true)则io_schedule()
454  set_current_state() includes a barrier so that the write of current->state* is correctly serialised wrt the caller's subsequent test of whether to* actually sleep:* for (;;) {* set_current_state(TASK_UNINTERRUPTIBLE);* if (!need_sleep)* break;* (就绪态)
456  如果非retret等于blk_status_to_errno(bi_status)
458  如果此条件成立可能性大(为编译器优化)(!ret)则ret等于size
461  bio_put( & bio)
462  返回:ret
调用者
名称描述
blkdev_direct_IO