]> git.baikalelectronics.ru Git - kernel.git/commit
gfs2: Add a next-resource-group pointer to resource groups
authorAndrew Price <anprice@redhat.com>
Tue, 12 Dec 2017 17:37:15 +0000 (11:37 -0600)
committerBob Peterson <rpeterso@redhat.com>
Tue, 12 Dec 2017 17:43:08 +0000 (11:43 -0600)
commit65adc27375a85beb57c3869cedb2a410fad9c288
treeb732c3b436391e57b3c55f03108c69532e44d545
parent9aa015932727597f18d952c25b7ecb2e0376f055
gfs2: Add a next-resource-group pointer to resource groups

Add a new rg_skip field to struct gfs2_rgrp, replacing __pad. The
rg_skip field has the following meaning:

- If rg_skip is zero, it is considered unset and not useful.
- If rg_skip is non-zero, its value will be the number of blocks between
  this rgrp's address and the next rgrp's address. This can be used as a
  hint by fsck.gfs2 when rebuilding a bad rindex, for example.

This will provide less dependency on the rindex in future, and allow
tools such as fsck.gfs2 to iterate the resource groups without keeping
the rindex around.

The field is updated in gfs2_rgrp_out() so that existing file systems
will have it set. This means that any resource groups that aren't ever
written will not be updated. The final rgrp is a special case as there
is no next rgrp, so it will always have a rg_skip of 0 (unless the fs is
extended).

Before this patch, gfs2_rgrp_out() zeroes the __pad field explicitly, so
the rg_skip field can get set back to 0 in cases where nodes with and
without this patch are mixed in a cluster. In some cases, the field may
bounce between being set by one node and then zeroed by another which
may harm performance slightly, e.g. when two nodes create many small
files. In testing this situation is rare but it becomes more likely as
the filesystem fills up and there are fewer resource groups to choose
from. The problem goes away when all nodes are running with this patch.
Dipping into the space currently occupied by the rg_reserved field would
have resulted in the same problem as it is also explicitly zeroed, so
unfortunately there is no other way around it.

Signed-off-by: Andrew Price <anprice@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
fs/gfs2/rgrp.c
include/uapi/linux/gfs2_ondisk.h