Commit bcfb332a authored by Trond Myklebust's avatar Trond Myklebust

[PATCH] Drop reliance on file->f_dentry in NFS reads/writes

Following a request by David Chow on linux fsdevel, this patch causes
NFS read and write requests to take the inode from page->mapping->host
rather than relying on file->f_dentry->d_inode. Apparently this will
simplify some work he is doing on another filesystem.

In any case, it cleans up the current mix of sometimes doing one
thing, sometimes the other (historical cruft), and puts NFS client
behaviour on par with what is done in other filesystems...
parent b67b3c16
......@@ -452,19 +452,9 @@ nfs_readpage_result(struct rpc_task *task)
int
nfs_readpage(struct file *file, struct page *page)
{
struct inode *inode;
struct inode *inode = page->mapping->host;
int error;
if (!file) {
struct address_space *mapping = page->mapping;
if (!mapping)
BUG();
inode = mapping->host;
} else
inode = file->f_dentry->d_inode;
if (!inode)
BUG();
dprintk("NFS: nfs_readpage (%p %ld@%lu)\n",
page, PAGE_CACHE_SIZE, page->index);
/*
......
......@@ -239,17 +239,11 @@ nfs_writepage_async(struct file *file, struct inode *inode, struct page *page,
int
nfs_writepage(struct page *page)
{
struct inode *inode;
struct inode *inode = page->mapping->host;
unsigned long end_index;
unsigned offset = PAGE_CACHE_SIZE;
int err;
struct address_space *mapping = page->mapping;
if (!mapping)
BUG();
inode = mapping->host;
if (!inode)
BUG();
end_index = inode->i_size >> PAGE_CACHE_SHIFT;
/* Ensure we've flushed out any previous writes */
......@@ -769,7 +763,7 @@ nfs_strategy(struct inode *inode)
int
nfs_flush_incompatible(struct file *file, struct page *page)
{
struct inode *inode = file->f_dentry->d_inode;
struct inode *inode = page->mapping->host;
struct nfs_page *req;
int status = 0;
/*
......@@ -799,7 +793,7 @@ int
nfs_updatepage(struct file *file, struct page *page, unsigned int offset, unsigned int count)
{
struct dentry *dentry = file->f_dentry;
struct inode *inode = dentry->d_inode;
struct inode *inode = page->mapping->host;
struct nfs_page *req;
loff_t end;
int status = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment