From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Urban Widmark <urban@teststation.com>,
Alexander Viro <aviro@redhat.com>,
Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: smbfs writepage & struct file
Date: Wed, 6 Dec 2000 11:05:05 +0100 (CET) [thread overview]
Message-ID: <14894.3921.666596.67064@charged.uio.no> (raw)
In-Reply-To: <Pine.LNX.4.10.10012051530100.13428-100000@penguin.transmeta.com>
In-Reply-To: <Pine.LNX.4.21.0012051959090.3205-100000@cola.svenskatest.se> <Pine.LNX.4.10.10012051530100.13428-100000@penguin.transmeta.com>
>>>>> " " == Linus Torvalds <torvalds@transmeta.com> writes:
>> I was "borrowing" stuff from the nfs code and this looked
>> strange:
>>
>> nfs_writepage_sync: struct dentry *dentry = file->f_dentry;
>> struct rpc_cred *cred = nfs_file_cred(file);
>>
>> yet it is called like this from nfs_writepage: err =
>> nfs_writepage_sync(NULL, inode, page, 0, offset);
>>
>> where file is the 1st argument. Oh, it calls
>> nfs_writepage_async most of the time. All of the time?
> That's bogus. But Trond probably overlooked it in testing,
> because yes, it always calls the async version unless there has
> been errors doing async writes (which should be rather
> uncommon).
> Trond? Can you massage the sync version to do the same as the
> async one?
Oops. That was due to a stupid oversight... I grepped for dependencies
upon dentry->d_inode, but forgot to do the same in order to weed out
the remaining file->f_dentry.
The appended patch should remove the last 'struct file' dependencies
from both readpage() and writepage().
Cheers,
Trond
diff -u --recursive --new-file linux-2.4.0-test12-pre6/fs/nfs/read.c linux-2.4.0-test12-fixme/fs/nfs/read.c
--- linux-2.4.0-test12-pre6/fs/nfs/read.c Wed Dec 6 08:34:53 2000
+++ linux-2.4.0-test12-fixme/fs/nfs/read.c Wed Dec 6 08:41:54 2000
@@ -84,8 +84,7 @@
static int
nfs_readpage_sync(struct file *file, struct inode *inode, struct page *page)
{
- struct dentry *dentry = file->f_dentry;
- struct rpc_cred *cred = nfs_file_cred(file);
+ struct rpc_cred *cred = NULL;
struct nfs_fattr fattr;
loff_t offset = page_offset(page);
char *buffer;
@@ -97,6 +96,9 @@
dprintk("NFS: nfs_readpage_sync(%p)\n", page);
+ if (file)
+ cred = nfs_file_cred(file);
+
/*
* This works now because the socket layer never tries to DMA
* into this buffer directly.
@@ -106,9 +108,9 @@
if (count < rsize)
rsize = count;
- dprintk("NFS: nfs_proc_read(%s, (%s/%s), %Ld, %d, %p)\n",
+ dprintk("NFS: nfs_proc_read(%s, (%x/%Ld), %Ld, %d, %p)\n",
NFS_SERVER(inode)->hostname,
- dentry->d_parent->d_name.name, dentry->d_name.name,
+ inode->i_dev, (long long)NFS_FILEID(inode),
(long long)offset, rsize, buffer);
lock_kernel();
diff -u --recursive --new-file linux-2.4.0-test12-pre6/fs/nfs/write.c linux-2.4.0-test12-fixme/fs/nfs/write.c
--- linux-2.4.0-test12-pre6/fs/nfs/write.c Wed Dec 6 08:34:53 2000
+++ linux-2.4.0-test12-fixme/fs/nfs/write.c Wed Dec 6 08:43:52 2000
@@ -171,8 +171,7 @@
nfs_writepage_sync(struct file *file, struct inode *inode, struct page *page,
unsigned int offset, unsigned int count)
{
- struct dentry *dentry = file->f_dentry;
- struct rpc_cred *cred = nfs_file_cred(file);
+ struct rpc_cred *cred = NULL;
loff_t base;
unsigned int wsize = NFS_SERVER(inode)->wsize;
int result, refresh = 0, written = 0, flags;
@@ -180,9 +179,13 @@
struct nfs_fattr fattr;
struct nfs_writeverf verf;
+
+ if (file)
+ cred = nfs_file_cred(file);
+
lock_kernel();
- dprintk("NFS: nfs_writepage_sync(%s/%s %d@%Ld)\n",
- dentry->d_parent->d_name.name, dentry->d_name.name,
+ dprintk("NFS: nfs_writepage_sync(%x/%Ld %d@%Ld)\n",
+ inode->i_dev, (long long)NFS_FILEID(inode),
count, (long long)(page_offset(page) + offset));
buffer = kmap(page) + offset;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2000-12-06 10:36 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-12-05 3:20 test12-pre5 Linus Torvalds
2000-12-05 3:42 ` test12-pre5 Alexander Viro
2000-12-05 4:00 ` test12-pre5 Linus Torvalds
2000-12-05 4:25 ` test12-pre5 Alexander Viro
2000-12-05 17:09 ` test12-pre5 Stephen C. Tweedie
2000-12-05 17:28 ` test12-pre5 Alexander Viro
2000-12-05 17:48 ` test12-pre5 Linus Torvalds
2000-12-05 18:14 ` test12-pre5 Alexander Viro
2000-12-05 18:33 ` test12-pre5 Linus Torvalds
2000-12-05 18:59 ` test12-pre5 Alexander Viro
2000-12-05 19:48 ` test12-pre5 Linus Torvalds
2000-12-05 20:17 ` test12-pre5 Alexander Viro
2000-12-05 23:15 ` test12-pre5 Stephen C. Tweedie
2000-12-05 18:50 ` test12-pre5 Stephen C. Tweedie
2000-12-05 5:30 ` test12-pre5 Mohammad A. Haque
2000-12-05 7:51 ` test12-pre5 Andrew Morton
2000-12-05 15:48 ` test12-pre5 Daniel Phillips
2000-12-05 23:25 ` smbfs writepage & struct file Urban Widmark
2000-12-05 23:57 ` Linus Torvalds
2000-12-10 13:43 ` Urban Widmark
2000-12-06 10:05 ` Trond Myklebust [this message]
2000-12-06 13:18 ` test12-pre5 Panu Matilainen
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=14894.3921.666596.67064@charged.uio.no \
--to=trond.myklebust@fys.uio.no \
--cc=aviro@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
--cc=urban@teststation.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®