• Boaz Harrosh's avatar
    brd: Fix all partitions BUGs · 937af5ec
    Boaz Harrosh authored
    This patch fixes up brd's partitions scheme, now enjoying all worlds.
    
    The MAIN fix here is that currently, if one fdisks some partitions,
    a BAD bug will make all partitions point to the same start-end sector
    ie: 0 - brd_size And an mkfs of any partition would trash the partition
    table and the other partition.
    
    Another fix is that "mount -U uuid" will not work if show_part was not
    specified, because of the GENHD_FL_SUPPRESS_PARTITION_INFO flag.
    We now always load without it and remove the show_part parameter.
    
    [We remove Dmitry's new module-param part_show it is now always
     show]
    
    So NOW the logic goes like this:
    * max_part - Just says how many minors to reserve between ramX
      devices. In any way, there can be as many partition as requested.
      If minors between devices ends, then dynamic 259-major ids will
      be allocated on the fly.
      The default is now max_part=1, which means all partitions devt(s)
      will be from the dynamic (259) major-range.
      (If persistent partition minors is needed use max_part=X)
      For example with /dev/sdX max_part is hard coded 16.
    
    * Creation of new devices on the fly still/always work:
      mknod /path/devnod b 1 X
      fdisk -l /path/devnod
      Will create a new device if [X / max_part] was not already
      created before. (Just as before)
    
      partitions on the dynamically created device will work as well
      Same logic applies with minors as with the pre-created ones.
    
    TODO: dynamic grow of device size. So each device can have it's
          own size.
    
    CC: Dmitry Monakhov <dmonakhov@openvz.org>
    Tested-by: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
    Signed-off-by: default avatarBoaz Harrosh <boaz@plexistor.com>
    Signed-off-by: default avatarJens Axboe <axboe@fb.com>
    937af5ec
brd.c 14.7 KB