[Ocfs2-tools-devel] [PATCH 2/5] tunefs.ocfs2: Correct the way of calculating try_clusters

Goldwyn Rodrigues rgoldwyn at suse.de
Fri Apr 24 07:37:51 PDT 2015


Hi Piaojun,

On 04/02/2015 07:27 AM, piaojun wrote:
> In check_new_size(), ocfs2_clusters_in_bytes() should be replaced with
> ocfs2_bytes_to_clusters() in case try_clusters is larger than
> device_clusters.
>
> Signed-off-by: Jun Piao <piaojun at huawei.com>
> Reviewed-by: Alex Chen <alex.chen at huawei.com>
>
> ---
>   tunefs.ocfs2/op_resize_volume.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tunefs.ocfs2/op_resize_volume.c b/tunefs.ocfs2/op_resize_volume.c
> index 076bda0..96eef66 100644
> --- a/tunefs.ocfs2/op_resize_volume.c
> +++ b/tunefs.ocfs2/op_resize_volume.c
> @@ -506,7 +506,7 @@ static errcode_t check_new_size(ocfs2_filesys *fs, uint64_t new_size,
>   	errcode_t ret;
>   	uint64_t max_bytes = ocfs2_clusters_to_bytes(fs, UINT32_MAX);
>   	uint64_t device_bytes;
> -	uint32_t try_clusters = ocfs2_clusters_in_bytes(fs, new_size);
> +	uint32_t try_clusters = ocfs2_bytes_to_clusters(fs, new_size);

Both these functions are the same. See their respective definitions in 
ocfs2.h

However, ocfs2.h needs to be cleaned to be closer to the one with the 
one in linux/fs/ocfs2.h. In the kernel's ocfs2.h, all _in_ functions 
have been removed.

>   	uint64_t try_blocks;
>   	uint64_t device_blocks;
>   	uint64_t device_clusters;  /* 64bits because devices can be larger
>

-- 
Goldwyn



More information about the Ocfs2-tools-devel mailing list