From 1043504716ec256a6faf8372f5caf9cf42d5a9c5 Mon Sep 17 00:00:00 2001 From: Chris Mason Date: Sat, 5 Aug 2006 12:15:10 -0700 Subject: [PATCH] --- yaml --- r: 33255 b: refs/heads/master c: b4c76fa721c7c8a43655a74e508870d21d2e26d3 h: refs/heads/master i: 33253: 392a3a4c9607038cdbe32576ebd3eabb6108acb2 33251: 9506e95a5c8e9fc2cdd24cd3017895657fddb288 33247: ab5ba3cda2cebfe86047d8c3ee45a0a8a54efa79 v: v3 --- [refs] | 2 +- trunk/fs/reiserfs/inode.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 1f4700a5a7a7..ede947dbdf5e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b5f3953c10b27fcd1c83e199e573b41d8327e22e +refs/heads/master: b4c76fa721c7c8a43655a74e508870d21d2e26d3 diff --git a/trunk/fs/reiserfs/inode.c b/trunk/fs/reiserfs/inode.c index ac57305b1afc..52f1e2136546 100644 --- a/trunk/fs/reiserfs/inode.c +++ b/trunk/fs/reiserfs/inode.c @@ -2340,6 +2340,7 @@ static int reiserfs_write_full_page(struct page *page, unsigned long end_index = inode->i_size >> PAGE_CACHE_SHIFT; int error = 0; unsigned long block; + sector_t last_block; struct buffer_head *head, *bh; int partial = 0; int nr = 0; @@ -2387,10 +2388,19 @@ static int reiserfs_write_full_page(struct page *page, } bh = head; block = page->index << (PAGE_CACHE_SHIFT - s->s_blocksize_bits); + last_block = (i_size_read(inode) - 1) >> inode->i_blkbits; /* first map all the buffers, logging any direct items we find */ do { - if ((checked || buffer_dirty(bh)) && (!buffer_mapped(bh) || - (buffer_mapped(bh) + if (block > last_block) { + /* + * This can happen when the block size is less than + * the page size. The corresponding bytes in the page + * were zero filled above + */ + clear_buffer_dirty(bh); + set_buffer_uptodate(bh); + } else if ((checked || buffer_dirty(bh)) && + (!buffer_mapped(bh) || (buffer_mapped(bh) && bh->b_blocknr == 0))) { /* not mapped yet, or it points to a direct item, search