tech-kern archive

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

Re: add disk size to "struct disk"?

Le 26/04/12 22:39, Matthias Drochner a écrit :
> I think it would be useful to add the total disk size to the common
> "struct disk". It could be used in wedge discovery to reject
> partitions which don't fit into the usable disk space.
> The reason I'm proposing this is that I just had a case where
> such a check would avoid unexpected behavior: I've attached
> a GPT-formatted disk (used with XenServer before) to a RAID
> controller; since the controller (LSI9260-8i, supported by
> the mfi(4) driver) doesn't support transparent mode it was
> just added as a single-disk RAID0. This makes that the
> controller cuts off some megabytes at the end.
> The kernel did still attach dk devices, even for the last,
> partially unaccessible, partition.
> The gpt(8) tool was even worse - it refused to deal with the
> disk completely, with a less helpful "bogus map" error message,
> so that one can't even truncate or delete the last partition.
> This would be the next thing to fix.
> The first step would be to keep the kernel to attach
> wedges to impossible partition entries. What do you think?

Why push it to struct disk rather than letting backends handle it?

Having total disk size in struct disk means you have to keep it in sync some way or another (ie. callback maybe). Resizing disks can be a common operation, especially with virtualization(tm). Accessing the size member directly looks rather unsafe to me.


Home | Main Index | Thread Index | Old Index