From ec3631ebb6f784574ec03502344901ac71b8d234 Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Fri, 19 Oct 2007 17:16:53 +1000 Subject: [PATCH] --- yaml --- r: 72217 b: refs/heads/master c: 2a754b51aacb122cec25c849e3cf7f5503cc3ec6 h: refs/heads/master i: 72215: cf2e0b009fd35dfbc89cc76c26270821c62f4618 v: v3 --- [refs] | 2 +- trunk/fs/jffs2/file.c | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/[refs] b/[refs] index 2bb03498ae0a..6ed3f658fdad 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c21f900cb8817009930e672d22a5b91e5b706351 +refs/heads/master: 2a754b51aacb122cec25c849e3cf7f5503cc3ec6 diff --git a/trunk/fs/jffs2/file.c b/trunk/fs/jffs2/file.c index 023a17539dd4..f9c5dd6f4b64 100644 --- a/trunk/fs/jffs2/file.c +++ b/trunk/fs/jffs2/file.c @@ -255,7 +255,7 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping, _whole_ page. This helps to reduce the number of nodes in files which have many short writes, like syslog files. */ - start = aligned_start = 0; + aligned_start = 0; } ri = jffs2_alloc_raw_inode(); @@ -291,14 +291,11 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping, } /* Adjust writtenlen for the padding we did, so we don't confuse our caller */ - if (writtenlen < (start&3)) - writtenlen = 0; - else - writtenlen -= (start&3); + writtenlen -= min(writtenlen, (start - aligned_start)); if (writtenlen) { - if (inode->i_size < (pg->index << PAGE_CACHE_SHIFT) + start + writtenlen) { - inode->i_size = (pg->index << PAGE_CACHE_SHIFT) + start + writtenlen; + if (inode->i_size < pos + writtenlen) { + inode->i_size = pos + writtenlen; inode->i_blocks = (inode->i_size + 511) >> 9; inode->i_ctime = inode->i_mtime = ITIME(je32_to_cpu(ri->ctime));