函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:This is a library function for use by filesystem drivers

函数原型:static inline ssize_t do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, struct block_device *bdev, struct iov_iter *iter, get_block_t get_block, dio_iodone_t end_io, dio_submit_t submit_io, int flags)

返回类型:ssize_t

参数:

类型参数名称
struct kiocb *iocb
struct inode *inode
struct block_device *bdev
struct iov_iter *iter
get_block_tget_block
dio_iodone_tend_io
dio_submit_tsubmit_io
intflags
1150  i_blkbits等于READ_ONCE(i_blkbits)
1151  blkbits等于i_blkbits
1152  blocksize_mask等于1左移blkbits位的值减1
1153  retval等于负EINVAL
1154  count等于iov_iter_count(iter)
1155  offset等于文件偏移
1156  end等于offsetcount
1158  struct dio_submit sdio = {0, }
1159  struct buffer_head map_bh = {0, }
1161  align等于offset按位或iov_iter_alignment(iter)
1168  如果align按位与blocksize_mask
1169  如果bdevblkbits等于assumes size > 256
1171  blocksize_mask等于1左移blkbits位的值减1
1172  如果align按位与blocksize_mask则转到:out
1177  如果iov_iter_rw(iter)恒等于generic data direction definitions 且非count则返回:0
1180  dio等于分配高速缓存区
1181  retval等于负ENOMEM
1182  如果非dio则转到:out
1189  memset(dio, 0, offsetof(structdio, pages))
1191  doesn't change 等于flags
1192  如果doesn't change 按位与DIO_LOCKING
1194  mapping等于f_mapping
1198  inode_lock(inode)
1202  如果retval
1205  转到:out
1211  _size when submitted 等于NOTE: in a 32bit arch with a preemptable kernel and* an UP compile the i_size_read/write must be atomic* with respect to the local cpu (unlike with preempt disabled),* but they don't need to be atomic with respect to other cpus like in* true SMP (so they
1212  如果iov_iter_rw(iter)恒等于generic data direction definitions offset大于等于_size when submitted
1213  如果doesn't change 按位与DIO_LOCKINGinode_unlock(inode)
1215  kmem_cache_free(dio_cache, dio)
1216  retval等于0
1217  转到:out
1226  如果is_sync_kiocb(iocb)则s IO async ? = false
1228  否则如果iov_iter_rw(iter)恒等于WRITEend大于NOTE: in a 32bit arch with a preemptable kernel and* an UP compile the i_size_read/write must be atomic* with respect to the local cpu (unlike with preempt disabled),* but they don't need to be atomic with respect to other cpus like in* true SMP (so they s IO async ? = false
1230  否则s IO async ? = true
1233  inode等于inode
1234  如果iov_iter_rw(iter)恒等于WRITE
1235  op等于REQ_OP_WRITE
1236  op_flags等于REQ_SYNC按位或REQ_IDLE
1237  如果ki_flags按位与IOCB_NOWAITop_flags或等于REQ_NOWAIT
1239  否则
1240  op等于REQ_OP_READ
1242  如果ki_flags按位与IOCB_HIPRIop_flags或等于REQ_HIPRI
1249  如果s IO async ? iov_iter_rw(iter)恒等于WRITE
1250  retval等于0
1251  如果ki_flags按位与IOCB_DSYNCretval等于dio_set_defer_completion(dio)
1253  否则如果非s_dio_done_wq
1261  如果retval
1267  转到:out
1274  允许I/O信号请求
1276  retval等于0
1277  doesn't change 等于blkbits
1278  When we're using an alignment whichis finer than the filesystem's softblocksize, this specifies how muchfiner. blkfactor=2 means 1/4-blockalignment. Does not change 等于i_blkbitsblkbits
1279  Current offset into the underlyingfile in dio_block units. 等于offset右移blkbits
1281  lock mapping function 等于get_block
1282  IO completion function 等于end_io
1283  IO submition function 等于submit_io
1284  current final block in bio + 1 等于负1
1285  xt block to be put under IO,in dio_blocks units 等于负1
1287  kiocb 等于iocb
1289  spin_lock_init( & protects BIO fields below )
1290  direct_io_worker() and bios 等于1
1292  pages should be dirtied 等于iter_is_iovec(iter)且iov_iter_rw(iter)恒等于generic data direction definitions
1293  iter等于iter
1294  doesn't change 等于end右移blkbits
1300  如果此条件成立可能性小(为编译器优化)(When we're using an alignment whichis finer than the filesystem's softblocksize, this specifies how muchfiner. blkfactor=2 means 1/4-blockalignment. Does not change )则approximate total IO pages 等于2
1303  approximate total IO pages 加等于iov_iter_npages(iter, INT_MAX)
1305  blk_start_plug( & plug)
1307  retval等于Walk the user pages, and the file, mapping blocks to disk and generating* a sequence of (page,offset,len,block) mappings. These mappings are injected* into submit_page_section(), which takes care of the next stage of submission
1308  如果retvalRelease any resources in case of a failure
1311  如果retval恒等于负ENOTBLK
1316  retval等于0
1322  If we are not writing the entire block and get_block() allocated* the block for us, we need to fill-in the unused portion of the* block with zeros
1324  如果The page
1327  ret2等于Put cur_page under IO
1328  如果retval恒等于0则retval等于ret2
1330  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
1331  The page = NULL
1333  如果 under assembly In the AIO read case we speculatively dirty the pages before starting IO.* During IO completion, any of these pages which happen to have been written* back will be redirtied by bio_check_pages_dirty().
1336  blk_finish_plug( & plug)
1342  Release any resources in case of a failure
1349  如果iov_iter_rw(iter)恒等于generic data direction definitions doesn't change 按位与DIO_LOCKINGinode_unlock(inode)
1359  BUG_ON(retval == - cb queued, will get completion event )
1360  如果s IO async ? retval恒等于0且IO result iov_iter_rw(iter)恒等于generic data direction definitions IO result 恒等于count的值则retval等于负cb queued, will get completion event
1363  否则Wait on and process all in-flight BIOs
1366  如果drop_refcount(dio)恒等于0则
1367  retval等于dio_complete() - called when all DIO BIO I/O has been completed* This drops i_dio_count, lets interested parties know that a DIO operation* has completed, and calculates the resulting return code for the operation
1368  否则BUG_ON(retval != - cb queued, will get completion event )
1371  out :
1372  返回:retval
调用者
名称描述
__blockdev_direct_IO