VFS FIFO: Enlarge FIFO buffer sizes

* Increase FIFO buffer capacity from 32 to 64 KiB and the FIFO atomic
  write size ({BUF_SIZE}) from 512 bytes to 4 KiB (both like Linux).
* Fix *pathconf(..., _PC_PIPE_BUF). It was returning 4 KiB although the
  implemented atomic write size was 512 bytes only. Now both *pathconf()
  and the FIFO implementation refer to the same constant.
This commit is contained in:
Ingo Weinhold
2013-11-25 12:45:37 +01:00
parent 334ae3c73b
commit fb52b1f8b4
3 changed files with 25 additions and 11 deletions
+4 -8
View File
@@ -30,6 +30,7 @@
#include <util/AutoLock.h>
#include <util/ring_buffer.h>
#include <vfs.h>
#include <vfs_defs.h>
#include <vm/vm.h>
@@ -42,11 +43,6 @@
#define PIPEFS_HASH_SIZE 16
#define PIPEFS_MAX_BUFFER_SIZE 32768
// TODO: PIPE_BUF is supposed to be defined somewhere else.
#define PIPE_BUF _POSIX_PIPE_BUF
namespace fifo {
@@ -252,7 +248,7 @@ RingBuffer::CreateBuffer()
if (fBuffer != NULL)
return B_OK;
fBuffer = create_ring_buffer(PIPEFS_MAX_BUFFER_SIZE);
fBuffer = create_ring_buffer(VFS_FIFO_BUFFER_CAPACITY);
return fBuffer != NULL ? B_OK : B_NO_MEMORY;
}
@@ -376,10 +372,10 @@ Inode::WriteDataToBuffer(const void* _data, size_t* _length, bool nonBlocking)
TRACE("Inode %p::WriteDataToBuffer(data = %p, bytes = %zu)\n", this, data,
dataSize);
// According to the standard, request up to PIPE_BUF bytes shall not be
// A request up to VFS_FIFO_ATOMIC_WRITE_SIZE bytes shall not be
// interleaved with other writer's data.
size_t minToWrite = 1;
if (dataSize <= PIPE_BUF)
if (dataSize <= VFS_FIFO_ATOMIC_WRITE_SIZE)
minToWrite = dataSize;
while (dataSize > 0) {