diff options
author | David Woodhouse <dwmw2@infradead.org> | 2008-02-25 10:20:50 -0500 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2008-02-25 10:20:50 -0500 |
commit | b28ba9fa0154f78f3d36f5ae9a42f7bb01663cca (patch) | |
tree | aeaffaf6f8b108f82fa5004be8b0c7309ca6f55c /fs | |
parent | 66a10506d632051e1153e2555f4b2c820d427f64 (diff) |
[JFFS2] Set i_blocks when truncating files
Addresses OLPC trac #6480
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/jffs2/fs.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index e26ea78c7892..3f49562dc508 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c | |||
@@ -149,6 +149,7 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr) | |||
149 | if (ivalid & ATTR_SIZE && inode->i_size < iattr->ia_size) { | 149 | if (ivalid & ATTR_SIZE && inode->i_size < iattr->ia_size) { |
150 | jffs2_add_full_dnode_to_inode(c, f, new_metadata); | 150 | jffs2_add_full_dnode_to_inode(c, f, new_metadata); |
151 | inode->i_size = iattr->ia_size; | 151 | inode->i_size = iattr->ia_size; |
152 | inode->i_blocks = (inode->i_size + 511) >> 9; | ||
152 | f->metadata = NULL; | 153 | f->metadata = NULL; |
153 | } else { | 154 | } else { |
154 | f->metadata = new_metadata; | 155 | f->metadata = new_metadata; |
@@ -167,8 +168,10 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr) | |||
167 | We are protected from a simultaneous write() extending i_size | 168 | We are protected from a simultaneous write() extending i_size |
168 | back past iattr->ia_size, because do_truncate() holds the | 169 | back past iattr->ia_size, because do_truncate() holds the |
169 | generic inode semaphore. */ | 170 | generic inode semaphore. */ |
170 | if (ivalid & ATTR_SIZE && inode->i_size > iattr->ia_size) | 171 | if (ivalid & ATTR_SIZE && inode->i_size > iattr->ia_size) { |
171 | vmtruncate(inode, iattr->ia_size); | 172 | vmtruncate(inode, iattr->ia_size); |
173 | inode->i_blocks = (inode->i_size + 511) >> 9; | ||
174 | } | ||
172 | 175 | ||
173 | return 0; | 176 | return 0; |
174 | } | 177 | } |