All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Schocher invitel <heiko.schocher@invitel.hu>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 7/8] JFFS2: Use CLEANMARKER to reduce scanning time
Date: Tue, 30 Jun 2015 11:16:29 +0200	[thread overview]
Message-ID: <55925E6D.40508@invitel.hu> (raw)
In-Reply-To: <1435554149-18042-8-git-send-email-mark.tomlinson@alliedtelesis.co.nz>

Hello Mark,

Am 29.06.2015 um 07:02 schrieb Mark Tomlinson:
> If a sector has a CLEANMARKER at the beginning, it indicates that the
> entire sector has been erased. Therefore, if this is found, we can skip the
> entire block. This was not being done before this patch.
>
> The code now does the same as the kernel does when encountering a
> CLEANMARKER. It still checks that the next few words are FFFFFFFF, and if
> so, the block is assumed to be empty, and so is skipped.
>
> Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
> ---
>
>   fs/jffs2/jffs2_1pass.c | 22 ++++++++++++++++++++++
>   1 file changed, 22 insertions(+)

Beside of your comment style

Reviewed-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
>
> diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
> index d78fb06..26a748f 100644
> --- a/fs/jffs2/jffs2_1pass.c
> +++ b/fs/jffs2/jffs2_1pass.c
> @@ -1520,6 +1520,8 @@ jffs2_1pass_build_lists(struct part_info * part)
>   		uint32_t sumlen;
>   		int ret;
>   #endif
> +		/* Indicates a sector with a CLEANMARKER was found */
> +		int clean_sector = 0;
>
>   		/* Set buf_size to maximum length */
>   		buf_size = DEFAULT_EMPTY_SCAN_SIZE;
> @@ -1643,6 +1645,13 @@ jffs2_1pass_build_lists(struct part_info * part)
>   					ofs += 4;
>   				}
>   				/* Ran off end. */
> +				/* If this sector had a clean marker at the
> +				 * beginning, and immediately following this
> +				 * have been a bunch of FF bytes, treat the
> +				 * entire sector as empty.
> +				 */
> +				if (clean_sector)
> +					break;
>
>   				/* See how much more there is to read in this
>   				 * eraseblock...
> @@ -1664,6 +1673,10 @@ jffs2_1pass_build_lists(struct part_info * part)
>   				buf_ofs = ofs;
>   				goto more_empty;
>   			}
> +			/* Found something not erased in the sector, so reset
> +			 * the 'clean_sector' flag.
> +			 */
> +			clean_sector = 0;
>   			if (node->magic != JFFS2_MAGIC_BITMASK ||
>   					!hdr_crc(node)) {
>   				ofs += 4;
> @@ -1745,6 +1758,15 @@ jffs2_1pass_build_lists(struct part_info * part)
>   						"%d != %zu\n",
>   						node->totlen,
>   						sizeof(struct jffs2_unknown_node));
> +				if ((node->totlen ==
> +				     sizeof(struct jffs2_unknown_node)) &&
> +				    (ofs == sector_ofs)) {
> +					/* Found a CLEANMARKER at the beginning
> +					 * of the sector. It's in the correct
> +					 * place with correct size and CRC.
> +					 */
> +					clean_sector = 1;
> +				}
>   				break;
>   			case JFFS2_NODETYPE_PADDING:
>   				if (node->totlen < sizeof(struct jffs2_unknown_node))
>

  reply	other threads:[~2015-06-30  9:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-29  5:02 [U-Boot] [PATCH 0/8] JFFS2 fixes and performance improvements Mark Tomlinson
2015-06-29  5:02 ` [U-Boot] [PATCH 1/8] JFFS2: Return early when file read not necessary Mark Tomlinson
2015-06-30  9:01   ` Heiko Schocher denx
2015-06-29  5:02 ` [U-Boot] [PATCH 2/8] JFFS2: Speed up and fix comparison functions Mark Tomlinson
2015-06-30  9:04   ` Heiko Schocher denx
2015-06-29  5:02 ` [U-Boot] [PATCH 3/8] JFFS2: Only list each directory entry once Mark Tomlinson
2015-06-30  9:07   ` Heiko Schocher denx
2015-06-29  5:02 ` [U-Boot] [PATCH 4/8] JFFS2: Improve speed reading flash files Mark Tomlinson
2015-06-30  9:09   ` Heiko Schocher denx
2015-06-29  5:02 ` [U-Boot] [PATCH 5/8] JFFS2: Optimize building lists during scan Mark Tomlinson
2015-06-30  9:13   ` Heiko Schocher invitel
2015-06-29  5:02 ` [U-Boot] [PATCH 6/8] JFFS2: Change scansize to match linux kernel Mark Tomlinson
2015-06-30  9:14   ` Heiko Schocher invitel
2015-06-29  5:02 ` [U-Boot] [PATCH 7/8] JFFS2: Use CLEANMARKER to reduce scanning time Mark Tomlinson
2015-06-30  9:16   ` Heiko Schocher invitel [this message]
2015-06-30  9:16   ` Heiko Schocher denx
2015-06-29  5:02 ` [U-Boot] [PATCH 8/8] JFFS2: Use merge sort when parsing filesystem Mark Tomlinson
2015-06-30  9:26   ` Heiko Schocher denx
2015-06-30 12:11 ` [U-Boot] [PATCH 0/8] JFFS2 fixes and performance improvements 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=55925E6D.40508@invitel.hu \
    --to=heiko.schocher@invitel.hu \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.