linux-2.6.33/generic_file_aio_read()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#hb74e1d0]
#backlinks
*説明 [#a2515283]
-パス: [[linux-2.6.33/mm/filemap.c]]
-FIXME: これは何?
--説明
**引数 [#pb4bbd6e]
-struct kiocb *iocb
--
--[[linux-2.6.33/kiocb]]
-const struct iovec *iov
--
--[[linux-2.6.33/iovec]]
-unsigned long nr_segs
--
-loff_t pos
--
**返り値 [#k23bc63a]
-ssize_t
--
**参考 [#cfda8061]
-direct_IO に設定される関数
-検索方法
$ egrep -nr '\.direct_IO[\s]*' fs
-結果
fs/block_dev.c:1472: .direct_IO = blkdev_direct_...
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_d...
fs/ext2/inode.c:840: .direct_IO = ext2_d...
fs/ext3/inode.c:1847: .direct_IO = ext3_d...
fs/ext3/inode.c:1863: .direct_IO = ext3_d...
fs/ext4/inode.c:3853: .direct_IO = ext4_d...
fs/ext4/inode.c:3869: .direct_IO = ext4_d...
fs/ext4/inode.c:3901: .direct_IO = ext4_d...
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...
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_...
fs/ocfs2/aops.c:1994: .direct_IO = ocfs2_...
fs/reiserfs/inode.c:3189: .direct_IO = reiserfs_di...
fs/xfs/linux-2.6/xfs_aops.c:1558: .direct_IO ...
*実装 [#i5f4004c]
/**
* 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 i...
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;
-
--[[linux-2.6.33/file]]
count = 0;
retval = generic_segment_checks(iov, &nr_segs, &count, ...
if (retval)
return retval;
-
--[[linux-2.6.33/generic_segment_checks()]]
/* coalesce the iovecs and go direct-to-BIO for O_DIREC...
if (filp->f_flags & O_DIRECT) {
loff_t size;
struct address_space *mapping;
struct inode *inode;
-
--[[linux-2.6.33/address_space]]
-
--[[linux-2.6.33/inode]]
mapping = filp->f_mapping;
inode = mapping->host;
if (!count)
goto out; /* skip atime */
size = i_size_read(inode);
-
--[[linux-2.6.33/i_size_read()]]
if (pos < size) {
retval = filemap_write_and_wait_range(mapping, pos,
pos + iov_length(iov, nr_segs) - 1);
-
--[[linux-2.6.33/filemap_write_and_wait_range()]]
if (!retval) {
retval = mapping->a_ops->direct_IO(READ, iocb,
iov, pos, nr_segs);
-mapping->a_ops は address_space_operations 型
--[[linux-2.6.33/address_space_operations]]
-direct_IO は各ファイルシステムによって異なる
--[[linux-2.6.33/blkdev_direct_IO()]]
--[[linux-2.6.33/btrfs_direct_IO()]]
--[[linux-2.6.33/ext2_direct_IO()]]
--[[linux-2.6.33/ext3_direct_IO()]]
--[[linux-2.6.33/ext4_direct_IO()]]
--[[linux-2.6.33/fat_direct_IO()]]
--[[linux-2.6.33/gfs2_direct_IO()]]
--[[linux-2.6.33/hfs_direct_IO()]]
--[[linux-2.6.33/hfsplus_direct_IO()]]
--[[linux-2.6.33/jfs_direct_IO()]]
--[[linux-2.6.33/nfs_direct_IO()]]
--[[linux-2.6.33/nilfs_direct_IO()]]
--[[linux-2.6.33/ocfs2_direct_IO()]]
--[[linux-2.6.33/reiserfs_direct_IO()]]
--[[linux-2.6.33/xfs_vm_direct_IO()]]
}
if (retval > 0)
*ppos = pos + retval;
if (retval) {
file_accessed(filp);
goto out;
}
-
--[[linux-2.6.33/file_accessed()]]
}
}
for (seg = 0; seg < nr_segs; seg++) {
read_descriptor_t desc;
-
--[[linux-2.6.33/read_descriptor_t]]
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_acto...
-
--[[linux-2.6.33/do_generic_file_read()]]
--[[linux-2.6.33/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);
-特にライセンスを区別せずシンボルを公開する。
--[[linux-2.6.33/EXPORT_SYMBOL()]]
*コメント [#j620b89e]
終了行:
*参照元 [#hb74e1d0]
#backlinks
*説明 [#a2515283]
-パス: [[linux-2.6.33/mm/filemap.c]]
-FIXME: これは何?
--説明
**引数 [#pb4bbd6e]
-struct kiocb *iocb
--
--[[linux-2.6.33/kiocb]]
-const struct iovec *iov
--
--[[linux-2.6.33/iovec]]
-unsigned long nr_segs
--
-loff_t pos
--
**返り値 [#k23bc63a]
-ssize_t
--
**参考 [#cfda8061]
-direct_IO に設定される関数
-検索方法
$ egrep -nr '\.direct_IO[\s]*' fs
-結果
fs/block_dev.c:1472: .direct_IO = blkdev_direct_...
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_d...
fs/ext2/inode.c:840: .direct_IO = ext2_d...
fs/ext3/inode.c:1847: .direct_IO = ext3_d...
fs/ext3/inode.c:1863: .direct_IO = ext3_d...
fs/ext4/inode.c:3853: .direct_IO = ext4_d...
fs/ext4/inode.c:3869: .direct_IO = ext4_d...
fs/ext4/inode.c:3901: .direct_IO = ext4_d...
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...
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_...
fs/ocfs2/aops.c:1994: .direct_IO = ocfs2_...
fs/reiserfs/inode.c:3189: .direct_IO = reiserfs_di...
fs/xfs/linux-2.6/xfs_aops.c:1558: .direct_IO ...
*実装 [#i5f4004c]
/**
* 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 i...
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;
-
--[[linux-2.6.33/file]]
count = 0;
retval = generic_segment_checks(iov, &nr_segs, &count, ...
if (retval)
return retval;
-
--[[linux-2.6.33/generic_segment_checks()]]
/* coalesce the iovecs and go direct-to-BIO for O_DIREC...
if (filp->f_flags & O_DIRECT) {
loff_t size;
struct address_space *mapping;
struct inode *inode;
-
--[[linux-2.6.33/address_space]]
-
--[[linux-2.6.33/inode]]
mapping = filp->f_mapping;
inode = mapping->host;
if (!count)
goto out; /* skip atime */
size = i_size_read(inode);
-
--[[linux-2.6.33/i_size_read()]]
if (pos < size) {
retval = filemap_write_and_wait_range(mapping, pos,
pos + iov_length(iov, nr_segs) - 1);
-
--[[linux-2.6.33/filemap_write_and_wait_range()]]
if (!retval) {
retval = mapping->a_ops->direct_IO(READ, iocb,
iov, pos, nr_segs);
-mapping->a_ops は address_space_operations 型
--[[linux-2.6.33/address_space_operations]]
-direct_IO は各ファイルシステムによって異なる
--[[linux-2.6.33/blkdev_direct_IO()]]
--[[linux-2.6.33/btrfs_direct_IO()]]
--[[linux-2.6.33/ext2_direct_IO()]]
--[[linux-2.6.33/ext3_direct_IO()]]
--[[linux-2.6.33/ext4_direct_IO()]]
--[[linux-2.6.33/fat_direct_IO()]]
--[[linux-2.6.33/gfs2_direct_IO()]]
--[[linux-2.6.33/hfs_direct_IO()]]
--[[linux-2.6.33/hfsplus_direct_IO()]]
--[[linux-2.6.33/jfs_direct_IO()]]
--[[linux-2.6.33/nfs_direct_IO()]]
--[[linux-2.6.33/nilfs_direct_IO()]]
--[[linux-2.6.33/ocfs2_direct_IO()]]
--[[linux-2.6.33/reiserfs_direct_IO()]]
--[[linux-2.6.33/xfs_vm_direct_IO()]]
}
if (retval > 0)
*ppos = pos + retval;
if (retval) {
file_accessed(filp);
goto out;
}
-
--[[linux-2.6.33/file_accessed()]]
}
}
for (seg = 0; seg < nr_segs; seg++) {
read_descriptor_t desc;
-
--[[linux-2.6.33/read_descriptor_t]]
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_acto...
-
--[[linux-2.6.33/do_generic_file_read()]]
--[[linux-2.6.33/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);
-特にライセンスを区別せずシンボルを公開する。
--[[linux-2.6.33/EXPORT_SYMBOL()]]
*コメント [#j620b89e]
ページ名: