Re: dynamic partitions

Jan Kratochvil (short@k332.feld.cvut.cz)
Sun, 18 May 1997 10:44:33 +0200 (MET DST)


Hi!

> I have a crazy idea to implement a pair of ioctl()s to allow the
> setting of the start and size of a device partition.
>
> Looking through the block drivers, it seems easy enough to add code
> like (for ide.c):
>
> case BLKSETSIZE: /* Set device size */
> if (!suser()) return -EACCES;
> drive->part[MINOR(inode->i_rdev)&PARTN_MASK].nr_sects = arg;
> return 0 ;
> case BLKSETSTART: /* Set device start */
> if (!suser()) return -EACCES;
> drive->part[MINOR(inode->i_rdev)&PARTN_MASK].start_sect = arg;
> return 0 ;
>
> (and appropriate definitions in fs.h for BLKSETSIZE/START).
>
> It seems that such changes would need to be made to every block
> driver. Is there a better place to add partition changing code?

For now the `loop' device already supports "offset" option but "size"
is determined in drivers/block/loop.c/figure_loop_size() automagically.
When the size option will be added to `loop', you can losetup /dev/hda
to /dev/loop0 appropriately. The only problem remains the ugly
drivers/block/loop.c/transfer_none()/memcpy().

Jan Kratochvil

P.S.: When we're at another large memory copying, will someone the write page
flipping support so that during CD burn the data will no longer be copied
6 times? Count with me:

[disk DMA->kernel buffer]
1. buffer -> userland mkisofs
2. mkisofs -> kernel pipe buffer
3. kernel pipe buffer -> userland buffering tool
[>10MB buffer to deal with starvations during compiles]
4. userland buffering tool -> kernel pipe buffer
5. kernel pipe buffer -> userland cdrecord buffer
6. userland cdrecord buffer -> scsi layer buffer
[scsi layer->scsi controller DMA]

Maybe I've forgot about some additional kernel SCSI copying, though...