nfs4: Do not repeat OPENATTR requests if not supported

This commit is contained in:
Pawel Dziepak
2012-08-15 01:22:28 +02:00
parent 6713e36b1d
commit a5ae9b4752
3 changed files with 25 additions and 0 deletions
@@ -27,6 +27,7 @@ FileSystem::FileSystem()
fPrev(NULL), fPrev(NULL),
fOpenCount(0), fOpenCount(0),
fOpenOwnerSequence(0), fOpenOwnerSequence(0),
fNamedAttrs(true),
fPath(NULL), fPath(NULL),
fRoot(NULL), fRoot(NULL),
fId(1) fId(1)
@@ -62,6 +62,9 @@ public:
inline uint32 OpenOwnerSequenceLock(); inline uint32 OpenOwnerSequenceLock();
inline void OpenOwnerSequenceUnlock(uint32 sequence); inline void OpenOwnerSequenceUnlock(uint32 sequence);
inline bool NamedAttrs();
inline void SetNamedAttrs(bool attrs);
FileSystem* fNext; FileSystem* fNext;
FileSystem* fPrev; FileSystem* fPrev;
private: private:
@@ -83,6 +86,7 @@ private:
uint32 fExpireType; uint32 fExpireType;
uint32 fSupAttrs[2]; uint32 fSupAttrs[2];
bool fNamedAttrs;
FileSystemId fFsId; FileSystemId fFsId;
const char* fPath; const char* fPath;
@@ -205,5 +209,19 @@ FileSystem::OpenOwnerSequenceUnlock(uint32 sequence)
} }
inline bool
FileSystem::NamedAttrs()
{
return fNamedAttrs;
}
inline void
FileSystem::SetNamedAttrs(bool attrs)
{
fNamedAttrs = attrs;
}
#endif // FILESYSTEM_H #endif // FILESYSTEM_H
@@ -62,10 +62,16 @@ Inode::OpenAttrDir(OpenDirCookie* cookie)
status_t status_t
Inode::LoadAttrDirHandle() Inode::LoadAttrDirHandle()
{ {
if (!fFileSystem->NamedAttrs())
return B_UNSUPPORTED;
if (fInfo.fAttrDir.fSize == 0) { if (fInfo.fAttrDir.fSize == 0) {
FileHandle handle; FileHandle handle;
status_t result = NFS4Inode::OpenAttrDir(&handle); status_t result = NFS4Inode::OpenAttrDir(&handle);
if (result == B_UNSUPPORTED)
fFileSystem->SetNamedAttrs(false);
if (result != B_OK) if (result != B_OK)
return result; return result;