Re: [PATCH] imsm: data offset support during first volume creation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/16/19 5:26 AM, Krzysztof Smolinski wrote:
> When creating first volume in IMSM container --data-offset
> parameter can be provided to specify volume data offset (reserve
> space preceding volume start). When no value is provided then 1 MiB
> default value is used.
> 
> Signed-off-by: Krzysztof Smolinski <krzysztof.smolinski@xxxxxxxxx>
> ---
>  mdadm.8.in    | 12 ++++++---
>  mdadm.c       | 28 +++++++++++++--------
>  mdadm.h       |  7 +++---
>  super-intel.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
>  util.c        |  2 +-
>  5 files changed, 101 insertions(+), 28 deletions(-)

A couple of minor nits:

> diff --git a/mdadm.c b/mdadm.c
> index 1fb80860..7fdad606 100644
> --- a/mdadm.c
> +++ b/mdadm.c
> @@ -384,21 +384,27 @@ int main(int argc, char *argv[])
>  		case O(CREATE,ChunkSize):
>  		case O(BUILD,'c'): /* chunk or rounding */
>  		case O(BUILD,ChunkSize): /* chunk or rounding */
> +		{
> +			unsigned long long tmp_chunk;

Please don't do this, it's incredibly ugly. Just declare tmp_chunk
globally in the function if you have to. You're using it again below as
well.

> +		if (sector_size == 4096)
> +			super->create_offset = convert_to_4k_data_offset(data_offset);
> +		else
> +			super->create_offset = data_offset;
> +	} else if (data_offset == INVALID_SECTORS && super->current_vol == 0) {
> +		// set default data offset for first volume
> +		super->create_offset = DEFAULT_VOLUME_DATA_OFFSET / super->sector_size;

Use proper comments please

Cheers,
Jes



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux