[seeker] Apply Ian Sherratt's (modified) timeout/block-alignment patch (#623667).
Ville Skyttä
scop at fedoraproject.org
Thu Aug 19 11:08:18 UTC 2010
commit fe5760ae0e426449aeb7d5357b30a0f9b3749a5d
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Thu Aug 19 14:07:50 2010 +0300
Apply Ian Sherratt's (modified) timeout/block-alignment patch (#623667).
seeker-3.0-timeout-blockalign-623667.patch | 70 ++++++++++++++++++++++++++++
seeker.spec | 12 ++++-
2 files changed, 79 insertions(+), 3 deletions(-)
---
diff --git a/seeker-3.0-timeout-blockalign-623667.patch b/seeker-3.0-timeout-blockalign-623667.patch
new file mode 100644
index 0000000..3256bb1
--- /dev/null
+++ b/seeker-3.0-timeout-blockalign-623667.patch
@@ -0,0 +1,70 @@
+--- seeker_baryluk.c~ 2009-09-15 09:10:05.000000000 +0300
++++ seeker_baryluk.c 2010-08-19 12:33:45.151306691 +0300
+@@ -17,11 +17,12 @@
+ #include <linux/fs.h>
+
+ #define BLOCKSIZE 512
+-#define TIMEOUT 30
++#define DEFAULT_TIMEOUT 30
+
+ pthread_mutex_t muteks = PTHREAD_MUTEX_INITIALIZER;
+
+ int count;
++int TIMEOUT;
+ time_t start;
+ off64_t maxoffset = 0;
+ off64_t minoffset = 249994674176000uLL;
+@@ -90,7 +91,9 @@
+
+ while (p->run) {
+ offset = (off64_t) ( (unsigned long long) (p->numbytes * (rand_r(&(p->seed)) / (RAND_MAX + 1.0) )));
+- //printf("%d %llu\n", p->id, (unsigned long long )offset);
++ // do blocksize aligned seeks
++ offset = offset & (~((off64_t) 0) & (~(BLOCKSIZE-1))) ;
++ //printf("%d %x\n", p->id, (unsigned long long )offset);
+ retval = lseek64(p->fd, offset, SEEK_SET);
+ handle("lseek64", retval == (off64_t) -1);
+ retval = read(p->fd, p->buffer, BLOCKSIZE);
+@@ -121,22 +124,26 @@
+
+ setvbuf(stdout, NULL, _IONBF, 0);
+
+- printf("Seeker v3.0, 2009-06-17, "
++ printf("Seeker v3.0+Fedora, 2009-06-17, "
+ "http://www.linuxinsight.com/how_fast_is_your_disk.html\n");
+
+- if (!(argc == 2 || argc == 3)) {
+- printf("Usage: %s device [threads]\n", argv[0]);
++ if (!(argc == 2 || argc == 3 || argc == 4)) {
++ printf("Usage: %s device [threads] [seconds]\n", argv[0]);
+ exit(1);
+ }
+
+ threads = 1;
+- if (argc == 3) {
++ TIMEOUT = DEFAULT_TIMEOUT;
++ if (argc > 2) {
+ threads = atoi(argv[2]);
++ if (argc > 3) {
++ TIMEOUT = atoi(argv[3]);
++ }
+ }
+
+ //pthread_mutex_init(&muteks, NULL);
+
+- fd = open(argv[1], O_RDONLY | O_LARGEFILE);
++ fd = open(argv[1], O_RDONLY | O_LARGEFILE | O_DIRECT);
+ handle("open", fd < 0);
+
+ #ifdef BLKGETSIZE64
+@@ -177,7 +184,9 @@
+ p[i].seed = rand()+i;
+ p[i].fd = dup(fd);
+ handle("dup", p[i].fd < 0);
+- p[i].buffer = malloc(sizeof(char)*BLOCKSIZE);
++ p[i].buffer = memalign(512*8, sizeof(char)*BLOCKSIZE);
++ //printf("\n%x\n", (int)(&(p[i].buffer)));
++
+ p[i].numbytes = numbytes;
+ handle("malloc", p[i].buffer == NULL);
+ p[i].run = 1;
diff --git a/seeker.spec b/seeker.spec
index a694868..16e0e42 100644
--- a/seeker.spec
+++ b/seeker.spec
@@ -1,6 +1,6 @@
Name: seeker
Version: 3.0
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Random access disk benchmark utility
Group: Applications/System
@@ -13,6 +13,8 @@ Source1: %{name}.LICENSE
# Grabbed with firefox, modified, ran through tidy(1) per CC BY-SA 2.5:
# http://www.linuxinsight.com/about.html
Source2: %{name}-docs.tar.gz
+# https://bugzilla.redhat.com/623667
+Patch0: %{name}-3.0-timeout-blockalign-623667.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description
@@ -25,12 +27,13 @@ by Witold Baryluk.
%prep
%setup -q -c -T -a 2
-install -pm 644 %{SOURCE0} $(basename %{SOURCE0}) # for debuginfo
+install -pm 644 %{SOURCE0} $(basename %{SOURCE0}) # for debuginfo, Patch0
+%patch0
cp -p %{SOURCE1} LICENSE
%build
-%{__cc} $RPM_OPT_FLAGS -pthread $(basename %{SOURCE0}) -o seeker
+%{__cc} -D_GNU_SOURCE $RPM_OPT_FLAGS -pthread $(basename %{SOURCE0}) -o seeker
%install
@@ -49,6 +52,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Thu Aug 19 2010 Ville Skyttä <ville.skytta at iki.fi> - 3.0-3
+- Apply Ian Sherratt's (modified) timeout/block-alignment patch (#623667).
+
* Sun Sep 13 2009 Ville Skyttä <ville.skytta at iki.fi> - 3.0-2
- Address review comments (#520701):
- Improve %%description.
More information about the scm-commits
mailing list