Commit 3799b3f4adff8b00017340d0b9b41a99e0cc3804
Committed by
Tom Rini
1 parent
39d0ce0659
Exists in
v2017.01-smarct4x
and in
30 other branches
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>
Showing 1 changed file with 6 additions and 0 deletions Side-by-side Diff
fs/jffs2/jffs2_1pass.c
... | ... | @@ -719,6 +719,12 @@ |
719 | 719 | } |
720 | 720 | put_fl_mem(jNode, pL->readbuf); |
721 | 721 | } |
722 | + /* | |
723 | + * If no destination is provided, we are done. | |
724 | + * Just return the total size. | |
725 | + */ | |
726 | + if (!dest) | |
727 | + return totalSize; | |
722 | 728 | #endif |
723 | 729 | |
724 | 730 | for (b = pL->frag.listHead; b != NULL; b = b->next) { |