summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorMark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>2015-07-01 16:38:22 +1200
committerTom Rini <trini@konsulko.com>2015-08-12 20:47:29 -0400
commit3799b3f4adff8b00017340d0b9b41a99e0cc3804 (patch)
tree726c646ec132970909f249e3eb780ec76cceefed /fs
parent39d0ce06599c73e6e5b8d8c43c64e5272694cbbc (diff)
downloadu-boot-3799b3f4adff8b00017340d0b9b41a99e0cc3804.tar.gz
u-boot-3799b3f4adff8b00017340d0b9b41a99e0cc3804.tar.bz2
u-boot-3799b3f4adff8b00017340d0b9b41a99e0cc3804.zip
JFFS2: Return early when file read not necessary
If a destination is not provided, jffs2_1pass_read_inode() only returns the length of the file. In this case, avoid reading all the data nodes, and return as soon as the length of the file is known. Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
Diffstat (limited to 'fs')
-rw-r--r--fs/jffs2/jffs2_1pass.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index b1d6470219..2e569ff59b 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -719,6 +719,12 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char *dest)
}
put_fl_mem(jNode, pL->readbuf);
}
+ /*
+ * If no destination is provided, we are done.
+ * Just return the total size.
+ */
+ if (!dest)
+ return totalSize;
#endif
for (b = pL->frag.listHead; b != NULL; b = b->next) {