[Cluster-devel] [PATCH 1/3] gfs2: Add a next-resource-group pointer to resource groups

Andrew Price anprice at redhat.com
Thu Dec 7 14:00:11 UTC 2017


On 07/12/17 13:14, Bob Peterson wrote:
> Hi,
> 
> ----- Original Message -----
> | Add a new rg_skip field to struct gfs2_rgrp, replacing __pad. The
> | -	str->__pad = cpu_to_be32(0);
> | +	if (next != NULL && next->rd_addr > rgd->rd_addr)
> | +		str->rg_skip = cpu_to_be32(next->rd_addr - rgd->rd_addr);
> 
> Without having looked at the original:
> 
> Shouldn't we still initialize it to 0 or put in an else clause?
> I'm concerned that we might end up with an uninitialized random value
> at the last rgrp (which may not be a big concern until gfs2_grow or
> fsck time).

Hmm I think we're safe here because mkfs.gfs2 will have set it to zero 
and the value is propagated from that point. It's not *obviously* safe 
though so I think zeroing it is a good idea. Updated the patch in my 
tree with:


-       if (next != NULL && next->rd_addr > rgd->rd_addr)
+       if (next == NULL)
+               str->rg_skip = 0;
+       else if (next->rd_addr > rgd->rd_addr)
                 str->rg_skip = cpu_to_be32(next->rd_addr - rgd->rd_addr);

Thanks,
Andy




More information about the Cluster-devel mailing list