Btrfs: Replace the transaction work queue with kthreads

This creates one kthread for commits and one kthread for
deleting old snapshots.  All the work queues are removed.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 5edbcc0..40f0e0c 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1352,6 +1352,8 @@
 						free_extent_buffer(tmp);
 					goto again;
 				} else {
+					if (tmp)
+						free_extent_buffer(tmp);
 					b = read_node_slot(root, b, slot);
 				}
 			}
@@ -3048,7 +3050,8 @@
 		free_extent_buffer(c);
 		path->nodes[level] = next;
 		path->slots[level] = 0;
-		path->locks[level] = 1;
+		if (!path->skip_locking)
+			path->locks[level] = 1;
 		if (!level)
 			break;
 		if (level == 1 && path->locks[1] && path->reada)