[Ocfs2-tools-devel] [PATCH 08/14] mounted.ocfs2: fix error checking

Joseph Qi joseph.qi at huawei.com
Tue Apr 12 22:57:00 PDT 2016


Hi Junxiao,

On 2016/4/1 11:10, Junxiao Bi wrote:
> ocfs2_get_device_size() return non-zero when failed.
> 
> Signed-off-by: Junxiao Bi <junxiao.bi at oracle.com>
> ---
>  mounted.ocfs2/mounted.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/mounted.ocfs2/mounted.c b/mounted.ocfs2/mounted.c
> index c40f5f5f4996..a1b81723b8f0 100644
> --- a/mounted.ocfs2/mounted.c
> +++ b/mounted.ocfs2/mounted.c
> @@ -366,14 +366,15 @@ static errcode_t build_partition_list(struct list_head *dev_list, char *device)
>  		}
>  
>  		/* skip devices smaller than 1M */
> -		ret = ocfs2_get_device_size(dev->dev_name, 4096, &numblocks);
> -		if (ret < 0) {
How about just replace "ret < 0" to "ret", like other callers?

Thanks,
Joseph

> +
> +		if (ocfs2_get_device_size(dev->dev_name, 4096, &numblocks)) {
>  			verbosef(VL_DEBUG, "Unable to get size of %s\n",
>  				 dev->dev_name);
>  			ocfs2_free(&dev);
>  			continue;
>  		}
>  
> +
>  		if (numblocks <= (1024 * 1024 / 4096)) {
>  			verbosef(VL_DEBUG, "Skipping small device %s\n",
>  				 dev->dev_name);
> 





More information about the Ocfs2-tools-devel mailing list