From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiko Schocher denx Date: Tue, 30 Jun 2015 11:09:25 +0200 Subject: [U-Boot] [PATCH 4/8] JFFS2: Improve speed reading flash files In-Reply-To: <1435554149-18042-5-git-send-email-mark.tomlinson@alliedtelesis.co.nz> References: <1435554149-18042-1-git-send-email-mark.tomlinson@alliedtelesis.co.nz> <1435554149-18042-5-git-send-email-mark.tomlinson@alliedtelesis.co.nz> Message-ID: <55925CC5.4000108@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello Mark, Am 29.06.2015 um 07:02 schrieb Mark Tomlinson: > jffs2_1pass_read_inode() would read the entire data for each node > in the filesystem, regardless of whether it was part of the file > to be loaded or not. By only reading the header data for an inode, > and then reading the data only when it is found to be part of the > file to be loaded, much copying of data is saved. > > jffs2_1pass_list_inodes() read each inode for every file in the > directory into a buffer. By using NULL as a buffer pointer, NOR > flash simply returns a pointer, and therefore avoids a memory copy. > > Signed-off-by: Mark Tomlinson > --- > > fs/jffs2/jffs2_1pass.c | 25 +++++++++++++++++++------ > 1 file changed, 19 insertions(+), 6 deletions(-) Reviewed-by: Heiko Schocher bye, Heiko > > diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c > index 1f6eea7..80210be 100644 > --- a/fs/jffs2/jffs2_1pass.c > +++ b/fs/jffs2/jffs2_1pass.c > @@ -730,8 +730,12 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char *dest) > #endif > > for (b = pL->frag.listHead; b != NULL; b = b->next) { > - jNode = (struct jffs2_raw_inode *) get_node_mem(b->offset, > - pL->readbuf); > + /* Copy just the node and not the data at this point, > + * since we don't yet know if we need this data. > + */ > + jNode = (struct jffs2_raw_inode *)get_fl_mem(b->offset, > + sizeof(struct jffs2_raw_inode), > + pL->readbuf); > if (inode == jNode->ino) { > #if 0 > putLabeledWord("\r\n\r\nread_inode: totlen = ", jNode->totlen); > @@ -755,7 +759,14 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char *dest) > #endif > > if(dest) { > - src = ((uchar *) jNode) + sizeof(struct jffs2_raw_inode); > + /* Now that the inode has been checked, > + * read the entire inode, including data. > + */ > + put_fl_mem(jNode, pL->readbuf); > + jNode = (struct jffs2_raw_inode *) > + get_node_mem(b->offset, pL->readbuf); > + src = ((uchar *)jNode) + > + sizeof(struct jffs2_raw_inode); > /* ignore data behind latest known EOF */ > if (jNode->offset > totalSize) { > put_fl_mem(jNode, pL->readbuf); > @@ -962,7 +973,6 @@ jffs2_1pass_list_inodes(struct b_lists * pL, u32 pino) > pL->readbuf); > if (pino == jDir->pino) { > u32 i_version = 0; > - struct jffs2_raw_inode ojNode; > struct jffs2_raw_inode *jNode, *i = NULL; > struct b_node *b2; > > @@ -997,8 +1007,10 @@ jffs2_1pass_list_inodes(struct b_lists * pL, u32 pino) > > for (b2 = pL->frag.listHead; b2; b2 = b2->next) { > jNode = (struct jffs2_raw_inode *) > - get_fl_mem(b2->offset, sizeof(ojNode), &ojNode); > - if (jNode->ino == jDir->ino && jNode->version >= i_version) { > + get_fl_mem(b2->offset, sizeof(*jNode), > + NULL); > + if (jNode->ino == jDir->ino && > + jNode->version >= i_version) { > i_version = jNode->version; > if (i) > put_fl_mem(i, NULL); > @@ -1011,6 +1023,7 @@ jffs2_1pass_list_inodes(struct b_lists * pL, u32 pino) > sizeof(*i), > NULL); > } > + put_fl_mem(jNode, NULL); > } > > dump_inode(pL, jDir, i); > -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany