mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH 2.5.3] Drop reliance on file->f_dentry in NFS reads/writes
Date: Fri, 1 Feb 2002 13:52:55 +0100	[thread overview]
Message-ID: <15450.36775.470342.23126@charged.uio.no> (raw)


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...

Cheers,
  Trond

diff -u --recursive --new-file linux-2.5.3-fix_put/fs/nfs/read.c linux-2.5.3-fix_mapping/fs/nfs/read.c
--- linux-2.5.3-fix_put/fs/nfs/read.c	Thu Jan 31 16:05:53 2002
+++ linux-2.5.3-fix_mapping/fs/nfs/read.c	Thu Jan 31 16:06:40 2002
@@ -452,19 +452,9 @@
 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);
 	/*
diff -u --recursive --new-file linux-2.5.3-fix_put/fs/nfs/write.c linux-2.5.3-fix_mapping/fs/nfs/write.c
--- linux-2.5.3-fix_put/fs/nfs/write.c	Thu Jan 31 16:05:53 2002
+++ linux-2.5.3-fix_mapping/fs/nfs/write.c	Thu Jan 31 16:06:40 2002
@@ -239,17 +239,11 @@
 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 @@
 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 @@
 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;


                 reply	other threads:[~2002-02-01 12:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15450.36775.470342.23126@charged.uio.no \
    --to=trond.myklebust@fys.uio.no \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®