[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] xenpaging: make file_op largefile aware


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: Olaf Hering <olaf@xxxxxxxxx>
  • Date: Fri, 27 Jan 2012 17:35:16 +0100
  • Delivery-date: Fri, 27 Jan 2012 16:36:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

# HG changeset patch
# User Olaf Hering <olaf@xxxxxxxxx>
# Date 1327682076 -3600
# Node ID 34cf64e8b3f099a556b670ca96e0f3f695557a11
# Parent  266a12304601226213a57e39cc11aa075acdfb58
xenpaging: make file_op largefile aware

lseek() takes an off_t, the used "int << shiftsize" does not automatically
convert the int into a larger type. This leads to write errors with pagefiles
larger than 2G. Fix this by shifting an off_t instead of an int.

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>

diff -r 266a12304601 -r 34cf64e8b3f0 tools/xenpaging/file_ops.c
--- a/tools/xenpaging/file_ops.c
+++ b/tools/xenpaging/file_ops.c
@@ -26,12 +26,12 @@
 static int file_op(int fd, void *page, int i,
                    ssize_t (*fn)(int, void *, size_t))
 {
-    off_t seek_ret;
+    off_t offset = i;
     int total = 0;
     int bytes;
 
-    seek_ret = lseek(fd, i << PAGE_SHIFT, SEEK_SET);
-    if ( seek_ret == (off_t)-1 )
+    offset = lseek(fd, offset << PAGE_SHIFT, SEEK_SET);
+    if ( offset == (off_t)-1 )
         return -1;
 
     while ( total < PAGE_SIZE )

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.