[U-Boot] [PATCH 3/6] jffs2: rewrite jffs2 scanning code based on Linux one

Ilya Yanok yanok at emcraft.com
Thu Nov 20 15:31:51 CET 2008


Hello Jean-Christophe,

Jean-Christophe PLAGNIOL-VILLARD wrote:
>>  
>>  	/* 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
>   

Why? it's memory buffer actually.

Regards, Ilya.



More information about the U-Boot mailing list