Re: [PATCH 1/3] md: align superblock writes to physical blocks

From: Christoph Hellwig
Date: Fri Oct 23 2020 - 04:29:31 EST


> + /* Respect physical block size if feasible. */
> + bmask = queue_physical_block_size(rdev->bdev->bd_disk->queue)-1;
> + if (!((rdev->sb_start * 512) & bmask) && (rdev->sb_size & bmask)) {
> + int candidate_size = (rdev->sb_size | bmask) + 1;
> +
> + if (minor_version) {
> + int sectors = candidate_size / 512;
> +
> + if (rdev->data_offset >= sb_start + sectors
> + && rdev->new_data_offset >= sb_start + sectors)

Linux coding style wants operators before the continuing line.

> + rdev->sb_size = candidate_size;
> + } else if (bmask <= 4095)
> + rdev->sb_size = candidate_size;
> + }

I also think this code would benefit from being factored into a helper.