* Applied patch by Janito that solves a TODO and utilizes the actual device

block size to align the file map.
* This closes ticket #5707, thanks!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36144 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2010-04-11 12:05:59 +00:00
parent ef38ad6821
commit 1a1a8f33d1
3 changed files with 7 additions and 5 deletions
@@ -344,7 +344,7 @@ Volume::Mount(const char* deviceName, uint32 flags)
// check if the device size is large enough to hold the file system
off_t diskSize;
if (opener.GetSize(&diskSize) != B_OK)
if (opener.GetSize(&diskSize, &fDeviceBlockSize) != B_OK)
RETURN_ERROR(B_ERROR);
if (diskSize < (NumBlocks() << BlockShift()))
RETURN_ERROR(B_BAD_VALUE);
@@ -65,6 +65,7 @@ public:
off_t FreeBlocks() const
{ return NumBlocks() - UsedBlocks(); }
uint32 DeviceBlockSize() const { return fDeviceBlockSize; }
uint32 BlockSize() const { return fBlockSize; }
uint32 BlockShift() const { return fBlockShift; }
uint32 InodeSize() const
@@ -142,6 +143,7 @@ protected:
int fDevice;
disk_super_block fSuperBlock;
uint32 fDeviceBlockSize;
uint32 fBlockSize;
uint32 fBlockShift;
uint32 fAllocationGroupShift;
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2009, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2001-2010, Axel Dörfler, axeld@pinc-software.de.
* This file may be used under the terms of the MIT License.
*/
@@ -87,9 +87,9 @@ iterative_io_get_vecs_hook(void* cookie, io_request* request, off_t offset,
size_t size, struct file_io_vec* vecs, size_t* _count)
{
Inode* inode = (Inode*)cookie;
return file_map_translate(inode->Map(), offset, size, vecs, _count, 512);
// TODO: Use the actual block size of the underlying device for the
// alignment!
return file_map_translate(inode->Map(), offset, size, vecs, _count,
inode->GetVolume()->BlockSize());
}