Author: axeld Date: 2010-04-11 14:05:59 +0200 (Sun, 11 Apr 2010) New Revision: 36144 Changeset: http://dev.haiku-os.org/changeset/36144/haiku Ticket: http://dev.haiku-os.org/ticket/5707 Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp Log: * 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! Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp 2010-04-11 11:50:03 UTC (rev 36143) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp 2010-04-11 12:05:59 UTC (rev 36144) @@ -344,7 +344,7 @@ // 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); Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.h 2010-04-11 11:50:03 UTC (rev 36143) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.h 2010-04-11 12:05:59 UTC (rev 36144) @@ -65,6 +65,7 @@ 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 @@ int fDevice; disk_super_block fSuperBlock; + uint32 fDeviceBlockSize; uint32 fBlockSize; uint32 fBlockShift; uint32 fAllocationGroupShift; Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp 2010-04-11 11:50:03 UTC (rev 36143) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp 2010-04-11 12:05:59 UTC (rev 36144) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2009, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx + * Copyright 2001-2010, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx * This file may be used under the terms of the MIT License. */ @@ -87,9 +87,9 @@ 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()); }