Grow: replace '1' with 'INVALID_SECTORS' where appropriate.

Here are some '1's which missed the introduction of INVALID_SECTORS
as a useful #define.

Signed-off-by: NeilBrown <neilb@suse.de>
Grow: split out code for setting new_data_offset

This will soon be used for more than just RAID10, so
it deserves independent existence.

Signed-off-by: NeilBrown <neilb@suse.de>
Grow: just pass delta_disks instead of all of 'info'.

That is all we need, so make purpose of code more obvious
by only passing delta_disks.

Signed-off-by: NeilBrown <neilb@suse.de>
comment typo
Grow: set_new_data_offset should report if kernel is too old.

For RAID5, not being able to set new_data_offset because of
old kernel is not a problem.  So make this fatal on for RAID10.

Also remove an unused assignment to 'rv'.

Signed-off-by: NeilBrown <neilb@suse.de>
Change some "fprintf(stderr,"s to pr_err.

They just keep slipping in..

Signed-off-by: NeilBrown <neilb@suse.de>
Change some fprintf(stderrs to cont_err()

Signed-off-by: NeilBrown <neilb@suse.de>
More conversion to pr_err

Signed-off-by: NeilBrown <neilb@suse.de>
pr_err for mdmon.

Signed-off-by: NeilBrown <neilb@suse.de>
Examine/super1: don't report "New Offset" when feature not set.

The "new_offset" field may be non-zero, but if the feature flag is not
set, it should be ignored.

Signed-off-by: NeilBrown <neilb@suse.de>
super1: improve calculation of space_before/space_after

1/ these must allow for bad-block-list
2/ they must match the kernel, which has a 32k buffer after the
   superblock.

Signed-off-by: NeilBrown <neilb@suse.de>
Grow.c remove some pointless casts on 'data_offset'.

'data_offset' is 'unsigned long long' so the cast is pointless.

Signed-off-by: NeilBrown <neilb@suse.de>
Grow.c: split out update_cache_size() function.

Make this a separate function as I might want to call it from another
location.

Signed-off-by: NeilBrown <neilb@suse.de>
Grow.c: split impose_reshape out as a function.

It will be useful soon.
Signed-off-by: NeilBrown <neilb@suse.de>
Grow: have analyse_change zero the reshape structure first.

This is generally safer and means we can remove lots of zero
assignments.

Signed-off-by: NeilBrown <neilb@suse.de>
Grow: introduce min_offset_change to struct reshape.

raid10 currently uses the 'backup_blocks' field to store something
else: a minimum offset change.
This is bad practice, we will shortly need to have both for RAID5/6,
so make a separate field.

Signed-off-by: NeilBrown <neilb@suse.de>
Grow: use new_data_offset instead of backups for raid4/5/6 reshape.

If we can modify the data_offset, we can avoid doing any backups at all.
If we can't fall back on old approach - but not if --data-offset
 was requested.

Signed-off-by: NeilBrown <neilb@suse.de>
Grow: allow metadata to indicate that changing data_offset not supported.

If space_after and space_before are zero (the default) then assume that
metadata doesn't support changing data_offset.

Signed-off-by: NeilBrown <neilb@suse.de>
Grow: allow --data-offset to be specified for raid4/5/6

Previously it was rejected for non-RAID10.

Signed-off-by: NeilBrown <neilb@suse.de>
Grow: handle E2BIG from new_offset changes more gracefully.

If new_offset change is too big, just do the reshape the old way.

Signed-off-by: NeilBrown <neilb@suse.de>