[PATCH] jbd: avoid kfree(NULL)
There are a couple of places where JBD has to check to see whether an unneeded memory allocation was performed. Usually it _was_ needed, so we end up calling kfree(NULL). We can micro-optimise that by checking the pointer before calling kfree(). Thanks to Steven Rostedt <rostedt@goodmis.org> for identifying this. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Родитель
22722051fb
Коммит
304c4c841a
|
@ -227,6 +227,7 @@ repeat_locked:
|
|||
spin_unlock(&transaction->t_handle_lock);
|
||||
spin_unlock(&journal->j_state_lock);
|
||||
out:
|
||||
if (unlikely(new_transaction)) /* It's usually NULL */
|
||||
kfree(new_transaction);
|
||||
return ret;
|
||||
}
|
||||
|
@ -724,6 +725,7 @@ done:
|
|||
journal_cancel_revoke(handle, jh);
|
||||
|
||||
out:
|
||||
if (unlikely(frozen_buffer)) /* It's usually NULL */
|
||||
kfree(frozen_buffer);
|
||||
|
||||
JBUFFER_TRACE(jh, "exit");
|
||||
|
@ -903,6 +905,7 @@ repeat:
|
|||
jbd_unlock_bh_state(bh);
|
||||
out:
|
||||
journal_put_journal_head(jh);
|
||||
if (unlikely(committed_data))
|
||||
kfree(committed_data);
|
||||
return err;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче