OCFS2 1.2.4-2 の r2948 fs - Allow direct I/O read past end of file

OCFS2 1.2.4-2 で変更された
http://oss.oracle.com/projects/ocfs2/news/article_10.html

r2948 fs - Allow direct I/O read past end of file
が気になる。

http://www.kernel.org/pub/linux/kernel/v2.6/testing/ChangeLog-2.6.20-rc3
で入って
http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.20
に書いてある

commit 564f8a3228879d6962edb3432d01bcd7499a67ec
Author: Mark Fasheh
Date: Thu Dec 14 13:01:05 2006 -0800

ocfs2: Allow direct I/O read past end of file

ocfs2_direct_IO_get_blocks() was incorrectly returning -EIO for a direct I/O
read whose start block was past the end of the file allocation tree. Fix
things so that we return a hole instead. do_direct_IO() will then notice
that the range start is past eof and return a short read.

While there, remove the unused vbo_max variable.

Signed-off-by: Mark Fasheh

だと思われ。
[git patches] ocfs2 fixes
http://comments.gmane.org/gmane.comp.file-systems.ocfs2.devel/368
が気になったので、(Continue reading)をクリックして
http://permalink.gmane.org/gmane.linux.kernel/479398
と、
http://oss.oracle.com/projects/ocfs2/dist/files/source/v1.2/ocfs2-1.2.3.tar.gz

http://oss.oracle.com/projects/ocfs2/dist/files/source/v1.2/ocfs2-1.2.4.tar.gz
の ./fs/ocfs2/aops.c を比較する。

% diff /tmp/src/ocfs2-1.2.3/fs/ocfs2/aops.c /tmp/src/ocfs2-1.2.4/fs/ocfs2/aops.c
330a331
> #ifdef DIO_OLD_GET_BLOCKS
334a336,341
> #else
> static int ocfs2_direct_IO_get_blocks(struct inode *inode, sector_t iblock,
>                                    struct buffer_head *bh_result, int create)
> {
>       unsigned long max_blocks = bh_result->b_size >> inode->i_blkbits;
> #endif
336,337c343
<       u64 vbo_max; /* file offset, max_blocks from iblock */
<       u64 p_blkno;
    • -
> u64 p_blkno, inode_blocks; 352,353d357 < vbo_max = *1 {
    • -
> inode_blocks = ocfs2_clusters_to_blocks(inode->i_sb, > OCFS2_I(inode)->ip_clusters); > > /* > * For a read which begins past the end of file, we return a hole. > */ > if (!create && (iblock >= inode_blocks)) { > spin_unlock(&OCFS2_I(inode)->ip_lock); > ret = 0; > goto bail; > } > > /* > * Any write past EOF is not allowed because we'd be extending. > */ > if (create && (iblock + max_blocks) > inode_blocks) { %

こんな感じ。
微妙に違うけど、本質的なことろは一緒でしょう。
これを元に更に勉強。

*1:u64)iblock + max_blocks) << blocksize_bits; < 355,357c359,374 < if ((iblock + max_blocks) > < ocfs2_clusters_to_blocks(inode->i_sb, < OCFS2_I(inode)->ip_clusters