From: Andrew Morton <akpm@osdl.org>
To: Jan Blunck <j.blunck@tu-harburg.de>
Cc: torvalds@osdl.org, linux-kernel@vger.kernel.org,
joern@wohnheim.fh-wedel.de
Subject: Re: [PATCH] generic_file_sendpage
Date: Fri, 15 Jul 2005 04:06:11 -0700 [thread overview]
Message-ID: <20050715040611.05907f4a.akpm@osdl.org> (raw)
In-Reply-To: <42D79468.3050808@tu-harburg.de>
Jan Blunck <j.blunck@tu-harburg.de> wrote:
>
> This is a generic sendpage() for regular files.
>
> +static inline size_t
> +filemap_copy_from_kernel(struct page *page, unsigned long offset,
> + const char *buf, unsigned bytes)
> +{
> + char *kaddr;
> +
> + kaddr = kmap(page);
> + memcpy(kaddr + offset, buf, bytes);
> + kunmap(page);
Use kmap_atomic().
Move the flush_dcache_page() into here.
> +static ssize_t
> +__generic_kernel_file_write(struct file *file, const char *buf,
> + size_t count, loff_t *ppos)
> +{
> + struct address_space * mapping = file->f_mapping;
> + struct address_space_operations *a_ops = mapping->a_ops;
> + struct inode *inode = mapping->host;
> + long status = 0;
> + loff_t pos;
> + struct page *page;
> + struct page *cached_page = NULL;
> + const int isblk = S_ISBLK(inode->i_mode);
> + ssize_t written;
> + ssize_t err;
> + size_t bytes;
> + struct pagevec lru_pvec;
> +
> + /* There is no sane reason to use O_DIRECT */
> + BUG_ON(file->f_flags & O_DIRECT);
err, this seems like an easy way for people to make the kernel go BUG.
> + if (unlikely(signal_pending(current)))
> + return -EINTR;
This doesn't help. The reason we've avoided file-to-file sendfile() is
that it can cause applications to get uninterruptibly stuck in the kernel
for ages. This code doesn't solve that problem. It needs to handle
signal_pending() inside the main loop.
And it probably needs to return a sane value (number of bytes copied)
rather than -EINTR.
I don't know if we want to add this feature, really. It's such a
specialised thing.
next prev parent reply other threads:[~2005-07-15 11:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-15 10:48 [PATCH] generic_file_sendpage Jan Blunck
2005-07-15 11:06 ` Andrew Morton [this message]
2005-07-15 11:22 ` Jörn Engel
2005-07-15 13:13 ` Jan Engelhardt
2005-07-15 16:08 ` Linus Torvalds
2005-07-15 19:02 ` Jan Engelhardt
2005-07-15 19:16 ` Linus Torvalds
2005-07-21 5:34 ` Herbert Poetzl
2005-07-15 12:34 ` [PATCH] generic_file_sendpage (updated patch) Jan Blunck
2005-07-15 16:01 ` [PATCH] generic_file_sendpage Linus Torvalds
2005-07-20 19:03 ` Jan Blunck
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=20050715040611.05907f4a.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=j.blunck@tu-harburg.de \
--cc=joern@wohnheim.fh-wedel.de \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/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