From: David Chow <davidchow@shaolinmicro.com>
To: linux-fsdevel@vger.kernel.org, trond.myklebust@fys.uio.no
Subject: nfs3_proc_write()
Date: Thu, 03 Jul 2003 19:09:01 +0800 [thread overview]
Message-ID: <3F040ECD.7070108@shaolinmicro.com> (raw)
Trond,
I am in the middle of porting the my old nfs_swap code from 2.4.19 to
2.4.21 . I notice the interface of nfs3_proc_write() has changed, the
old code uses a (char *)buffer but the new one uses a (struct page *) .
When I did the following change, it didn't work.
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20)
u8 *buffer = (char *)kmap(page);
#endif
result = NFS_PROTO(inode)->write(inode, cred,
&fattr,
NFS_RW_SWAP|NFS_RW_SYNC,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)
offset, wsize, page, &verf);
#else
offset, wsize, buffer, &verf);
#endif
What happens is it causes an exception in kmap() which is called by
xdr_kmap() . By tracing the stack with kdb, the path is as follows
nfs3_proc_write-> nfs3_rpc_wrapper->
rpc_call_sync->rpc_execute->__rpc_execute->call_transmit->xprt_trnasmit->
do_xprt_transmit->xdr_kmap->kmap(inlined)
By using objdump, the exact instruction which fails in the xdr_kmap() as
the following
len = PAGE_CACHE_SIZE;
if (first_kmap) {
first_kmap = 0;
!!!! iov->iov_base = kmap(*ppage); !!!!
} else {
The exception is caused by the return page_address(page) . I've also
tried a trival kmap(page) before triggering nfs3_proc_write() but the
result is the same. My system only have 128MB RAM so I think it is
trival that kmap(0 will actually do anything. Looks like the write path
code of nfs has change a bit which causes this not going to work. The
reason why nfs_writepage_sync() can't be used is because the
nfs_writepage_sync() assumes page_offset(page) equals to file offset
but in a swap page this is not true. Please give some hints what is
going on or which part of code I should look for.
regards,
David Chow
next reply other threads:[~2003-07-03 10:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-03 11:09 David Chow [this message]
2003-07-03 11:30 ` nfs3_proc_write() Trond Myklebust
2003-07-03 11:49 ` nfs3_proc_write() Trond Myklebust
2003-07-03 12:29 ` nfs3_proc_write() David Chow
2003-07-03 12:55 ` nfs3_proc_write() Trond Myklebust
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=3F040ECD.7070108@shaolinmicro.com \
--to=davidchow@shaolinmicro.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=trond.myklebust@fys.uio.no \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.