tech-kern archive

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

Re: add disk size to "struct disk"?

On Fri, 27 Apr 2012 01:02:46 +0200
Jean-Yves Migeon <> wrote:
> Why push it to struct disk rather than letting backends handle it?

As the code looks now, the functions which scan disklabels
(sys/dev/dkwedge/dkwedge_*.c) get a "struct disk *". To get
the actual size, it would need to open the device and call
an ioctl. As I see it, the only ioctls available for now are
disklabel related, thus limited to 32-bit sector numbers.
So it would need a new ioctl.
Or the disk size would have to be passed down the API
There is also dkwedge_add() which can be called from
userland dkctl(8). For useful checks, it should also get
the total disk size. Atm, it fails to do even simple
overflow and overlap checks, as you can see here:

# dkctl sd0 listwedges
/dev/rsd0d: 3 wedges:
dk5: zzz, 2000 blocks at 500, type: ffs
dk3: xxx, 1000 blocks at 1000, type: ffs
dk4: yyy, 11529215046068469760 blocks at 8070450532247928832, type: ffs

This code certainly needs some design work.

> 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

This would have to deal with open partitions or attached
wedges on disks being shrunk. So perhaps a callback into
the other direction, from the driver into the dk subsystem,
if a disk is being resized?

best regards

Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt

Kennen Sie schon unsere app?

Home | Main Index | Thread Index | Old Index