Re: [PATCH 2/4] btrfs-progs: remove unnecessary judgment for fd in scrub

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

 



Hi Gui,

(2014/07/17 11:40), Gui Hecheng wrote:
> The scrub_read_file function is always on a branch,
> which has (fd >= 0), so there is not need to judgment
> the pasted in arg.
> 
> Signed-off-by: Gui Hecheng <guihc.fnst@xxxxxxxxxxxxxx>
> ---
>   cmds-scrub.c | 3 ---
>   1 file changed, 3 deletions(-)
> 
> diff --git a/cmds-scrub.c b/cmds-scrub.c
> index f9e2b40..a604b25 100644
> --- a/cmds-scrub.c
> +++ b/cmds-scrub.c
> @@ -474,9 +474,6 @@ static struct scrub_file_record **scrub_read_file(int fd, int report_errors)
>   	char empty_uuid[BTRFS_FSID_SIZE] = {0};
>   	struct scrub_file_record **p = NULL;
>   
> -	if (fd < 0)
> -		return ERR_PTR(-EINVAL);
> -

It's correct. In addition, adding "'fd' should point to a opened file"
like comment is better for potential users of this function.

Thanks,
Satoru


>   again:
>   	old_avail = avail - i;
>   	BUG_ON(old_avail < 0);
> 

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