Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 101911
b: refs/heads/master
c: b7eaefa
h: refs/heads/master
i:
  101909: c1841d5
  101907: 00aa768
  101903: 21dbf47
v: v3
  • Loading branch information
Chuck Lever authored and Trond Myklebust committed Jul 9, 2008
1 parent daaae8a commit 0203933
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cc0dd2d1052aede2946ad1338a8f6f5d5c604740
refs/heads/master: b7eaefaa8722fd98e5c2632640d1abd2b0c83e84
29 changes: 27 additions & 2 deletions trunk/fs/nfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@ static int nfs_write_begin(struct file *file, struct address_space *mapping,
struct page *page;
index = pos >> PAGE_CACHE_SHIFT;

dfprintk(PAGECACHE, "NFS: write_begin(%s/%s(%ld), %u@%lld)\n",
file->f_path.dentry->d_parent->d_name.name,
file->f_path.dentry->d_name.name,
mapping->host->i_ino, len, (long long) pos);

page = __grab_cache_page(mapping, index);
if (!page)
return -ENOMEM;
Expand All @@ -355,6 +360,11 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,
unsigned offset = pos & (PAGE_CACHE_SIZE - 1);
int status;

dfprintk(PAGECACHE, "NFS: write_end(%s/%s(%ld), %u@%lld)\n",
file->f_path.dentry->d_parent->d_name.name,
file->f_path.dentry->d_name.name,
mapping->host->i_ino, len, (long long) pos);

/*
* Zero any uninitialised parts of the page, and then mark the page
* as up to date if it turns out that we're extending the file.
Expand Down Expand Up @@ -389,6 +399,8 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,

static void nfs_invalidate_page(struct page *page, unsigned long offset)
{
dfprintk(PAGECACHE, "NFS: invalidate_page(%p, %lu)\n", page, offset);

if (offset != 0)
return;
/* Cancel any unstarted writes on this page */
Expand All @@ -397,13 +409,20 @@ static void nfs_invalidate_page(struct page *page, unsigned long offset)

static int nfs_release_page(struct page *page, gfp_t gfp)
{
dfprintk(PAGECACHE, "NFS: release_page(%p)\n", page);

/* If PagePrivate() is set, then the page is not freeable */
return 0;
}

static int nfs_launder_page(struct page *page)
{
return nfs_wb_page(page->mapping->host, page);
struct inode *inode = page->mapping->host;

dfprintk(PAGECACHE, "NFS: launder_page(%ld, %llu)\n",
inode->i_ino, (long long)page_offset(page));

return nfs_wb_page(inode, page);
}

const struct address_space_operations nfs_file_aops = {
Expand All @@ -423,13 +442,19 @@ const struct address_space_operations nfs_file_aops = {
static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page)
{
struct file *filp = vma->vm_file;
struct dentry *dentry = filp->f_path.dentry;
unsigned pagelen;
int ret = -EINVAL;
struct address_space *mapping;

dfprintk(PAGECACHE, "NFS: vm_page_mkwrite(%s/%s(%ld), offset %lld)\n",
dentry->d_parent->d_name.name, dentry->d_name.name,
filp->f_mapping->host->i_ino,
(long long)page_offset(page));

lock_page(page);
mapping = page->mapping;
if (mapping != vma->vm_file->f_path.dentry->d_inode->i_mapping)
if (mapping != dentry->d_inode->i_mapping)
goto out_unlock;

ret = 0;
Expand Down

0 comments on commit 0203933

Please sign in to comment.