public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/6] jffs2: rewrite jffs2 scanning code based	on Linux one
Date: Thu, 13 Nov 2008 19:06:05 +0100	[thread overview]
Message-ID: <20081113180605.GD25695@game.jcrosoft.org> (raw)
In-Reply-To: <1226594976-6087-4-git-send-email-yanok@emcraft.com>

>  
>  	/* start at the beginning of the partition */
> -	while (offset < max) {
> -		if ((oldoffset >> SPIN_BLKSIZE) != (offset >> SPIN_BLKSIZE)) {
> -			printf("\b\b%c ", spinner[counter++ % sizeof(spinner)]);
> -			oldoffset = offset;
> -		}
> +	for (i = 0; i < nr_sectors; i++) {
> +		uint32_t sector_ofs = i * part->sector_size;
> +		uint32_t buf_ofs = sector_ofs;
> +		uint32_t buf_len = EMPTY_SCAN_SIZE(part->sector_size);
> +		uint32_t ofs, prevofs;
>  
>  		WATCHDOG_RESET();
> +		get_fl_mem((u32)part->offset + buf_ofs, buf_len, buf);
>  
> -		node = (struct jffs2_unknown_node *) get_node_mem((u32)part->offset + offset);
> -		if (node->magic == JFFS2_MAGIC_BITMASK && hdr_crc(node)) {
> +		/* We temporarily use 'ofs' as a pointer into the buffer/jeb */
> +		ofs = 0;
> +
> +		/* Scan only 4KiB of 0xFF before declaring it's empty */
> +		while (ofs < EMPTY_SCAN_SIZE(part->sector_size) &&
> +				*(uint32_t *)(&buf[ofs]) == 0xFFFFFFFF)
please use readx/writex
> +			ofs += 4;
> +
> +		if (ofs == EMPTY_SCAN_SIZE(part->sector_size))
> +			continue;
> +
> +		ofs += sector_ofs;
> +		prevofs = ofs - 1;
> +
> +	scan_more:
> +		while (ofs < sector_ofs + part->sector_size) {
> +			if (ofs == prevofs) {
> +				printf("offset %08x already seen, skip\n", ofs);
> +				ofs += 4;
> +				counter4++;
> +				continue;
> +			}
> +			prevofs = ofs;
> +			if (sector_ofs + part->sector_size <
> +					ofs + sizeof(*node))
> +				break;
> +			if (buf_ofs + buf_len < ofs + sizeof(*node)) {
> +				buf_len = min_t(uint32_t, buf_size, sector_ofs
> +						+ part->sector_size - ofs);
> +				get_fl_mem((u32)part->offset + ofs, buf_len,
> +					   buf);
> +				buf_ofs = ofs;
> +			}
> +
> +			node = (struct jffs2_unknown_node *)&buf[ofs-buf_ofs];
> +
> +			if (*(uint32_t *)(&buf[ofs-buf_ofs]) == 0xffffffff) {
please use readx/writex
> +				uint32_t inbuf_ofs;
> +				uint32_t empty_start, scan_end;
> +
> +				empty_start = ofs;
> +				ofs += 4;
> +				scan_end = min_t(uint32_t, EMPTY_SCAN_SIZE(
> +							part->sector_size)/8,
> +							buf_len);
> +			more_empty:
> +				inbuf_ofs = ofs - buf_ofs;
> +				while (inbuf_ofs < scan_end) {
> +					if (*(uint32_t *)(&buf[inbuf_ofs]) !=
> +							0xffffffff)
please use readx/writex and so on

Best Regards,
J.

  reply	other threads:[~2008-11-13 18:06 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-13 16:49 [U-Boot] [RFC PATCH 0/6] Some speed improvements to U-Boot JFFS2 code (updated) Ilya Yanok
2008-11-13 16:49 ` [U-Boot] [PATCH 1/6] jffs2: fix searching for latest version in jffs2_1pass_list_inodes() Ilya Yanok
2008-12-09 22:38   ` Wolfgang Denk
2008-11-13 16:49 ` [U-Boot] [PATCH 2/6] jffs2: add sector_size field to part_info structure Ilya Yanok
2008-11-13 18:01   ` Jean-Christophe PLAGNIOL-VILLARD
2008-11-13 18:16     ` Ben Warren
2008-12-09 22:39   ` Wolfgang Denk
2008-11-13 16:49 ` [U-Boot] [PATCH 3/6] jffs2: rewrite jffs2 scanning code based on Linux one Ilya Yanok
2008-11-13 18:06   ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2008-11-20 14:31     ` Ilya Yanok
2008-12-09 22:39   ` Wolfgang Denk
2008-12-10 13:30   ` Stefan Roese
2008-12-11  2:49     ` Ilya Yanok
2008-12-11  2:51       ` [U-Boot] [PATCH] jffs2: include <linux/mtd/compat.h> instead of defining own min_t Ilya Yanok
2008-12-11  6:24         ` Stefan Roese
2008-12-16 16:14         ` Wolfgang Denk
2008-11-13 16:49 ` [U-Boot] [PATCH 4/6] jffs2: add buffer to cache flash accesses Ilya Yanok
2008-12-09 22:41   ` Wolfgang Denk
2008-11-13 16:49 ` [U-Boot] [PATCH 5/6] jffs2: summary support Ilya Yanok
2008-12-09 22:41   ` Wolfgang Denk
2008-11-13 16:49 ` [U-Boot] [PATCH 6/6] jffs2: cache data_crc results Ilya Yanok
2008-12-09 22:41   ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081113180605.GD25695@game.jcrosoft.org \
    --to=plagnioj@jcrosoft.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox