Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: [JFFS2] fix race condition in jffs2_lzo_compress() [MTD] [NOR] Fix cfi_send_gen_cmd handling of x16 devices in x8 mode (v4) [JFFS2] Fix lack of locking in thread_should_wake() [JFFS2] Fix build failure with !CONFIG_JFFS2_FS_WRITEBUFFER [MTD] [NAND] OMAP2: remove duplicated #include
This commit is contained in:
@@ -85,15 +85,15 @@ static int jffs2_garbage_collect_thread(void *_c)
|
||||
for (;;) {
|
||||
allow_signal(SIGHUP);
|
||||
again:
|
||||
spin_lock(&c->erase_completion_lock);
|
||||
if (!jffs2_thread_should_wake(c)) {
|
||||
set_current_state (TASK_INTERRUPTIBLE);
|
||||
spin_unlock(&c->erase_completion_lock);
|
||||
D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread sleeping...\n"));
|
||||
/* Yes, there's a race here; we checked jffs2_thread_should_wake()
|
||||
before setting current->state to TASK_INTERRUPTIBLE. But it doesn't
|
||||
matter - We don't care if we miss a wakeup, because the GC thread
|
||||
is only an optimisation anyway. */
|
||||
schedule();
|
||||
}
|
||||
} else
|
||||
spin_unlock(&c->erase_completion_lock);
|
||||
|
||||
|
||||
/* This thread is purely an optimisation. But if it runs when
|
||||
other things could be running, it actually makes things a
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
static void *lzo_mem;
|
||||
static void *lzo_compress_buf;
|
||||
static DEFINE_MUTEX(deflate_mutex);
|
||||
static DEFINE_MUTEX(deflate_mutex); /* for lzo_mem and lzo_compress_buf */
|
||||
|
||||
static void free_workspace(void)
|
||||
{
|
||||
@@ -49,18 +49,21 @@ static int jffs2_lzo_compress(unsigned char *data_in, unsigned char *cpage_out,
|
||||
|
||||
mutex_lock(&deflate_mutex);
|
||||
ret = lzo1x_1_compress(data_in, *sourcelen, lzo_compress_buf, &compress_size, lzo_mem);
|
||||
mutex_unlock(&deflate_mutex);
|
||||
|
||||
if (ret != LZO_E_OK)
|
||||
return -1;
|
||||
goto fail;
|
||||
|
||||
if (compress_size > *dstlen)
|
||||
return -1;
|
||||
goto fail;
|
||||
|
||||
memcpy(cpage_out, lzo_compress_buf, compress_size);
|
||||
*dstlen = compress_size;
|
||||
mutex_unlock(&deflate_mutex);
|
||||
|
||||
*dstlen = compress_size;
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
mutex_unlock(&deflate_mutex);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int jffs2_lzo_decompress(unsigned char *data_in, unsigned char *cpage_out,
|
||||
|
@@ -261,9 +261,11 @@ static int jffs2_find_nextblock(struct jffs2_sb_info *c)
|
||||
|
||||
jffs2_sum_reset_collected(c->summary); /* reset collected summary */
|
||||
|
||||
#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
|
||||
/* adjust write buffer offset, else we get a non contiguous write bug */
|
||||
if (!(c->wbuf_ofs % c->sector_size) && !c->wbuf_len)
|
||||
c->wbuf_ofs = 0xffffffff;
|
||||
#endif
|
||||
|
||||
D1(printk(KERN_DEBUG "jffs2_find_nextblock(): new nextblock = 0x%08x\n", c->nextblock->offset));
|
||||
|
||||
|
Reference in New Issue
Block a user