From 65af8c83274b18217281fcd0435e96dd8b484339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 12 Aug 2005 19:52:26 +0000 Subject: [PATCH] bfs_get_file_map() no longer returns the preallocation area as part of the file data - it checks if the current run goes beyond the file size and cuts it off after the block containing that last few bytes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13943 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp b/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp index 22cc1a4139..7a33714818 100644 --- a/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp @@ -443,6 +443,12 @@ bfs_get_file_map(fs_volume _fs, fs_vnode _node, off_t offset, size_t size, // are we already done? if (size <= vecs[index].length || offset >= inode->Size()) { + if (offset > inode->Size()) { + // make sure the extent ends with the last official file + // block (without taking any preallocations into account) + vecs[index].length = (inode->Size() - fileOffset + volume->BlockSize() - 1) + & ~(volume->BlockSize() - 1); + } *_count = index + 1; return B_OK; }