diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-20 17:50:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-20 17:50:31 -0400 |
commit | be967b7e2f7747a5ebf2a07ee627d9338491e784 (patch) | |
tree | f42b82601209a52b8ee478e36d8b21543ab03060 /fs/jffs2/file.c | |
parent | eef11427edcb821b63920219f89379fab84198b9 (diff) | |
parent | 7bc3312bef4d6f220812500c0de7868fb7625a41 (diff) |
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (199 commits)
[MTD] NAND: Fix breakage all over the place
[PATCH] NAND: fix remaining OOB length calculation
[MTD] NAND Fixup NDFC merge brokeness
[MTD NAND] S3C2410 driver cleanup
[MTD NAND] s3c24x0 board: Fix clock handling, ensure proper initialisation.
[JFFS2] Check CRC32 on dirent and data nodes each time they're read
[JFFS2] When retiring nextblock, allocate a node_ref for the wasted space
[JFFS2] Mark XATTR support as experimental, for now
[JFFS2] Don't trust node headers before the CRC is checked.
[MTD] Restore MTD_ROM and MTD_RAM types
[MTD] assume mtd->writesize is 1 for NOR flashes
[MTD NAND] Fix s3c2410 NAND driver so it at least _looks_ like it compiles
[MTD] Prepare physmap for 64-bit-resources
[JFFS2] Fix more breakage caused by janitorial meddling.
[JFFS2] Remove stray __exit from jffs2_compressors_exit()
[MTD] Allow alternate JFFS2 mount variant for root filesystem.
[MTD] Disconnect struct mtd_info from ABI
[MTD] replace MTD_RAM with MTD_GENERIC_TYPE
[MTD] replace MTD_ROM with MTD_GENERIC_TYPE
[MTD] remove a forgotten MTD_XIP
...
Diffstat (limited to 'fs/jffs2/file.c')
-rw-r--r-- | fs/jffs2/file.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index 9f4171213e58..bb8844f40e48 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c | |||
@@ -54,7 +54,12 @@ const struct file_operations jffs2_file_operations = | |||
54 | 54 | ||
55 | struct inode_operations jffs2_file_inode_operations = | 55 | struct inode_operations jffs2_file_inode_operations = |
56 | { | 56 | { |
57 | .setattr = jffs2_setattr | 57 | .permission = jffs2_permission, |
58 | .setattr = jffs2_setattr, | ||
59 | .setxattr = jffs2_setxattr, | ||
60 | .getxattr = jffs2_getxattr, | ||
61 | .listxattr = jffs2_listxattr, | ||
62 | .removexattr = jffs2_removexattr | ||
58 | }; | 63 | }; |
59 | 64 | ||
60 | struct address_space_operations jffs2_file_address_operations = | 65 | struct address_space_operations jffs2_file_address_operations = |
@@ -129,13 +134,13 @@ static int jffs2_prepare_write (struct file *filp, struct page *pg, | |||
129 | struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); | 134 | struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); |
130 | struct jffs2_raw_inode ri; | 135 | struct jffs2_raw_inode ri; |
131 | struct jffs2_full_dnode *fn; | 136 | struct jffs2_full_dnode *fn; |
132 | uint32_t phys_ofs, alloc_len; | 137 | uint32_t alloc_len; |
133 | 138 | ||
134 | D1(printk(KERN_DEBUG "Writing new hole frag 0x%x-0x%x between current EOF and new page\n", | 139 | D1(printk(KERN_DEBUG "Writing new hole frag 0x%x-0x%x between current EOF and new page\n", |
135 | (unsigned int)inode->i_size, pageofs)); | 140 | (unsigned int)inode->i_size, pageofs)); |
136 | 141 | ||
137 | ret = jffs2_reserve_space(c, sizeof(ri), &phys_ofs, &alloc_len, | 142 | ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len, |
138 | ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); | 143 | ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); |
139 | if (ret) | 144 | if (ret) |
140 | return ret; | 145 | return ret; |
141 | 146 | ||
@@ -161,7 +166,7 @@ static int jffs2_prepare_write (struct file *filp, struct page *pg, | |||
161 | ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8)); | 166 | ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8)); |
162 | ri.data_crc = cpu_to_je32(0); | 167 | ri.data_crc = cpu_to_je32(0); |
163 | 168 | ||
164 | fn = jffs2_write_dnode(c, f, &ri, NULL, 0, phys_ofs, ALLOC_NORMAL); | 169 | fn = jffs2_write_dnode(c, f, &ri, NULL, 0, ALLOC_NORMAL); |
165 | 170 | ||
166 | if (IS_ERR(fn)) { | 171 | if (IS_ERR(fn)) { |
167 | ret = PTR_ERR(fn); | 172 | ret = PTR_ERR(fn); |
@@ -215,12 +220,20 @@ static int jffs2_commit_write (struct file *filp, struct page *pg, | |||
215 | D1(printk(KERN_DEBUG "jffs2_commit_write(): ino #%lu, page at 0x%lx, range %d-%d, flags %lx\n", | 220 | D1(printk(KERN_DEBUG "jffs2_commit_write(): ino #%lu, page at 0x%lx, range %d-%d, flags %lx\n", |
216 | inode->i_ino, pg->index << PAGE_CACHE_SHIFT, start, end, pg->flags)); | 221 | inode->i_ino, pg->index << PAGE_CACHE_SHIFT, start, end, pg->flags)); |
217 | 222 | ||
218 | if (!start && end == PAGE_CACHE_SIZE) { | 223 | if (end == PAGE_CACHE_SIZE) { |
219 | /* We need to avoid deadlock with page_cache_read() in | 224 | if (!start) { |
220 | jffs2_garbage_collect_pass(). So we have to mark the | 225 | /* We need to avoid deadlock with page_cache_read() in |
221 | page up to date, to prevent page_cache_read() from | 226 | jffs2_garbage_collect_pass(). So we have to mark the |
222 | trying to re-lock it. */ | 227 | page up to date, to prevent page_cache_read() from |
223 | SetPageUptodate(pg); | 228 | trying to re-lock it. */ |
229 | SetPageUptodate(pg); | ||
230 | } else { | ||
231 | /* When writing out the end of a page, write out the | ||
232 | _whole_ page. This helps to reduce the number of | ||
233 | nodes in files which have many short writes, like | ||
234 | syslog files. */ | ||
235 | start = aligned_start = 0; | ||
236 | } | ||
224 | } | 237 | } |
225 | 238 | ||
226 | ri = jffs2_alloc_raw_inode(); | 239 | ri = jffs2_alloc_raw_inode(); |