Re: [OPW kernel] [PATCH v3] btrfs: Add helper function for free_root_pointers()

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

 



On Thu, Oct 31, 2013 at 02:45:20AM +0530, Rashika Kheria wrote:
> The function free_root_pointers() in disk-io.h contains redundant code.
> Therefore, this patch adds a helper function free_root_extent_buffers()
> to free_root_pointers() to eliminate redundancy.
> 
> Reviewed-by: Zach Brown <zab@xxxxxxxxxx>
> Signed-off-by: Rashika Kheria <rashika.kheria@xxxxxxxxx>

Reviewed-by: Josh Triplett <josh@xxxxxxxxxxxxxxxx>

(In general, the Reviewed-by goes after the Signed-off-by.)

One minor nit:

> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -2012,50 +2012,28 @@ static void btrfs_stop_all_workers(struct btrfs_fs_info *fs_info)
>  	btrfs_stop_workers(&fs_info->qgroup_rescan_workers);
>  }
>  
> +static void free_root_extent_buffers(struct btrfs_root *root)
> +{
> +	if (root) {
> +		free_extent_buffer(root->node);
> +		free_extent_buffer(root->commit_root);
> +		root->node = NULL;
> +		root->commit_root = NULL;
> +	}
> +}

I'd tend to write this with an early return if (!root).  In this case it
doesn't matter much, but it's a good habit to get into for larger
functions with deeper indentation.

- Josh Triplett
--
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