Paul Walmsley <[email protected]> wrote on 2012/01/28 10:51:26:
>
> On Thu, 26 Jan 2012, Joakim Tjernlund wrote:
>
> > .. and you should delay the second allocation to when it is needed. After
> > swapping ptrs, test if
> > tmp_buf is NULL and kmalloc if so.
>
> Hmm. You are thinking of a GFP_ATOMIC allocation? Seems best to avoid
> those?
No, just stick the kmalloc after the unlock:
spin_unlock(&jffs2_compressor_list_lock);
if (!tmp_buf) {
tmp_buf = kmalloc(...);
<error handling if still NULL>
}
*datalen = orig_slen;
*cdatalen = orig_dlen;
compr_ret = this->compress(data_in, tmp_buf, datalen,
cdatalen, NULL);
That way you also skip a second kmalloc if the list only holds one compressor
and
you don't need GFP_ATOMIC
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html