参照元†
- struct kiocb *iocb
- const struct iovec *iov
- unsigned long nr_segs
- loff_t pos
返り値†
- writepages に設定される関数
- 検索方法
$ egrep -nr '\.direct_IO[\s]*' fs
- 結果
fs/block_dev.c:1472: .direct_IO = blkdev_direct_IO,
fs/btrfs/inode.c:6008: .direct_IO = btrfs_direct_IO,
fs/cifs/file.c:2355: /* .direct_IO = */
fs/cifs/file.c:2371: /* .direct_IO = */
fs/ext2/inode.c:820: .direct_IO = ext2_direct_IO,
fs/ext2/inode.c:840: .direct_IO = ext2_direct_IO,
fs/ext3/inode.c:1847: .direct_IO = ext3_direct_IO,
fs/ext3/inode.c:1863: .direct_IO = ext3_direct_IO,
fs/ext4/inode.c:3853: .direct_IO = ext4_direct_IO,
fs/ext4/inode.c:3869: .direct_IO = ext4_direct_IO,
fs/ext4/inode.c:3901: .direct_IO = ext4_direct_IO,
fs/fat/inode.c:220: .direct_IO = fat_direct_IO,
fs/gfs2/aops.c:1127: .direct_IO = gfs2_direct_IO,
fs/gfs2/aops.c:1144: .direct_IO = gfs2_direct_IO,
fs/hfs/inode.c:143: .direct_IO = hfs_direct_IO,
fs/hfsplus/inode.c:136: .direct_IO = hfsplus_direct_IO,
fs/jfs/inode.c:328: .direct_IO = jfs_direct_IO,
fs/nfs/file.c:527: .direct_IO = nfs_direct_IO,
fs/nilfs2/inode.c:253: .direct_IO = nilfs_direct_IO,
fs/ocfs2/aops.c:1994: .direct_IO = ocfs2_direct_IO,
fs/reiserfs/inode.c:3189: .direct_IO = reiserfs_direct_IO,
fs/xfs/linux-2.6/xfs_aops.c:1558: .direct_IO = xfs_vm_direct_IO,
/**
* generic_file_aio_read - generic filesystem read routine
* @iocb: kernel I/O control block
* @iov: io vector request
* @nr_segs: number of segments in the iovec
* @pos: current file position
*
* This is the "read()" routine for all filesystems
* that can use the page cache directly.
*/
ssize_t
generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{
struct file *filp = iocb->ki_filp;
ssize_t retval;
unsigned long seg;
size_t count;
loff_t *ppos = &iocb->ki_pos;
count = 0;
retval = generic_segment_checks(iov, &nr_segs, &count, VERIFY_WRITE);
if (retval)
return retval;
/* coalesce the iovecs and go direct-to-BIO for O_DIRECT */
if (filp->f_flags & O_DIRECT) {
loff_t size;
struct address_space *mapping;
struct inode *inode;
mapping = filp->f_mapping;
inode = mapping->host;
if (!count)
goto out; /* skip atime */
size = i_size_read(inode);
if (pos < size) {
retval = filemap_write_and_wait_range(mapping, pos,
pos + iov_length(iov, nr_segs) - 1);
if (!retval) {
retval = mapping->a_ops->direct_IO(READ, iocb,
iov, pos, nr_segs);
- mapping->a_ops は address_space_operations 型
}
if (retval > 0)
*ppos = pos + retval;
if (retval) {
file_accessed(filp);
goto out;
}
}
}
for (seg = 0; seg < nr_segs; seg++) {
read_descriptor_t desc;
desc.written = 0;
desc.arg.buf = iov[seg].iov_base;
desc.count = iov[seg].iov_len;
if (desc.count == 0)
continue;
desc.error = 0;
do_generic_file_read(filp, ppos, &desc, file_read_actor);
retval += desc.written;
if (desc.error) {
retval = retval ?: desc.error;
break;
}
if (desc.count > 0)
break;
}
out:
return retval;
}
EXPORT_SYMBOL(generic_file_aio_read);
コメント†