diff options
author | Jesper Juhl <jesper.juhl@gmail.com> | 2006-05-12 06:55:51 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-05-12 06:55:51 -0400 |
commit | 20ffdcb00a792073f6e620dc2c644b3c8fbab528 (patch) | |
tree | 73983f99c0f2e3f46cf69ef1f14585937782f1c3 | |
parent | 1867b7e3f85dc69695735ea4a4cd12027c565d89 (diff) |
[JFFS2] Remove number of pointer dereferences in fs/jffs2/summary.c
Reduce the nr. of pointer dereferences in fs/jffs2/summary.c
Benefits:
- micro speed optimization due to fewer pointer derefs
- generated code is slightly smaller
- better readability
(The first two sound like a compiler problem but I'll go with the third. dwmw2).
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
-rw-r--r-- | fs/jffs2/summary.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c index 3240d62d9707..7b0ed77a4c35 100644 --- a/fs/jffs2/summary.c +++ b/fs/jffs2/summary.c | |||
@@ -581,16 +581,17 @@ static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock | |||
581 | wpage = c->summary->sum_buf; | 581 | wpage = c->summary->sum_buf; |
582 | 582 | ||
583 | while (c->summary->sum_num) { | 583 | while (c->summary->sum_num) { |
584 | temp = c->summary->sum_list_head; | ||
584 | 585 | ||
585 | switch (je16_to_cpu(c->summary->sum_list_head->u.nodetype)) { | 586 | switch (je16_to_cpu(temp->u.nodetype)) { |
586 | case JFFS2_NODETYPE_INODE: { | 587 | case JFFS2_NODETYPE_INODE: { |
587 | struct jffs2_sum_inode_flash *sino_ptr = wpage; | 588 | struct jffs2_sum_inode_flash *sino_ptr = wpage; |
588 | 589 | ||
589 | sino_ptr->nodetype = c->summary->sum_list_head->i.nodetype; | 590 | sino_ptr->nodetype = temp->i.nodetype; |
590 | sino_ptr->inode = c->summary->sum_list_head->i.inode; | 591 | sino_ptr->inode = temp->i.inode; |
591 | sino_ptr->version = c->summary->sum_list_head->i.version; | 592 | sino_ptr->version = temp->i.version; |
592 | sino_ptr->offset = c->summary->sum_list_head->i.offset; | 593 | sino_ptr->offset = temp->i.offset; |
593 | sino_ptr->totlen = c->summary->sum_list_head->i.totlen; | 594 | sino_ptr->totlen = temp->i.totlen; |
594 | 595 | ||
595 | wpage += JFFS2_SUMMARY_INODE_SIZE; | 596 | wpage += JFFS2_SUMMARY_INODE_SIZE; |
596 | 597 | ||
@@ -600,19 +601,19 @@ static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock | |||
600 | case JFFS2_NODETYPE_DIRENT: { | 601 | case JFFS2_NODETYPE_DIRENT: { |
601 | struct jffs2_sum_dirent_flash *sdrnt_ptr = wpage; | 602 | struct jffs2_sum_dirent_flash *sdrnt_ptr = wpage; |
602 | 603 | ||
603 | sdrnt_ptr->nodetype = c->summary->sum_list_head->d.nodetype; | 604 | sdrnt_ptr->nodetype = temp->d.nodetype; |
604 | sdrnt_ptr->totlen = c->summary->sum_list_head->d.totlen; | 605 | sdrnt_ptr->totlen = temp->d.totlen; |
605 | sdrnt_ptr->offset = c->summary->sum_list_head->d.offset; | 606 | sdrnt_ptr->offset = temp->d.offset; |
606 | sdrnt_ptr->pino = c->summary->sum_list_head->d.pino; | 607 | sdrnt_ptr->pino = temp->d.pino; |
607 | sdrnt_ptr->version = c->summary->sum_list_head->d.version; | 608 | sdrnt_ptr->version = temp->d.version; |
608 | sdrnt_ptr->ino = c->summary->sum_list_head->d.ino; | 609 | sdrnt_ptr->ino = temp->d.ino; |
609 | sdrnt_ptr->nsize = c->summary->sum_list_head->d.nsize; | 610 | sdrnt_ptr->nsize = temp->d.nsize; |
610 | sdrnt_ptr->type = c->summary->sum_list_head->d.type; | 611 | sdrnt_ptr->type = temp->d.type; |
611 | 612 | ||
612 | memcpy(sdrnt_ptr->name, c->summary->sum_list_head->d.name, | 613 | memcpy(sdrnt_ptr->name, temp->d.name, |
613 | c->summary->sum_list_head->d.nsize); | 614 | temp->d.nsize); |
614 | 615 | ||
615 | wpage += JFFS2_SUMMARY_DIRENT_SIZE(c->summary->sum_list_head->d.nsize); | 616 | wpage += JFFS2_SUMMARY_DIRENT_SIZE(temp->d.nsize); |
616 | 617 | ||
617 | break; | 618 | break; |
618 | } | 619 | } |
@@ -622,8 +623,7 @@ static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock | |||
622 | } | 623 | } |
623 | } | 624 | } |
624 | 625 | ||
625 | temp = c->summary->sum_list_head; | 626 | c->summary->sum_list_head = temp->u.next; |
626 | c->summary->sum_list_head = c->summary->sum_list_head->u.next; | ||
627 | kfree(temp); | 627 | kfree(temp); |
628 | 628 | ||
629 | c->summary->sum_num--; | 629 | c->summary->sum_num--; |