diff options
author | Artem B. Bityuckiy <dedekind@infradead.org> | 2005-07-07 11:45:32 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@mtd.linutronix.de> | 2005-07-12 17:55:05 -0400 |
commit | 336d2ff7115bd4391108a16f476c739cb4a505b0 (patch) | |
tree | ac5dbf60deb2b97ec3cc0f0278da24efecacef21 /fs/jffs2/readinode.c | |
parent | 1ca70351af02b1f0eb9cd2e7eb7a547f8ad5d893 (diff) |
[JFFS2] Avoid alloc/dealloc for zero sized nodes
Signed-off-by: Artem B. Bityuckiy <dedekind@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs/jffs2/readinode.c')
-rw-r--r-- | fs/jffs2/readinode.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c index 081656c1d49e..8f0be5557ae9 100644 --- a/fs/jffs2/readinode.c +++ b/fs/jffs2/readinode.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * | 7 | * |
8 | * For licensing information, see the file 'LICENCE' in this directory. | 8 | * For licensing information, see the file 'LICENCE' in this directory. |
9 | * | 9 | * |
10 | * $Id: readinode.c,v 1.120 2005/07/05 21:03:07 dwmw2 Exp $ | 10 | * $Id: readinode.c,v 1.124 2005/07/07 15:45:29 dedekind Exp $ |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
@@ -151,6 +151,9 @@ int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_in | |||
151 | 151 | ||
152 | D1(printk(KERN_DEBUG "jffs2_add_full_dnode_to_inode(ino #%u, f %p, fn %p)\n", f->inocache->ino, f, fn)); | 152 | D1(printk(KERN_DEBUG "jffs2_add_full_dnode_to_inode(ino #%u, f %p, fn %p)\n", f->inocache->ino, f, fn)); |
153 | 153 | ||
154 | if (unlikely(!fn->size)) | ||
155 | return 0; | ||
156 | |||
154 | newfrag = jffs2_alloc_node_frag(); | 157 | newfrag = jffs2_alloc_node_frag(); |
155 | if (unlikely(!newfrag)) | 158 | if (unlikely(!newfrag)) |
156 | return -ENOMEM; | 159 | return -ENOMEM; |
@@ -158,11 +161,6 @@ int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_in | |||
158 | D2(printk(KERN_DEBUG "adding node %04x-%04x @0x%08x on flash, newfrag *%p\n", | 161 | D2(printk(KERN_DEBUG "adding node %04x-%04x @0x%08x on flash, newfrag *%p\n", |
159 | fn->ofs, fn->ofs+fn->size, ref_offset(fn->raw), newfrag)); | 162 | fn->ofs, fn->ofs+fn->size, ref_offset(fn->raw), newfrag)); |
160 | 163 | ||
161 | if (unlikely(!fn->size)) { | ||
162 | jffs2_free_node_frag(newfrag); | ||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | newfrag->ofs = fn->ofs; | 164 | newfrag->ofs = fn->ofs; |
167 | newfrag->size = fn->size; | 165 | newfrag->size = fn->size; |
168 | newfrag->node = fn; | 166 | newfrag->node = fn; |