Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:iomap_dio_bio_actor

Proto:static loff_t iomap_dio_bio_actor(struct inode *inode, loff_t pos, loff_t length, struct iomap_dio *dio, struct iomap *iomap)

Type:loff_t

Parameter:

TypeParameterName
struct inode *inode
loff_tpos
loff_tlength
struct iomap_dio *dio
struct iomap *iomap
201  blkbits = assumes size > 256
202  fs_block_size = i_blocksize(inode)
203  align = iov_iter_alignment(iter)
205  bool need_zeroout = false
206  bool use_fua = false
207  ret = 0
208  copied = 0
211  If ( pos | length | align) & (1 << blkbits) - 1 Then Return -EINVAL
214  If type of mapping == locks allocated at @addr in unwritten state Then
215  flags |= covers unwritten extent(s)
216  need_zeroout = true
219  If flags for mapping & IOMAP_F_SHARED Then flags |= covers COW extent(s)
222  If flags for mapping & Flags reported by the file system from iomap_begin:* IOMAP_F_NEW indicates that the blocks have been newly allocated and need* zeroing for areas that no data is copied to.* IOMAP_F_DIRTY indicates the inode has uncommitted metadata needed to access Then
223  need_zeroout = true
224  Else if type of mapping == locks allocated at @addr Then
232  If Not ( flags for mapping & (IOMAP_F_SHARED | IOMAP_F_DIRTY)) && flags & Private flags for iomap_dio, must not overlap with the public ones in* iomap.h: && blk_queue_fua(bdev_get_queue( block device for I/O )) Then use_fua = true
243  orig_count = iov_iter_count(iter)
244  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.
246  nr_pages = iov_iter_npages(iter, BIO_MAX_PAGES)
247  If nr_pages <= 0 Then
248  ret = nr_pages
249  Go to out
252  If need_zeroout Then
254  pad = pos & fs_block_size - 1
255  If pad Then iomap_dio_zero(dio, iomap, pos - pad, pad)
259  Do
261  If error Then
263  copied = ret = 0
264  Go to out
267  bio = bio_alloc(GFP_KERNEL, nr_pages)
268  bio_set_dev(bio, block device for I/O )
269  device address in 512 byte sectors = iomap_sector(iomap, pos)
270  bi_write_hint = ki_hint
271  bi_ioprio = See linux/ioprio.h
272  bi_private = dio
273  bi_end_io = iomap_dio_bio_end_io
275  ret = bio_iov_iter_get_pages(bio, iter)
283  bio_put(bio)
284  Go to zero_tail
287  n = residual I/O count
288  If flags & IOMAP_DIO_WRITE Then
295  Else
301  size += n
302  pos += n
303  copied += n
305  nr_pages = iov_iter_npages(iter, BIO_MAX_PAGES)
306  iomap_dio_submit_bio(dio, iomap, bio)
307  When nr_pages cycle
315  zero_tail :
316  If need_zeroout || flags & IOMAP_DIO_WRITE && pos >= 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 Then
319  pad = pos & fs_block_size - 1
320  If pad Then iomap_dio_zero(dio, iomap, pos, fs_block_size - pad)
323  out :
325  xpand a previously truncated iterator; count must be no more than how much* we had shrunk it.
326  If copied Then Return copied
328  Return ret
Caller
NameDescribe
iomap_dio_actor