Re: [PATCH] btrfs: fix check_shared for fiemap ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





At 06/01/2016 12:23 AM, David Sterba wrote:
On Tue, May 31, 2016 at 03:27:42PM +0800, luke wrote:
+static void ref_root_fini(struct ref_root *ref_tree)
+{
+	struct ref_node *node;
+	struct rb_node *next;
+
+	while ((next = rb_first(&ref_tree->rb_root)) != NULL) {
+		node = rb_entry(next, struct ref_node, rb_node);
+		rb_erase(next, &ref_tree->rb_root);
+		kfree(node);
This could be slow as rb_erase has to do the rb-tree rotations. Can we
do a post-order traversal and just free the nodes?
Excuse me, this seems to be standard way to release the rb-tree. For
example,  "btrfs_free_block_groups" this function is the same way. So
should i refactor this function?
So for first version it's ok to keep it the simple way, but refactoring
to the post-order traversal should help performance. And as there are
more places it would be better to do it separately.


Yes, you're right. I have updated this patch to fix other problems. And, I'll refactor this function with another patch soon.

Thanks,
Lu


--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux