[U-Boot] [PATCH 6/7] JFFS2: scanning performance improvement

Detlev Zundel dzu at denx.de
Mon May 2 14:44:12 CEST 2011


Hi Baidu,

> Hi,Detlev
>
>>> +                             }
>>> +
>>
>> This has style-problems.  Actually all of your patches have style
>> problems.  Checking them as one single patch gives:
>>
>> total: 32 errors, 22 warnings, 369 lines checked
>>
>> Please rework the whole series.
>
> I do not know why my patch has style-error. I use Unicode(UTF-8).
> What character do you use?

This has nothing to do with character encoding.  You should run
checkpatch.pl[1] on your changes as stated on our wiki page[2].  When
you do this, you will see this:

  ERROR: trailing whitespace
  #127: FILE: fs/jffs2/jffs2_1pass.c:964:
  +^I^I^I$
  
  ERROR: trailing whitespace
  #129: FILE: fs/jffs2/jffs2_1pass.c:966:
  +^I^I^Iwe compare the DIRENT's ino with the latest DIRENT's ino $
  
  WARNING: line over 80 characters
  #129: FILE: fs/jffs2/jffs2_1pass.c:966:
  +			we compare the DIRENT's ino with the latest DIRENT's ino 
  
  ERROR: trailing whitespace
  #130: FILE: fs/jffs2/jffs2_1pass.c:967:
  +^I^I^Ito determine whether this DIRENT is the latest one. $
  
  ERROR: trailing whitespace
  #133: FILE: fs/jffs2/jffs2_1pass.c:970:
  +^I^I^Iif(jDir->ino != jffs2_1pass_find_inode(pL, jDir->name, pino))  $
  
  WARNING: line over 80 characters
  #133: FILE: fs/jffs2/jffs2_1pass.c:970:
  +			if(jDir->ino != jffs2_1pass_find_inode(pL, jDir->name, pino))  
  
  ERROR: space required before the open parenthesis '('
  #133: FILE: fs/jffs2/jffs2_1pass.c:970:
  +			if(jDir->ino != jffs2_1pass_find_inode(pL, jDir->name, pino))  
  
  ERROR: trailing whitespace
  #168: FILE: fs/jffs2/jffs2_nand_1pass.c:374:
  +^I^Iif ((pino == jDir->pino) && $
  
  ERROR: trailing whitespace
  #169: FILE: fs/jffs2/jffs2_nand_1pass.c:375:
  +^I^I    (len == jDir->nsize) && $
  
  ERROR: trailing whitespace
  #179: FILE: fs/jffs2/jffs2_nand_1pass.c:488:
  +^I^I^Iwe compare the DIRENT's ino with the latest DIRENT's ino $
  
  WARNING: line over 80 characters
  #179: FILE: fs/jffs2/jffs2_nand_1pass.c:488:
  +			we compare the DIRENT's ino with the latest DIRENT's ino 
  
  ERROR: trailing whitespace
  #180: FILE: fs/jffs2/jffs2_nand_1pass.c:489:
  +^I^I^Ito determine whether this DIRENT is the latest one. $
  
  ERROR: trailing whitespace
  #183: FILE: fs/jffs2/jffs2_nand_1pass.c:492:
  +^I^I^Iif(jDir.ino != jffs2_1pass_find_inode(pL, jDir->name, pino))  $
  
  WARNING: line over 80 characters
  #183: FILE: fs/jffs2/jffs2_nand_1pass.c:492:
  +			if(jDir.ino != jffs2_1pass_find_inode(pL, jDir->name, pino))  
  
  ERROR: space required before the open parenthesis '('
  #183: FILE: fs/jffs2/jffs2_nand_1pass.c:492:
  +			if(jDir.ino != jffs2_1pass_find_inode(pL, jDir->name, pino))  
  
  ERROR: trailing whitespace
  #185: FILE: fs/jffs2/jffs2_nand_1pass.c:494:
  +^I^I^I$
  
  ERROR: trailing whitespace
  #309: FILE: fs/jffs2/jffs2_1pass.c:680:
  +^I^I$
  
  ERROR: space required before the open parenthesis '('
  #311: FILE: fs/jffs2/jffs2_1pass.c:682:
  +		if(!pL->readbuf) {
  
  WARNING: line over 80 characters
  #457: FILE: fs/jffs2/jffs2_1pass.c:1646:
  +					buf_len = min_t(uint32_t, buf_size, sector_ofs
  
  ERROR: trailing whitespace
  #458: FILE: fs/jffs2/jffs2_1pass.c:1647:
  +^I^I^I^I^I^I+ part->sector_size - ofs);^I^I$
  
  WARNING: line over 80 characters
  #458: FILE: fs/jffs2/jffs2_1pass.c:1647:
  +						+ part->sector_size - ofs);		
  
  ERROR: trailing whitespace
  #471: FILE: fs/jffs2/jffs2_1pass.c:1664:
  +^I^I^I^Iif (buf_ofs + buf_len < ofs + $
  
  ERROR: trailing whitespace
  #472: FILE: fs/jffs2/jffs2_1pass.c:1665:
  +^I^I^I^I^Isizeof(struct jffs2_raw_dirent) + $
  
  WARNING: line over 80 characters
  #473: FILE: fs/jffs2/jffs2_1pass.c:1666:
  +					((struct jffs2_raw_dirent *)node)->nsize) {
  
  WARNING: line over 80 characters
  #474: FILE: fs/jffs2/jffs2_1pass.c:1667:
  +					buf_len = min_t(uint32_t, buf_size, sector_ofs
  
  ERROR: trailing whitespace
  #475: FILE: fs/jffs2/jffs2_1pass.c:1668:
  +^I^I^I^I^I^I+ part->sector_size - ofs);^I$
  
  ERROR: space required before the open parenthesis '('
  #575: FILE: fs/jffs2/jffs2_1pass.c:665:
  +		if(pL->readbuf)
  
  ERROR: space prohibited after that '!' (ctx:BxW)
  #585: FILE: fs/jffs2/jffs2_1pass.c:1474:
  +	if(! jffs_init_1pass_list(part))
   	   ^
  
  ERROR: space required before the open parenthesis '('
  #585: FILE: fs/jffs2/jffs2_1pass.c:1474:
  +	if(! jffs_init_1pass_list(part))
  
  ERROR: trailing whitespace
  #587: FILE: fs/jffs2/jffs2_1pass.c:1476:
  +^I$
  
  ERROR: trailing whitespace
  #594: FILE: fs/jffs2/jffs2_1pass.c:1483:
  +^I$
  
  ERROR: space prohibited after that '!' (ctx:BxW)
  #615: FILE: fs/jffs2/jffs2_nand_1pass.c:810:
  +	if(! jffs_init_1pass_list(part))
   	   ^
  
  ERROR: space required before the open parenthesis '('
  #615: FILE: fs/jffs2/jffs2_nand_1pass.c:810:
  +	if(! jffs_init_1pass_list(part))
  
  ERROR: trailing whitespace
  #617: FILE: fs/jffs2/jffs2_nand_1pass.c:812:
  +^I$
  
  ERROR: patch seems to be corrupt (line wrapped?)
  #716: FILE: fs/jffs2/jffs2_1pass.c:800:
  inode, char *dest)
  
  WARNING: line over 80 characters
  #721: FILE: fs/jffs2/jffs2_1pass.c:804:
  +					putLabeledWord("UNKNOWN COMPRESSION METHOD =3D ", jNode->compr);
  
  WARNING: line over 80 characters
  #739: FILE: fs/jffs2/jffs2_1pass.c:1560:
  +		/* Scan only DEFAULT_EMPTY_SCAN_SIZE of 0xFF before declaring it's =
  
  WARNING: line over 80 characters
  #747: FILE: fs/jffs2/jffs2_1pass.c:1565:
  +			printf("Block at 0x%08x is empty (erased)\n", sector_ofs);
  
  WARNING: line over 80 characters
  #751: FILE: fs/jffs2/jffs2_1pass.c:1568:
  +		/* Now ofs is a complete physical flash offset as it always was... */
  
  WARNING: line over 80 characters
  #765: FILE: fs/jffs2/jffs2_nand_1pass.c:354:
  +				putLabeledWord("UNKNOWN COMPRESSION METHOD =3D ", inode->compr);
  
  WARNING: line over 80 characters
  #783: FILE: fs/jffs2/jffs2_nand_1pass.c:829:
  +		if (jffs2_fill_scan_buf(nand, buf, offset, DEFAULT_EMPTY_SCAN_SIZE))
  
  WARNING: line over 80 characters
  #790: FILE: fs/jffs2/jffs2_nand_1pass.c:832:
  +		/* Scan only DEFAULT_EMPTY_SCAN_SIZE of 0xFF before declaring it's =
  
  WARNING: line over 80 characters
  #792: FILE: fs/jffs2/jffs2_nand_1pass.c:833:
  +		while (ofs < DEFAULT_EMPTY_SCAN_SIZE && *(uint32_t *)(&buf[ofs]) =
  
  WARNING: line over 80 characters
  #801: FILE: fs/jffs2/jffs2_nand_1pass.c:837:
  +		if (jffs2_fill_scan_buf(nand, buf + DEFAULT_EMPTY_SCAN_SIZE, offset + =
  
  WARNING: line over 80 characters
  #936: FILE: fs/jffs2/jffs2_1pass.c:1616:
  +				/* If we're only checking the beginning of a block with a cleanmarker,
  
  ERROR: trailing whitespace
  #938: FILE: fs/jffs2/jffs2_1pass.c:1618:
  +^I^I^I^Iif((buf_ofs == sector_ofs) && $
  
  WARNING: suspect code indent for conditional statements (32, 36)
  #938: FILE: fs/jffs2/jffs2_1pass.c:1618:
  +				if((buf_ofs == sector_ofs) && 
  [...]
  +				    printf("%d bytes at start of block seems clean... assuming all clean\n",
  
  ERROR: space required before the open parenthesis '('
  #938: FILE: fs/jffs2/jffs2_1pass.c:1618:
  +				if((buf_ofs == sector_ofs) && 
  
  ERROR: trailing whitespace
  #939: FILE: fs/jffs2/jffs2_1pass.c:1619:
  +^I^I^I^I    (empty_start == sector_ofs +sizeof(struct jffs2_unknown_node))) {  $
  
  WARNING: line over 80 characters
  #939: FILE: fs/jffs2/jffs2_1pass.c:1619:
  +				    (empty_start == sector_ofs +sizeof(struct jffs2_unknown_node))) {  
  
  ERROR: need consistent spacing around '+' (ctx:WxV)
  #939: FILE: fs/jffs2/jffs2_1pass.c:1619:
  +				    (empty_start == sector_ofs +sizeof(struct jffs2_unknown_node))) {  
   				                               ^
  
  WARNING: line over 80 characters
  #940: FILE: fs/jffs2/jffs2_1pass.c:1620:
  +				    printf("%d bytes at start of block seems clean... assuming all clean\n",
  
  WARNING: line over 80 characters
  #941: FILE: fs/jffs2/jffs2_1pass.c:1621:
  +						EMPTY_SCAN_SIZE(part->sector_size));
  
  ERROR: trailing whitespace
  #958: FILE: fs/jffs2/jffs2_1pass.c:1644:
  +^I^I^I$
  
  total: 32 errors, 22 warnings, 369 lines checked
  
  NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or
        scripts/cleanfile
  
  /home/dzu/transfer/am has style problems, please review.  If any of these errors
  are false positives report them to the maintainer, see
  CHECKPATCH in MAINTAINERS.

Cheers
  Detlev
  
[1] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob_plain;f=scripts/checkpatch.pl
[2] http://www.denx.de/wiki/U-Boot/CodingStyle

-- 
"It's amazing I won. I was running against peace, prosperity, and
incumbency."
  --  George H.W. Bush, 06/14/2001, talking to Swedish prime
      minister Goran Perrson, unaware that a live tv camera was still on
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de


More information about the U-Boot mailing list