Skip to content

Commit

Permalink
nfs4: Improve tracing when DEBUG. Always show NFS errors
Browse files Browse the repository at this point in the history
Change-Id: Idd6904258c479dc3d188bf245b1bae0d3849820b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3397
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
  • Loading branch information
kallisti5 committed May 4, 2021
1 parent eb87d69 commit 0319710
Show file tree
Hide file tree
Showing 3 changed files with 226 additions and 97 deletions.
41 changes: 40 additions & 1 deletion src/add-ons/kernel/file_systems/nfs4/FileSystem.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012 Haiku, Inc. All rights reserved.
* Copyright 2012-2020 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
Expand All @@ -19,6 +19,17 @@
#include "RootInode.h"


#define ERROR(x...) dprintf("nfs4: " x)

#ifdef DEBUG
#define TRACE(x...) dprintf("nfs4: " x)
#define CALLED() dprintf("nfs4: called %s", __func__)
#else
#define TRACE(x...)
#define CALLED()
#endif


extern RPC::ServerManager* gRPCServerManager;
extern RPC::ProgramData* CreateNFS4Server(RPC::Server* serv);

Expand Down Expand Up @@ -70,6 +81,8 @@ FileSystem::~FileSystem()
static InodeNames*
GetInodeNames(const char** root, const char* _path)
{
CALLED();

ASSERT(_path != NULL);

int i;
Expand Down Expand Up @@ -132,6 +145,8 @@ status_t
FileSystem::Mount(FileSystem** _fs, RPC::Server* serv, const char* serverName,
const char* fsPath, dev_t id, const MountConfiguration& configuration)
{
CALLED();

ASSERT(_fs != NULL);
ASSERT(serv != NULL);
ASSERT(fsPath != NULL);
Expand Down Expand Up @@ -255,6 +270,8 @@ FileSystem::Mount(FileSystem** _fs, RPC::Server* serv, const char* serverName,
status_t
FileSystem::GetInode(ino_t id, Inode** _inode)
{
CALLED();

ASSERT(_inode != NULL);

FileInfo fi;
Expand All @@ -277,6 +294,8 @@ FileSystem::GetInode(ino_t id, Inode** _inode)
status_t
FileSystem::Migrate(const RPC::Server* serv)
{
CALLED();

ASSERT(serv != NULL);

MutexLocker _(fOpenLock);
Expand Down Expand Up @@ -344,6 +363,8 @@ FileSystem::Migrate(const RPC::Server* serv)
DoublyLinkedList<OpenState>&
FileSystem::OpenFilesLock()
{
CALLED();

mutex_lock(&fOpenLock);
return fOpenFiles;
}
Expand All @@ -352,13 +373,17 @@ FileSystem::OpenFilesLock()
void
FileSystem::OpenFilesUnlock()
{
CALLED();

mutex_unlock(&fOpenLock);
}


void
FileSystem::AddOpenFile(OpenState* state)
{
CALLED();

ASSERT(state != NULL);

MutexLocker _(fOpenLock);
Expand All @@ -372,6 +397,8 @@ FileSystem::AddOpenFile(OpenState* state)
void
FileSystem::RemoveOpenFile(OpenState* state)
{
CALLED();

ASSERT(state != NULL);

MutexLocker _(fOpenLock);
Expand All @@ -385,6 +412,8 @@ FileSystem::RemoveOpenFile(OpenState* state)
DoublyLinkedList<Delegation>&
FileSystem::DelegationsLock()
{
CALLED();

mutex_lock(&fDelegationLock);
return fDelegationList;
}
Expand All @@ -393,13 +422,17 @@ FileSystem::DelegationsLock()
void
FileSystem::DelegationsUnlock()
{
CALLED();

mutex_unlock(&fDelegationLock);
}


void
FileSystem::AddDelegation(Delegation* delegation)
{
CALLED();

ASSERT(delegation != NULL);

MutexLocker _(fDelegationLock);
Expand All @@ -414,6 +447,8 @@ FileSystem::AddDelegation(Delegation* delegation)
void
FileSystem::RemoveDelegation(Delegation* delegation)
{
CALLED();

ASSERT(delegation != NULL);

MutexLocker _(fDelegationLock);
Expand All @@ -426,6 +461,8 @@ FileSystem::RemoveDelegation(Delegation* delegation)
Delegation*
FileSystem::GetDelegation(const FileHandle& handle)
{
CALLED();

MutexLocker _(fDelegationLock);

AVLTreeMap<FileHandle, Delegation*>::Iterator it;
Expand All @@ -440,6 +477,8 @@ FileSystem::GetDelegation(const FileHandle& handle)
status_t
FileSystem::_ParsePath(RequestBuilder& req, uint32& count, const char* _path)
{
CALLED();

ASSERT(_path != NULL);

char* path = strdup(_path);
Expand Down

0 comments on commit 0319710

Please sign in to comment.