函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Write data to the block device. Only intended for the block device itself* and the raw driver which basically is a fake block device.* Does not take i_mutex for the write and thus is not for general purpose* use.

函数原型:ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)

返回类型:ssize_t

参数:

类型参数名称
struct kiocb *iocb
struct iov_iter *from
1995  file等于文件指针
1996  bd_inode等于bdev_file_inode(file)
1997  size等于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
2001  如果bdev_read_only(I_BDEV(bd_inode))则返回:负EPERM
2004  如果IS_SWAPFILE(bd_inode)则返回:负ETXTBSY
2007  如果非iov_iter_count(from)则返回:0
2010  如果文件偏移大于等于size则返回:负ENOSPC
2013  如果ki_flags按位与IOCB_NOWAIT按位或IOCB_DIRECT的值的值恒等于IOCB_NOWAIT则返回:负EOPNOTSUPP
2016  Cap the iov_iter by given limit; note that the second argument is* *not* the new size - it's upper limit for such. Passing it a value* greater than the amount of data in iov_iter is fine - it'll just do* nothing in that case.
2018  blk_start_plug( & plug)
2019  ret等于__generic_file_write_iter - write data to a file*@iocb: IO state structure (file, offset, etc.)*@from: iov_iter with data to write* This function does all the work needed for actually writing data to a* file
2020  如果ret大于0则ret等于Sync the bytes written if this was a synchronous write. Expect ki_pos* to already be updated for the write, and will return either the amount* of bytes passed in, or an error if syncing the file failed.
2022  blk_finish_plug( & plug)
2023  返回:ret