diff --git a/src/tests/add-ons/kernel/file_systems/bfs/r5/Inode.cpp b/src/tests/add-ons/kernel/file_systems/bfs/r5/Inode.cpp index ebcc8c2b36..6ff9221a3d 100644 --- a/src/tests/add-ons/kernel/file_systems/bfs/r5/Inode.cpp +++ b/src/tests/add-ons/kernel/file_systems/bfs/r5/Inode.cpp @@ -1,7 +1,7 @@ /* Inode - inode access functions ** -** Initial version by Axel Dörfler, axeld@pinc-software.de -** This file may be used under the terms of the Haiku License. +** Copyright 2001-2005, Axel Dörfler, axeld@pinc-software.de +** This file may be used under the terms of the MIT License. */ @@ -1227,8 +1227,13 @@ Inode::GrowStream(Transaction *transaction, off_t size) // blocks we need to allocate may be different from the one we request // from the block allocator - // should we preallocate some blocks (currently, always 64k)? - if (blocksRequested < (65536 >> fVolume->BlockShift()) && fVolume->FreeBlocks() > 128) + // Should we preallocate some blocks (currently, always 64k)? + // Attributes, attribute directories, and long symlinks usually won't get that big, + // and should stay close to the inode - preallocating could be counterproductive. + // Also, if free disk space is tight, we probably don't want to do this as well. + if (!IsAttribute() && !IsAttributeDirectory() && !IsSymLink() + && blocksRequested < (65536 >> fVolume->BlockShift()) + && fVolume->FreeBlocks() > 128) blocksRequested = 65536 >> fVolume->BlockShift(); while (blocksNeeded > 0) { diff --git a/src/tests/add-ons/kernel/file_systems/bfs/r5/Inode.h b/src/tests/add-ons/kernel/file_systems/bfs/r5/Inode.h index c1d4be40ca..c6d9b727ae 100644 --- a/src/tests/add-ons/kernel/file_systems/bfs/r5/Inode.h +++ b/src/tests/add-ons/kernel/file_systems/bfs/r5/Inode.h @@ -2,8 +2,8 @@ #define INODE_H /* Inode - inode access functions ** -** Copyright 2001-2004, Axel Dörfler, axeld@pinc-software.de -** This file may be used under the terms of the OpenBeOS License. +** Copyright 2001-2005, Axel Dörfler, axeld@pinc-software.de +** This file may be used under the terms of the MIT License. */ @@ -105,6 +105,7 @@ class Inode : public CachedBlock { bool IsIndex() const { return (Mode() & (S_INDEX_DIR | 0777)) == S_INDEX_DIR; } // that's a stupid check, but AFAIK the only possible method... + bool IsAttributeDirectory() const { return (Mode() & S_ATTR_DIR) != 0; } bool IsAttribute() const { return Mode() & S_ATTR; } bool IsFile() const { return Mode() & S_IFREG; } bool IsRegularNode() const { return (Mode() & (S_ATTR_DIR | S_INDEX_DIR | S_ATTR)) == 0; }