diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-09 15:11:58 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-09 15:11:58 -0800 |
commit | e36aeee65d4db050bd8713537416a0a0632db079 (patch) | |
tree | 4d6ec6397598bb93e877ef84cdd6537a62736484 /fs/ocfs2/aops.c | |
parent | b2f051ae390432789f2b02fe451aa23ae2698e3d (diff) | |
parent | e325a88f17196f18888f6e1426eb9fe3b4346d28 (diff) |
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2:
ocfs2: fix rename vs unlink race
[PATCH] Fix possibly too long write in o2hb_setup_one_bio()
ocfs2: fix write() performance regression
ocfs2: Commit journal on sync writes
ocfs2: Re-order iput in ocfs2_drop_dentry_lock
ocfs2: Create locks at initially requested level
[PATCH] Fix priority mistakes in fs/ocfs2/{alloc.c, dlmglue.c}
[2.6 patch] make ocfs2_find_entry_el() static
Diffstat (limited to 'fs/ocfs2/aops.c')
-rw-r--r-- | fs/ocfs2/aops.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index c69c1b30015..556e34ccb00 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c @@ -729,6 +729,27 @@ static void ocfs2_clear_page_regions(struct page *page, } /* + * Nonsparse file systems fully allocate before we get to the write + * code. This prevents ocfs2_write() from tagging the write as an + * allocating one, which means ocfs2_map_page_blocks() might try to + * read-in the blocks at the tail of our file. Avoid reading them by + * testing i_size against each block offset. + */ +static int ocfs2_should_read_blk(struct inode *inode, struct page *page, + unsigned int block_start) +{ + u64 offset = page_offset(page) + block_start; + + if (ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb))) + return 1; + + if (i_size_read(inode) > offset) + return 1; + + return 0; +} + +/* * Some of this taken from block_prepare_write(). We already have our * mapping by now though, and the entire write will be allocating or * it won't, so not much need to use BH_New. @@ -781,6 +802,7 @@ int ocfs2_map_page_blocks(struct page *page, u64 *p_blkno, set_buffer_uptodate(bh); } else if (!buffer_uptodate(bh) && !buffer_delay(bh) && !buffer_new(bh) && + ocfs2_should_read_blk(inode, page, block_start) && (block_start < from || block_end > to)) { ll_rw_block(READ, 1, &bh); *wait_bh++=bh; |