From: Badari Pulavarty <pbadari@us.ibm.com>
To: lkml <linux-kernel@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Cc: Zach Brown <zach.brown@oracle.com>,
Christoph Hellwig <hch@infradead.org>,
akpm@osdl.org
Subject: [RFC][PATCH] Support for preadv()/pwritev()
Date: Fri, 09 Dec 2005 13:11:04 -0800 [thread overview]
Message-ID: <1134162664.16646.22.camel@localhost.localdomain> (raw)
[-- Attachment #1: Type: text/plain, Size: 498 bytes --]
Hi,
Some of the database folks are looking going towards "threaded"
database model and wants support for preadv() and pwritev() -
so that they have a way of doing lseek() followed by readv/writev()
in the thread-safe way.
Here is the patch I cooked up and looking for feedback. I really
don't like adding new syscalls for this, but I don't see a way out.
Of course, database folks want aio_readv/aio_writev() support also,
which Zack is working on.
Comments ? Suggestions ?
Thanks,
Badari
[-- Attachment #2: preadv-pwritev.patch --]
[-- Type: text/x-patch, Size: 1786 bytes --]
diff -Narup -X dontdiff linux-2.6.15-rc5/arch/i386/kernel/syscall_table.S linux-2.6.15-rc5.preadv/arch/i386/kernel/syscall_table.S
--- linux-2.6.15-rc5/arch/i386/kernel/syscall_table.S 2005-12-03 21:10:42.000000000 -0800
+++ linux-2.6.15-rc5.preadv/arch/i386/kernel/syscall_table.S 2005-12-09 08:01:22.465116256 -0800
@@ -294,3 +294,5 @@ ENTRY(sys_call_table)
.long sys_inotify_init
.long sys_inotify_add_watch
.long sys_inotify_rm_watch
+ .long sys_preadv
+ .long sys_pwritev
diff -Narup -X dontdiff linux-2.6.15-rc5/fs/read_write.c linux-2.6.15-rc5.preadv/fs/read_write.c
--- linux-2.6.15-rc5/fs/read_write.c 2005-12-03 21:10:42.000000000 -0800
+++ linux-2.6.15-rc5.preadv/fs/read_write.c 2005-12-09 08:02:43.590783280 -0800
@@ -622,6 +622,46 @@ sys_writev(unsigned long fd, const struc
return ret;
}
+asmlinkage ssize_t sys_preadv(unsigned int fd, const struct iovec __user *vec,
+ unsigned long vlen, loff_t pos)
+{
+ struct file *file;
+ ssize_t ret = -EBADF;
+ int fput_needed;
+
+ if (pos < 0)
+ return -EINVAL;
+
+ file = fget_light(fd, &fput_needed);
+ if (file) {
+ ret = -ESPIPE;
+ if (file->f_mode & FMODE_PREAD)
+ ret = vfs_readv(file, vec, vlen, &pos);
+ fput_light(file, fput_needed);
+ }
+ return ret;
+}
+
+asmlinkage ssize_t sys_pwritev(unsigned int fd, const struct iovec __user *vec,
+ unsigned long vlen, loff_t pos)
+{
+ struct file *file;
+ ssize_t ret = -EBADF;
+ int fput_needed;
+
+ if (pos < 0)
+ return -EINVAL;
+
+ file = fget_light(fd, &fput_needed);
+ if (file) {
+ ret = -ESPIPE;
+ if (file->f_mode & FMODE_PWRITE)
+ ret = vfs_writev(file, vec, vlen, &pos);
+ fput_light(file, fput_needed);
+ }
+ return ret;
+}
+
static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
size_t count, loff_t max)
{
reply other threads:[~2005-12-09 21:11 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=1134162664.16646.22.camel@localhost.localdomain \
--to=pbadari@us.ibm.com \
--cc=akpm@osdl.org \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zach.brown@oracle.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;
as well as URLs for NNTP newsgroup(s).