nfs4: Inode::GetDirSnapshot should not require OpenDirCookie

This commit is contained in:
Pawel Dziepak
2012-08-09 19:24:32 +02:00
parent 8afd81bae2
commit 2314d073af
5 changed files with 13 additions and 9 deletions
@@ -190,7 +190,8 @@ DirectoryCache::Revalidate()
Trash(); Trash();
DirectoryCacheSnapshot* newSnapshot; DirectoryCacheSnapshot* newSnapshot;
status_t result = fInode->GetDirSnapshot(&newSnapshot, NULL, &fChange); status_t result = fInode->GetDirSnapshot(&newSnapshot, NULL, &fChange,
fAttrDir);
if (result != B_OK) { if (result != B_OK) {
oldSnapshot->ReleaseReference(); oldSnapshot->ReleaseReference();
return B_OK; return B_OK;
+1 -1
View File
@@ -94,7 +94,7 @@ public:
status_t GetDirSnapshot(DirectoryCacheSnapshot** status_t GetDirSnapshot(DirectoryCacheSnapshot**
_snapshot, OpenDirCookie* cookie, _snapshot, OpenDirCookie* cookie,
uint64* _change); uint64* _change, bool attribute);
protected: protected:
Inode(); Inode();
@@ -145,7 +145,7 @@ Inode::ReadDirUp(struct dirent* de, uint32 pos, uint32 size)
status_t status_t
Inode::GetDirSnapshot(DirectoryCacheSnapshot** _snapshot, Inode::GetDirSnapshot(DirectoryCacheSnapshot** _snapshot,
OpenDirCookie* cookie, uint64* _change) OpenDirCookie* cookie, uint64* _change, bool attribute)
{ {
DirectoryCacheSnapshot* snapshot = new DirectoryCacheSnapshot; DirectoryCacheSnapshot* snapshot = new DirectoryCacheSnapshot;
if (snapshot == NULL) if (snapshot == NULL)
@@ -161,7 +161,7 @@ Inode::GetDirSnapshot(DirectoryCacheSnapshot** _snapshot,
DirEntry* dirents; DirEntry* dirents;
status_t result = ReadDirOnce(&dirents, &count, cookie, &eof, &change, status_t result = ReadDirOnce(&dirents, &count, cookie, &eof, &change,
&dirCookie, &dirCookieVerf); &dirCookie, &dirCookieVerf, attribute);
if (result != B_OK) { if (result != B_OK) {
delete snapshot; delete snapshot;
return result; return result;
@@ -177,7 +177,7 @@ Inode::GetDirSnapshot(DirectoryCacheSnapshot** _snapshot,
continue; continue;
ino_t id; ino_t id;
if (!cookie->fAttrDir) { if (!attribute) {
if (dirents[i].fAttrCount == 2) if (dirents[i].fAttrCount == 2)
id = FileIdToInoT(dirents[i].fAttrs[1].fData.fValue64); id = FileIdToInoT(dirents[i].fAttrs[1].fData.fValue64);
else else
@@ -228,7 +228,8 @@ Inode::ReadDir(void* _buffer, uint32 size, uint32* _count,
cookie->fSnapshot = cache->GetSnapshot(); cookie->fSnapshot = cache->GetSnapshot();
if (cookie->fSnapshot == NULL) { if (cookie->fSnapshot == NULL) {
uint64 change; uint64 change;
result = GetDirSnapshot(&cookie->fSnapshot, cookie, &change); result = GetDirSnapshot(&cookie->fSnapshot, cookie, &change,
cookie->fAttrDir);
if (result != B_OK) { if (result != B_OK) {
cache->Unlock(); cache->Unlock();
fFileSystem->Revalidator().Unlock(); fFileSystem->Revalidator().Unlock();
@@ -810,14 +810,15 @@ NFS4Inode::RemoveObject(const char* name, FileType type, ChangeInfo* changeInfo,
status_t status_t
NFS4Inode::ReadDirOnce(DirEntry** dirents, uint32* count, OpenDirCookie* cookie, NFS4Inode::ReadDirOnce(DirEntry** dirents, uint32* count, OpenDirCookie* cookie,
bool* eof, uint64* change, uint64* dirCookie, uint64* dirCookieVerf) bool* eof, uint64* change, uint64* dirCookie, uint64* dirCookieVerf,
bool attribute)
{ {
do { do {
RPC::Server* serv = fFileSystem->Server(); RPC::Server* serv = fFileSystem->Server();
Request request(serv); Request request(serv);
RequestBuilder& req = request.Builder(); RequestBuilder& req = request.Builder();
if (cookie->fAttrDir) if (attribute)
req.PutFH(fInfo.fAttrDir); req.PutFH(fInfo.fAttrDir);
else else
req.PutFH(fInfo.fHandle); req.PutFH(fInfo.fHandle);
@@ -66,7 +66,8 @@ protected:
status_t ReadDirOnce(DirEntry** dirents, uint32* count, status_t ReadDirOnce(DirEntry** dirents, uint32* count,
OpenDirCookie* cookie, bool* eof, uint64* change, OpenDirCookie* cookie, bool* eof, uint64* change,
uint64* dirCookie, uint64* dirCookieVerf); uint64* dirCookie, uint64* dirCookieVerf,
bool attribute);
status_t OpenAttrDir(FileHandle* handle); status_t OpenAttrDir(FileHandle* handle);