Nfs readdir
From Linux NFS
(Difference between revisions)
(Created page with '== nfs_readdir() == * fs/nfs/dir.c * dentry defined in include/linux/dcache.h * file defined in include/linux/fs.h * path defined in include/linux/path.h * nfs_entry defined in /…') |
|||
Line 19: | Line 19: | ||
* while we have not reached the end of the directory file: | * while we have not reached the end of the directory file: | ||
** Search the page cache for the requested page (dir.c: readdir_search_pagecache) | ** Search the page cache for the requested page (dir.c: readdir_search_pagecache) | ||
- | ** if searching results in a bad cookie, it could mean that we are at the end of the directory or that the file has been deleted | + | ** if searching results in a bad cookie (EBADCOOKIE), it could mean that we are at the end of the directory or that the file has been deleted |
*** ask the server fore the next file and add to the page cache using filldir (dir.c: uncached_readdir) | *** ask the server fore the next file and add to the page cache using filldir (dir.c: uncached_readdir) | ||
*** if the response is good, go to the beginning of the while loop and look up the next entry, otherwise break out of the loop and return | *** if the response is good, go to the beginning of the while loop and look up the next entry, otherwise break out of the loop and return | ||
- | ** | + | ** if searching results in a too small error (ETOOSMALL) and if we are doing a readdir plus |
+ | *** clear the "NFS_INO_ADVISE_RDPLUS" flag contained in the nfs_inode | ||
+ | *** "zap" the cache (invalidate the nfs_inode) | ||
+ | ** if res indicates any other error, break out of the loop to clean up and exit the function | ||
+ | ** add the page to the cache | ||
+ | *** break out of the loop if there is a problem adding the page to the cache |
Revision as of 19:07, 2 July 2010
nfs_readdir()
- fs/nfs/dir.c
- dentry defined in include/linux/dcache.h
- file defined in include/linux/fs.h
- path defined in include/linux/path.h
- nfs_entry defined in /include/linux/nfs_xdr.h
- make a new dentry: my_entry
- set the cookie to the previous file, allocate a file handle and attribute struct, mark that we are not at the end of the file
- If allocations failed, goto out_alloc_failed to free memory and print a warning
- call nfs_revalidate_mapping (fs/nfs/inode.c) to validate the page cache
- if there is an error revalidating the cache, goto out to allow silly renames and free fattr / filehandle structs
- Begin a loop over directory entries
- while we have not reached the end of the directory file:
- Search the page cache for the requested page (dir.c: readdir_search_pagecache)
- if searching results in a bad cookie (EBADCOOKIE), it could mean that we are at the end of the directory or that the file has been deleted
- ask the server fore the next file and add to the page cache using filldir (dir.c: uncached_readdir)
- if the response is good, go to the beginning of the while loop and look up the next entry, otherwise break out of the loop and return
- if searching results in a too small error (ETOOSMALL) and if we are doing a readdir plus
- clear the "NFS_INO_ADVISE_RDPLUS" flag contained in the nfs_inode
- "zap" the cache (invalidate the nfs_inode)
- if res indicates any other error, break out of the loop to clean up and exit the function
- add the page to the cache
- break out of the loop if there is a problem adding the page to the cache