# Re: \[PATCH 1/6\] md: Make mddev-\>chunk\_size sector-based.

- From: Neil Brown \<hidden\>
- Date: 2009-05-25 23:02:20 
- List: linux-raid
- Page: https://ratatoskr.run/linux-raid/2009/05/6606271
- Thread: https://ratatoskr.run/linux-raid/2009/05/6606271/t.md

```text
On Monday May 25, maan@systemlinux.org wrote:
> This patch changes the type of the chunk_size field from int to
> sector_t and renames it to chunk_sectors with the implied change of
> semantics. Since
> 
> 	is_power_of_2(chunk_size) = is_power_of_2(chunk_sectors << 9)
> 				  = is_power_of_2(chunk_sectors)
> 
> these bits don't need an adjustment for the shift.

Thanks.

I don't really want chunk_sectors to be sector_t - it is a waste on
32bit, and would cause
> +		if (sector_div(temp, mddev->chunk_sectors))

to fail.
I've left it as 'int' and removed all the (int) casts and (sector_t)
casts.   I adjusted the comment too.

I also changed:
	if (mddev->chunk_sectors << 9 < PAGE_SIZE ||
to
	if (mddev->chunk_sectors < (PAGE_SIZE >> 9) ||
primarily because I need the brackets around the shift, even if the
C compiler doesn't.


Thanks,
NeilBrown
```
