From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lo16h-0001Jk-1v for qemu-devel@nongnu.org; Sun, 29 Mar 2009 15:55:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lo16c-0001Hi-95 for qemu-devel@nongnu.org; Sun, 29 Mar 2009 15:55:46 -0400 Received: from [199.232.76.173] (port=37847 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lo16c-0001Hd-2n for qemu-devel@nongnu.org; Sun, 29 Mar 2009 15:55:42 -0400 Received: from verein.lst.de ([213.95.11.210]:56586) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1Lo16b-0004yD-DL for qemu-devel@nongnu.org; Sun, 29 Mar 2009 15:55:41 -0400 Received: from verein.lst.de (localhost [127.0.0.1]) by verein.lst.de (8.12.3/8.12.3/Debian-7.1) with ESMTP id n2TJtdIF001354 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Sun, 29 Mar 2009 21:55:39 +0200 Received: (from hch@localhost) by verein.lst.de (8.12.3/8.12.3/Debian-6.6) id n2TJtdLE001352 for qemu-devel@nongnu.org; Sun, 29 Mar 2009 21:55:39 +0200 Date: Sun, 29 Mar 2009 21:55:39 +0200 From: Christoph Hellwig Message-ID: <20090329195539.GE1215@lst.de> References: <20090329195346.GA625@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090329195346.GA625@lst.de> Subject: [Qemu-devel] [PATCH 5/5] experimental native preadv/pwritev support for Linux Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This ties up Gerd Hoffmann's unmerged preadv/pwritev syscalls to qemu. Use with care as the syscall numbers aren't finalized yet. Also the patch is ugly enough that I hope we might not need it at all if preadv/pwritev go into glibc fast enough.. Signed-off-by: Christoph Hellwig Index: qemu/posix-aio-compat.c =================================================================== --- qemu.orig/posix-aio-compat.c 2009-03-29 21:40:34.841130592 +0200 +++ qemu/posix-aio-compat.c 2009-03-29 21:42:13.582073269 +0200 @@ -33,7 +33,7 @@ static int cur_threads = 0; static int idle_threads = 0; static TAILQ_HEAD(, qemu_paiocb) request_list; -#ifdef HAVE_PREADV +#if defined(HAVE_PREADV) || (defined(__linux__) && defined(__i386__)) static int preadv_present = 1; #else static int preadv_present = 0; @@ -93,6 +93,31 @@ static size_t handle_aiocb_ioctl(struct return ret; } +#if defined (__linux__) && defined(__i386__) + +#define __NR_preadv 333 +#define __NR_pwritev 334 + +static ssize_t +qemu_preadv(int fd, const struct iovec *iov, int nr_iov, off_t offset) +{ + uint32_t pos_high = offset >> 32; + uint32_t pos_low = offset; + + return syscall(__NR_preadv, fd, iov, (unsigned long)nr_iov, pos_high, pos_low); +} + +static ssize_t +qemu_pwritev(int fd, const struct iovec *iov, int nr_iov, off_t offset) +{ + uint32_t pos_high = offset >> 32; + uint32_t pos_low = offset; + + return syscall(__NR_pwritev, fd, iov, (unsigned long)nr_iov, pos_high, pos_low); +} + +#else + #ifdef HAVE_PREADV static ssize_t @@ -122,6 +147,7 @@ qemu_pwritev(int fd, const struct iovec } #endif +#endif /* * Check if we need to copy the data in the aiocb into a new