Ticket #5707: bfs_DeviceBlockSize.patch

File bfs_DeviceBlockSize.patch, 2.0 KB (added by jvff, 14 years ago)
  • src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp

     
    8787    size_t size, struct file_io_vec* vecs, size_t* _count)
    8888{
    8989    Inode* inode = (Inode*)cookie;
    90     return file_map_translate(inode->Map(), offset, size, vecs, _count, 512);
    91         // TODO: Use the actual block size of the underlying device for the
    92         // alignment!
     90    uint32 deviceBlockSize = inode->GetVolume()->BlockSize();
     91
     92    return file_map_translate(inode->Map(), offset, size, vecs, _count,
     93        deviceBlockSize);
    9394}
    9495
    9596
  • src/add-ons/kernel/file_systems/bfs/Volume.cpp

     
    344344
    345345    // check if the device size is large enough to hold the file system
    346346    off_t diskSize;
    347     if (opener.GetSize(&diskSize) != B_OK)
     347    if (opener.GetSize(&diskSize, &fDeviceBlockSize) != B_OK)
    348348        RETURN_ERROR(B_ERROR);
    349349    if (diskSize < (NumBlocks() << BlockShift()))
    350350        RETURN_ERROR(B_BAD_VALUE);
  • src/add-ons/kernel/file_systems/bfs/Volume.h

     
    6565            off_t           FreeBlocks() const
    6666                                { return NumBlocks() - UsedBlocks(); }
    6767
     68            uint32          DeviceBlockSize() const { return fDeviceBlockSize; }
    6869            uint32          BlockSize() const { return fBlockSize; }
    6970            uint32          BlockShift() const { return fBlockShift; }
    7071            uint32          InodeSize() const
     
    141142            fs_volume*      fVolume;
    142143            int             fDevice;
    143144            disk_super_block fSuperBlock;
    144 
     145           
     146            uint32          fDeviceBlockSize;
    145147            uint32          fBlockSize;
    146148            uint32          fBlockShift;
    147149            uint32          fAllocationGroupShift;