[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: jffs_erasable_size: offset = 0x0034b000



FYI this is the flash_erasable_size function we use with JFFS. it should
not return an error code under normal operation so indeed it should not
get called with a non-sector aligned offset.

/* check if it's possible to erase the wanted range, and if not, return
 * the range that IS erasable, or a negative error code.
 */

long
flash_erasable_size(void *_part, __u32 offset, __u32 size)
{
        struct flashpartition *part = (struct flashpartition *)_part;
        int ssize;

        if (!part->start) {
                return -EINVAL;
        }

        /* assume that sector size for a partition is constant even
         * if it spans more than one chip (you usually put the same
         * type of chips in a system)
         */

        ssize = part->chip->sectorsize;

        if (offset % ssize) {
                /* The offset is not sector size aligned.  */
                return -1;
        }
        else if (offset > part->size) {
                return -2;
        }
        else if (offset + size > part->size) {
                return -3;
        }

        return (size / ssize) * ssize;
}



On Tue, 4 Jul 2000, David Woodhouse wrote:

> Under what circumstances can jffs_flash_erasable_size() get called with an 
> offset which isn't erase-block-aligned?
> 
> Using the port of JFFS to 2.2, I see this:
> 
> JFFS: Trying to mount device 1f:00.
> jffs_flash_erasable_size() given non-aligned offset 34b000 (erasesize 20000)
> jffs_erasable_size: flash_erasable_size() returned something less than zero (-1.jffs_erasable_size: offset = 0x0034b000
> jffs_flash_erasable_size() given non-aligned offset 34b000 (erasesize 20000)
> jffs_erasable_size: flash_erasable_size() returned something less than zero (-1.jffs_erasable_size: offset = 0x0034b000
> jffs_flash_erasable_size() given non-aligned offset 34b000 (erasesize 20000)
> jffs_erasable_size: flash_erasable_size() returned something less than zero (-1.jffs_erasable_size: offset = 0x0034b000
> 
> It was happy last time I booted it. But when I tried to write to it, after 
> a while, it started doing the same thing. Now it does it on booting.
> 
> 
> --
> dwmw2
> 
>