[PATCH][JFFS2] Reschedule during scan of partly empty eraseblock

Artem Bityutskiy dedekind at infradead.org
Thu May 29 05:46:32 EDT 2008


On Thu, 2008-05-29 at 11:29 +0200, Nielsen David Marqvar wrote:
> This patch adds rescheduling to the loop that scans an empty area of an
> eraseblock.
> 
> Rationale:
> When scanning the an empty area of an eraseblock no scheduling occurs. But
> this scan may take significantly long to complete depending on the size of 
> the empty space within the eraseblock and the speed of the flash (on my
> system
> it could theoretically be up to 100 ms).
> The patch will add a call to cond_resched() for each 2 KiB scanned (while the
> first check may be done before 2 KiB the code is simple and fast).
> 
> The patch has been tested and running on our systems for a month now.
...
>                                 }
> 
> +                               /* check for resched - searching an
> eraseblock may take several ms */
> +                               if ( (ofs & 0x7ff /* for each 2KiB */) == 0)
> +                                       cond_resched();
> +
>                                 inbuf_ofs+=4;
>                                 ofs += 4;
>                         }

I would rather add cond_resched() to jffs2_fill_scan_buf()
unconditionally. Conditional cond_resched() really looks bad.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)




More information about the linux-mtd mailing list