ramdisk with a larger than 16 M partition

Discussion in 'Windows Vista Drivers' started by Calin Iaru, Dec 12, 2008.

  1. Calin Iaru

    Calin Iaru Guest

    I use the WDK sample to do some testing on a configuration where the disk is
    a bottleneck. If I install the ramdisk, then the most I get on the partition
    is 16 M which is not enough.

    I would like to know how can the limit be increased to 64 M or 128 M. The
    WDK version is 6001.18002.
     
    Calin Iaru, Dec 12, 2008
    #1
    1. Advertisements

  2. Calin Iaru

    Don Burn Guest

    The limitation is due to the NonPagedPool size. You would need to allocate
    the memory in another way then pin it down to ensure that you could go to
    the bigger size. Of coure the freeing of the memory would have to reflect
    the same approach. Using paged pool and locking it down would probably
    allow going to 32M or more, but beyond that one needs to use some stuff a
    little on the edge.


    --
    Don Burn (MVP, Windows DDK)
    Windows Filesystem and Driver Consulting
    Website: http://www.windrvr.com
    Blog: http://msmvps.com/blogs/WinDrvr
    Remove StopSpam to reply
     
    Don Burn, Dec 12, 2008
    #2
    1. Advertisements

  3. Calin Iaru

    Calin Iaru Guest

    I did lkd and !poolused shows one allocation of 64M. It has to be something
    else.
     
    Calin Iaru, Dec 12, 2008
    #3
  4. Calin Iaru

    Calin Iaru Guest

    Operate the following changes in ramdisk.c:

    if( devExt->DiskRegInfo.DiskSize/devExt->DiskGeometry.BytesPerSector <
    65536 ) {
    bootSector->bsSectors = (USHORT)(devExt->DiskRegInfo.DiskSize /

    devExt->DiskGeometry.BytesPerSector);
    } else {
    bootSector->bsSectors = 0;
    bootSector->bsHugeSectors = devExt->DiskRegInfo.DiskSize /
    devExt->DiskGeometry.BytesPerSector;
    }
    bootSector->bsMedia = (UCHAR)devExt->DiskGeometry.MediaType;
    bootSector->bsSecPerClus = (UCHAR)sectorsPerCluster;

    //
    // Calculate number of sectors required for FAT
    //

    if(bootSector->bsSectors) {
    fatEntries =
    (bootSector->bsSectors - bootSector->bsResSectors -
    bootSector->bsRootDirEnts / DIR_ENTRIES_PER_SECTOR) /
    bootSector->bsSecPerClus + 2;
    } else {
    fatEntries =
    (USHORT)((bootSector->bsHugeSectors - bootSector->bsResSectors -
    bootSector->bsRootDirEnts / DIR_ENTRIES_PER_SECTOR) /
    bootSector->bsSecPerClus + 2);
    }

    The usage of bsHugeSectors is documented in
    http://www.ntfs.com/fat-partition-sector.htm

    For a 64M partition, the number of SectorsPerCluster needs to be increased
    from 2 to 4:
    http://support.microsoft.com/kb/67321/EN-US/

    The sample uses KdPrint inadvertently - adjust %ld to %d where suitable.
     
    Calin Iaru, Dec 18, 2008
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.