Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\block_dev.c Create Date:2022-07-28 20:14:50
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name: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.

Proto:ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)

Type:ssize_t

Parameter:

TypeParameterName
struct kiocb *iocb
struct iov_iter *from
1995  file = ki_filp
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  If bdev_read_only(I_BDEV(bd_inode)) Then Return -EPERM
2004  If IS_SWAPFILE(bd_inode) Then Return -ETXTBSY
2007  If Not iov_iter_count(from) Then Return 0
2010  If The 'ki_filp' pointer is shared in a union for aio >= size Then Return -ENOSPC
2013  If (ki_flags & (IOCB_NOWAIT | IOCB_DIRECT)) == IOCB_NOWAIT Then Return -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  If ret > 0 Then 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  Return ret