Btrfs: return immediately if tree log mod is not necessary
authorFilipe David Borba Manana <fdmanana@gmail.com>
Thu, 12 Dec 2013 19:19:52 +0000 (19:19 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Mar 2014 04:44:19 +0000 (21:44 -0700)
commit6ad309b513674283c160fb8d2d3dd61524053442
treefba3f0f23e9ccdebb5db4c2101fa81cc47f00747
parent2b7abdff8b5e7d5e1636a7da1c94fcd40282b928
Btrfs: return immediately if tree log mod is not necessary

commit 783577663507411e36e459390ef056556e93ef29 upstream.

In ctree.c:tree_mod_log_set_node_key() we were calling
__tree_mod_log_insert_key() even when the modification doesn't need
to be logged. This would allocate a tree_mod_elem structure, fill it
and pass it to  __tree_mod_log_insert(), which would just acquire
the tree mod log write lock and then free the tree_mod_elem structure
and return (that is, a no-op).

Therefore call tree_mod_log_insert() instead of __tree_mod_log_insert()
which just returns immediately if the modification doesn't need to be
logged (without allocating the structure, fill it, acquire write lock,
free structure).

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/ctree.c