From 7bef7db5ccd9c68f28ba541cb9a7bb0b15641945 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 4 Jan 2007 09:17:55 +0000 Subject: [PATCH] * fhandler.h (PREFERRED_IO_BLKSIZE): Define as 64K. * fhandler.cc (fhandler_base::fstat): Set st_blksize to PREFERRED_IO_BLKSIZE. * fhandler_disk_file.cc (fhandler_base::fstat_helper): Ditto. * fhandler_mailslot.cc (fhandler_mailslot::fstat): Ditto. * fhandler_raw.cc (fhandler_dev_raw::fstat): Ditto. --- winsup/cygwin/ChangeLog | 10 ++++++++++ winsup/cygwin/fhandler.cc | 4 ++-- winsup/cygwin/fhandler.h | 7 ++++++- winsup/cygwin/fhandler_disk_file.cc | 4 ++-- winsup/cygwin/fhandler_mailslot.cc | 4 ++-- winsup/cygwin/fhandler_raw.cc | 4 ++-- 6 files changed, 24 insertions(+), 9 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 943065ae3..893c35e64 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,13 @@ +2007-01-04 Brian Ford + Corinna Vinschen + + * fhandler.h (PREFERRED_IO_BLKSIZE): Define as 64K. + * fhandler.cc (fhandler_base::fstat): Set st_blksize to + PREFERRED_IO_BLKSIZE. + * fhandler_disk_file.cc (fhandler_base::fstat_helper): Ditto. + * fhandler_mailslot.cc (fhandler_mailslot::fstat): Ditto. + * fhandler_raw.cc (fhandler_dev_raw::fstat): Ditto. + 2007-01-01 Christopher Faylor * spawn.cc (spawn_guts): Don't expect synchronization from a non-cygwin diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 5070855dd..7c51a6e3d 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -1,7 +1,7 @@ /* fhandler.cc. See console.cc for fhandler_console functions. Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006 Red Hat, Inc. + 2005, 2006, 2007 Red Hat, Inc. This file is part of Cygwin. @@ -1328,7 +1328,7 @@ fhandler_base::fstat (struct __stat64 *buf) buf->st_uid = geteuid32 (); buf->st_gid = getegid32 (); buf->st_nlink = 1; - buf->st_blksize = S_BLKSIZE; + buf->st_blksize = PREFERRED_IO_BLKSIZE; time_as_timestruc_t (&buf->st_ctim); buf->st_atim = buf->st_mtim = buf->st_ctim; return 0; diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 6e7bf4821..5a294f30a 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -1,7 +1,7 @@ /* fhandler.h Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006 Red Hat, Inc. + 2005, 2006, 2007 Red Hat, Inc. This file is part of Cygwin. @@ -25,6 +25,11 @@ details. */ both flags are set. */ #define O_NONBLOCK_MASK (O_NONBLOCK | OLD_O_NDELAY) +/* It appears that 64K is the block size used for buffered I/O on NT. + Using this blocksize in read/write calls in the application results + in a much better performance than using smaller values. */ +#define PREFERRED_IO_BLKSIZE ((blksize_t) 65536) + extern const char *windows_device_names[]; extern struct __cygwin_perfile *perfile_table; #define __fmode (*(user_data->fmode_ptr)) diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index d7f4b3d94..15f39e42f 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1,7 +1,7 @@ /* fhandler_disk_file.cc Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006 Red Hat, Inc. + 2005, 2006, 2007 Red Hat, Inc. This file is part of Cygwin. @@ -436,7 +436,7 @@ fhandler_base::fstat_helper (struct __stat64 *buf, else buf->st_ino = get_namehash (); - buf->st_blksize = S_BLKSIZE; + buf->st_blksize = PREFERRED_IO_BLKSIZE; if (nAllocSize >= 0LL) /* A successful NtQueryInformationFile returns the allocation size diff --git a/winsup/cygwin/fhandler_mailslot.cc b/winsup/cygwin/fhandler_mailslot.cc index 07babd2fd..133df0414 100644 --- a/winsup/cygwin/fhandler_mailslot.cc +++ b/winsup/cygwin/fhandler_mailslot.cc @@ -1,6 +1,6 @@ /* fhandler_mailslot.cc. See fhandler.h for a description of the fhandler classes. - Copyright 2005 Red Hat, Inc. + Copyright 2005, 2007 Red Hat, Inc. This file is part of Cygwin. @@ -42,7 +42,7 @@ fhandler_mailslot::fstat (struct __stat64 *buf) buf->st_uid = geteuid32 (); buf->st_gid = getegid32 (); buf->st_nlink = 1; - buf->st_blksize = S_BLKSIZE; + buf->st_blksize = PREFERRED_IO_BLKSIZE; time_as_timestruc_t (&buf->st_ctim); buf->st_atim = buf->st_mtim = buf->st_ctim; } diff --git a/winsup/cygwin/fhandler_raw.cc b/winsup/cygwin/fhandler_raw.cc index 77ee252bc..9478ee788 100644 --- a/winsup/cygwin/fhandler_raw.cc +++ b/winsup/cygwin/fhandler_raw.cc @@ -1,6 +1,6 @@ /* fhandler_raw.cc. See fhandler.h for a description of the fhandler classes. - Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc. + Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 Red Hat, Inc. This file is part of Cygwin. @@ -55,7 +55,7 @@ fhandler_dev_raw::fstat (struct __stat64 *buf) buf->st_uid = geteuid32 (); buf->st_gid = getegid32 (); buf->st_nlink = 1; - buf->st_blksize = S_BLKSIZE; + buf->st_blksize = PREFERRED_IO_BLKSIZE; time_as_timestruc_t (&buf->st_ctim); buf->st_atim = buf->st_mtim = buf->st_ctim; }