aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jffs2/file.c')
-rw-r--r--fs/jffs2/file.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c
index 61e6723535b9..db3889ba8818 100644
--- a/fs/jffs2/file.c
+++ b/fs/jffs2/file.c
@@ -10,6 +10,8 @@
10 * 10 *
11 */ 11 */
12 12
13#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
14
13#include <linux/kernel.h> 15#include <linux/kernel.h>
14#include <linux/fs.h> 16#include <linux/fs.h>
15#include <linux/time.h> 17#include <linux/time.h>
@@ -85,7 +87,8 @@ static int jffs2_do_readpage_nolock (struct inode *inode, struct page *pg)
85 unsigned char *pg_buf; 87 unsigned char *pg_buf;
86 int ret; 88 int ret;
87 89
88 D2(printk(KERN_DEBUG "jffs2_do_readpage_nolock(): ino #%lu, page at offset 0x%lx\n", inode->i_ino, pg->index << PAGE_CACHE_SHIFT)); 90 jffs2_dbg(2, "%s(): ino #%lu, page at offset 0x%lx\n",
91 __func__, inode->i_ino, pg->index << PAGE_CACHE_SHIFT);
89 92
90 BUG_ON(!PageLocked(pg)); 93 BUG_ON(!PageLocked(pg));
91 94
@@ -105,7 +108,7 @@ static int jffs2_do_readpage_nolock (struct inode *inode, struct page *pg)
105 flush_dcache_page(pg); 108 flush_dcache_page(pg);
106 kunmap(pg); 109 kunmap(pg);
107 110
108 D2(printk(KERN_DEBUG "readpage finished\n")); 111 jffs2_dbg(2, "readpage finished\n");
109 return ret; 112 return ret;
110} 113}
111 114
@@ -144,7 +147,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
144 return -ENOMEM; 147 return -ENOMEM;
145 *pagep = pg; 148 *pagep = pg;
146 149
147 D1(printk(KERN_DEBUG "jffs2_write_begin()\n")); 150 jffs2_dbg(1, "%s()\n", __func__);
148 151
149 if (pageofs > inode->i_size) { 152 if (pageofs > inode->i_size) {
150 /* Make new hole frag from old EOF to new page */ 153 /* Make new hole frag from old EOF to new page */
@@ -153,8 +156,8 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
153 struct jffs2_full_dnode *fn; 156 struct jffs2_full_dnode *fn;
154 uint32_t alloc_len; 157 uint32_t alloc_len;
155 158
156 D1(printk(KERN_DEBUG "Writing new hole frag 0x%x-0x%x between current EOF and new page\n", 159 jffs2_dbg(1, "Writing new hole frag 0x%x-0x%x between current EOF and new page\n",
157 (unsigned int)inode->i_size, pageofs)); 160 (unsigned int)inode->i_size, pageofs);
158 161
159 ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len, 162 ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len,
160 ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); 163 ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE);
@@ -198,7 +201,8 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
198 f->metadata = NULL; 201 f->metadata = NULL;
199 } 202 }
200 if (ret) { 203 if (ret) {
201 D1(printk(KERN_DEBUG "Eep. add_full_dnode_to_inode() failed in write_begin, returned %d\n", ret)); 204 jffs2_dbg(1, "Eep. add_full_dnode_to_inode() failed in write_begin, returned %d\n",
205 ret);
202 jffs2_mark_node_obsolete(c, fn->raw); 206 jffs2_mark_node_obsolete(c, fn->raw);
203 jffs2_free_full_dnode(fn); 207 jffs2_free_full_dnode(fn);
204 jffs2_complete_reservation(c); 208 jffs2_complete_reservation(c);
@@ -222,7 +226,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
222 if (ret) 226 if (ret)
223 goto out_page; 227 goto out_page;
224 } 228 }
225 D1(printk(KERN_DEBUG "end write_begin(). pg->flags %lx\n", pg->flags)); 229 jffs2_dbg(1, "end write_begin(). pg->flags %lx\n", pg->flags);
226 return ret; 230 return ret;
227 231
228out_page: 232out_page:
@@ -248,8 +252,9 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping,
248 int ret = 0; 252 int ret = 0;
249 uint32_t writtenlen = 0; 253 uint32_t writtenlen = 0;
250 254
251 D1(printk(KERN_DEBUG "jffs2_write_end(): ino #%lu, page at 0x%lx, range %d-%d, flags %lx\n", 255 jffs2_dbg(1, "%s(): ino #%lu, page at 0x%lx, range %d-%d, flags %lx\n",
252 inode->i_ino, pg->index << PAGE_CACHE_SHIFT, start, end, pg->flags)); 256 __func__, inode->i_ino, pg->index << PAGE_CACHE_SHIFT,
257 start, end, pg->flags);
253 258
254 /* We need to avoid deadlock with page_cache_read() in 259 /* We need to avoid deadlock with page_cache_read() in
255 jffs2_garbage_collect_pass(). So the page must be 260 jffs2_garbage_collect_pass(). So the page must be
@@ -268,7 +273,8 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping,
268 ri = jffs2_alloc_raw_inode(); 273 ri = jffs2_alloc_raw_inode();
269 274
270 if (!ri) { 275 if (!ri) {
271 D1(printk(KERN_DEBUG "jffs2_write_end(): Allocation of raw inode failed\n")); 276 jffs2_dbg(1, "%s(): Allocation of raw inode failed\n",
277 __func__);
272 unlock_page(pg); 278 unlock_page(pg);
273 page_cache_release(pg); 279 page_cache_release(pg);
274 return -ENOMEM; 280 return -ENOMEM;
@@ -315,13 +321,14 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping,
315 /* generic_file_write has written more to the page cache than we've 321 /* generic_file_write has written more to the page cache than we've
316 actually written to the medium. Mark the page !Uptodate so that 322 actually written to the medium. Mark the page !Uptodate so that
317 it gets reread */ 323 it gets reread */
318 D1(printk(KERN_DEBUG "jffs2_write_end(): Not all bytes written. Marking page !uptodate\n")); 324 jffs2_dbg(1, "%s(): Not all bytes written. Marking page !uptodate\n",
325 __func__);
319 SetPageError(pg); 326 SetPageError(pg);
320 ClearPageUptodate(pg); 327 ClearPageUptodate(pg);
321 } 328 }
322 329
323 D1(printk(KERN_DEBUG "jffs2_write_end() returning %d\n", 330 jffs2_dbg(1, "%s() returning %d\n",
324 writtenlen > 0 ? writtenlen : ret)); 331 __func__, writtenlen > 0 ? writtenlen : ret);
325 unlock_page(pg); 332 unlock_page(pg);
326 page_cache_release(pg); 333 page_cache_release(pg);
327 return writtenlen > 0 ? writtenlen : ret; 334 return writtenlen > 0 ? writtenlen : ret;